Try   HackMD

WG-async meeting agenda

  • Meeting date: 2024-09-05

Attendance

  • People: TC, Yosh, eholk

Meeting roles

  • Minutes: TC

Scheduled meetings

None.

Update these here.

Proposed meetings

None.

Update these here.

Announcements or custom items

(Meeting attendees, feel free to add items here!)

Scheduling for September

  • 12th: No meeting, RustConf
  • 19th
    • Reorganizing WG-async.
  • 26th: No meeting.

Suggestions:

  • Can we help unblock async closure syntax?
    • Probably not much we can do here.
  • Unsafe lifetime binders?
    • Also probably not much to do yet?
  • wg-async button pressing to create T-lang-async-advisors
    • Write an RFC together?

Untriaged issues

"Misleading help suggests Sync bound when shareable reference is passed across or into await" rust#129105

Link: https://github.com/rust-lang/rust/issues/129105

fn spawn<F: Future + Send + 'static>(_: F) {}

fn spawn_task<T: Send + 'static>(mut state: T) {
    spawn(async move {
        let x = &mut state; // <-- Remove `mut` for error.
        async move { _ = [x] }.await;
    });
}

fn main() {}
trait AllSend<'a, T: 'a + ?Sized>
where
    &'a mut T: Send,
{
}

impl<'a, T: ?Sized + Send + 'a> AllSend<'a, T> for T {}

Proposed responses:


This is a cool technique to work around this issue! It seems like in general the Sync bound is going to be the "more correct" solution, so I wouldn't want to remove that from the suggestion. Then the question is whether to also suggest using a mutable reference. This is already a long error message, so we want to avoid making it longer and likely more confusing. In most cases it seems better to treat this mutable reference as an advanced technique.


@rustbot labels +AsyncAwait-Triaged -needs-triage

Interesting. We talked about this today in WG-async triage.

We minimized the issue as follows:

fn spawn<F: Future + Send + 'static>(_: F) {}

fn spawn_task<T: Send + 'static>(mut state: T) {
    spawn(async move {
        let x = &mut state; // <-- Remove `mut` for error.
        async move { _ = [x] }.await;
    });
}

fn main() {}

We also wrote this to demonstrate the interesting behavior of &mut here:

trait AllSend<'a, T: 'a + ?Sized>
where
    &'a mut T: Send, // <-- Remove `mut` to get error.
{
}

impl<'a, T: ?Sized + Send + 'a> AllSend<'a, T> for T {}

Overall, we felt in general that adding the Sync bound is going to be the right thing to do in most cases. We were skeptical about how generalizable the suggestion of threading mut throughout would be. We think the error message might just get too long if we were to try to suggest mut here, so we think things are probably fine as-is. Using mut to solve the problem here is a bit of a subtle technique.

(The meeting ended here.)

"#[inline(never)] does not work for async functions" rust#129347

Link: https://github.com/rust-lang/rust/issues/129347

"async code fails to compile with -Znext-solver" rust#129865

Link: https://github.com/rust-lang/rust/issues/129865

"Add LocalWaker support" libs-team#191

Link: https://github.com/rust-lang/libs-team/issues/191

"Context reactor hook" libs-team#347

Link: https://github.com/rust-lang/libs-team/issues/347

Nominated RFCs, PRs, and issues

"Generic Futures" rfcs#3434

Link: https://github.com/rust-lang/rfcs/pull/3434

"Tracking Issue for task::Waker::noop" rust#98286

Link: https://github.com/rust-lang/rust/issues/98286

"Rename AsyncIterator back to Stream, introduce an AFIT-based AsyncIterator trait" rust#119550

Link: https://github.com/rust-lang/rust/pull/119550

"Clarification needed on what happens when Future::poll wakes an old waker" rust#119698

Link: https://github.com/rust-lang/rust/issues/119698

"Overly conservative async capture analysis when values are borrowed" rust#129325

Link: https://github.com/rust-lang/rust/issues/129325

"Context reactor hook" libs-team#347

Link: https://github.com/rust-lang/libs-team/issues/347

WG RFCs, PRs, and issues nominated for T-lang/T-types

None.

Pending PRs on the WG-async repo

None.

S-waiting-on-team

"Rename AsyncIterator back to Stream, introduce an AFIT-based AsyncIterator trait" rust#119550

Link: https://github.com/rust-lang/rust/pull/119550

Proposed FCPs

Check your boxes!

None.

Active FCPs

None.

P-critical issues

None.

WG-async work project board

https://github.com/orgs/rust-lang/projects/29/views1/d