Stream: wg-async-foundations

Topic: meeting 2019.07.09


nikomatsakis (Jul 09 2019 at 17:02, on Zulip):

Hey @WG-async-foundations -- sync meeting?

nikomatsakis (Jul 09 2019 at 17:02, on Zulip):

@Giles Cope over in #wg-async-foundations/book, you wrote

Sorry I've been busy. Things have calmed down a bit hopefully. Shall I just pick off some tests from the test list and add them? https://github.com/rust-lang/rust/issues/62121

but I imagine that was meant for this stream :)

nikomatsakis (Jul 09 2019 at 17:02, on Zulip):

I think that'd be awesome!

Taylor Cramer (Jul 09 2019 at 17:03, on Zulip):

o/

nikomatsakis (Jul 09 2019 at 17:04, on Zulip):

Reviewing briefly the uncategorized issues I see only one:

nikomatsakis (Jul 09 2019 at 17:04, on Zulip):

async fn with elided lifetime causes rustc panic #62517

nikomatsakis (Jul 09 2019 at 17:05, on Zulip):

which..I guess I will categorize as blocking? I hope it's simple

nikomatsakis (Jul 09 2019 at 17:05, on Zulip):

on the topic of blocking, shall we look at the blocking issues and try to make sure we have a plan? I have thoughts on some of them

nikomatsakis (Jul 09 2019 at 17:06, on Zulip):

going from the bottom:

Using associated types in async fn type break typing #60414

has a pending PR that I think I will r+ :)

nikomatsakis (Jul 09 2019 at 17:08, on Zulip):

type inference doesn't work in async fn that return Box<dyn SomeTrait> #60424

@davidtwco and I spent some time on this, it's tricky. I guess I want to ask: if we are not able to fix it, do we regard it as blocking? I feel like (on balance) it should not block stabilization, but I guess there may be some forward compat issues around this?

nikomatsakis (Jul 09 2019 at 17:08, on Zulip):

Not sure what those would be though

nikomatsakis (Jul 09 2019 at 17:08, on Zulip):

in general I think we accept strictly less than we otherwise would, but I can imagine it's possible to create some examples where behavior might change

Taylor Cramer (Jul 09 2019 at 17:08, on Zulip):

Yeah I can't sort out how you'd make it compile but break if we fixed this

nikomatsakis (Jul 09 2019 at 17:08, on Zulip):

(always true when we mess with inference/coercions)

Taylor Cramer (Jul 09 2019 at 17:09, on Zulip):

because the issue here is that a necessary coercion isn't happening, triggering an error

nikomatsakis (Jul 09 2019 at 17:09, on Zulip):

right

nikomatsakis (Jul 09 2019 at 17:09, on Zulip):

maybe I'll add the "unclear" tag to indicate our doubt (but keep blocking for now)

nikomatsakis (Jul 09 2019 at 17:10, on Zulip):

I did do a local build of the proposed change (and observe the same failures that @davidtwco was getting), and I hope to at least look at what's going on, maybe there's a simple sol'n

davidtwco (Jul 09 2019 at 17:10, on Zulip):

Anything I can do to help/reduce the load, let me know.

nikomatsakis (Jul 09 2019 at 17:11, on Zulip):

I have other plans for you :P

davidtwco (Jul 09 2019 at 17:11, on Zulip):

yay?

nikomatsakis (Jul 09 2019 at 17:12, on Zulip):

Next issue:

Inherent async fn returning Self treats type's lifetime parameters as 'static #61949

So as we discussed last time we can fix this either by forbidding Self or be trying to track what type it refers to. I lean towards the latter and was going to suggest that @davidtwco or someone else might want to take a swing at it.

nikomatsakis (Jul 09 2019 at 17:12, on Zulip):

I guess I feel like i'd rather "do the correct thing" as long as it's not too terribly grody

nikomatsakis (Jul 09 2019 at 17:12, on Zulip):

I had hoped to leave a few notes on what that requires

davidtwco (Jul 09 2019 at 17:13, on Zulip):

I'm not sure what a solution for that would entail, but with some notes, I'd be happy to take a look.

nikomatsakis (Jul 09 2019 at 17:13, on Zulip):

Anyway, I wouldn't expect a lot of controversy on that? We can start a topic to discuss the details (I was planning on taking time after this mtg for that)

nikomatsakis (Jul 09 2019 at 17:15, on Zulip):

There is another aspect to this which I noted, which has to do with T::Item (when it expands to <T as Foo<'a>>::Item). This is a pre-existing issue from impl Trait https://github.com/rust-lang/rust/issues/51525 and I don't think it necessarily needs to block here. I was however going to add some mentoring notes to basically make such scenarios an error for now so we can fix them later.

nikomatsakis (Jul 09 2019 at 17:15, on Zulip):

(The Self thing is also a pre-existing impl Trait issue, of course)

nikomatsakis (Jul 09 2019 at 17:16, on Zulip):

In any case, not too worried about those

nikomatsakis (Jul 09 2019 at 17:16, on Zulip):

That brings us to:

increase test coverage for async-await #62121

So what's the status here?

nikomatsakis (Jul 09 2019 at 17:17, on Zulip):

I wanted to maybe write some tests but found it a bit hard to figure out what to do, I have to admit, but I didn't look too hard

Taylor Cramer (Jul 09 2019 at 17:17, on Zulip):

Status is I'll have another PR out pretty soon, but basically just "add tests until all the bullets on that list have at least one dedicated test showing coverage"

nikomatsakis (Jul 09 2019 at 17:18, on Zulip):

How can we tell which ones have tests?

nikomatsakis (Jul 09 2019 at 17:18, on Zulip):

I guess just look in the directory and your PRs and try to match up?

nikomatsakis (Jul 09 2019 at 17:18, on Zulip):

@Giles Cope mentioned writing some tests earlier, maybe you want to delegate some to them?

Taylor Cramer (Jul 09 2019 at 17:18, on Zulip):

Yup, although it'd be good to add comments / strikeouts on the doc for ones that are covered

nikomatsakis (Jul 09 2019 at 17:19, on Zulip):

Yeah I was thinking ideal would be a checklist on the issue but strikeouts in the doc would work too

nikomatsakis (Jul 09 2019 at 17:19, on Zulip):

and would be less grunt work

nikomatsakis (Jul 09 2019 at 17:19, on Zulip):

I guess we discussed adding variants of the impl trait "multi-lifetime" tests for async functions

Taylor Cramer (Jul 09 2019 at 17:20, on Zulip):

Yeah, a checklist box got added to the issue for that

nikomatsakis (Jul 09 2019 at 17:20, on Zulip):

I saw

nikomatsakis (Jul 09 2019 at 17:20, on Zulip):

Move tests in src/test/run-pass/async-await -> src/test/ui/async-await #62236

nikomatsakis (Jul 09 2019 at 17:20, on Zulip):

has pending PR https://github.com/rust-lang/rust/pull/62270

nikomatsakis (Jul 09 2019 at 17:20, on Zulip):

though with some strange error

nikomatsakis (Jul 09 2019 at 17:21, on Zulip):

(@tmandry, did you see that error?)

nikomatsakis (Jul 09 2019 at 17:21, on Zulip):

maybe just needs to be rebased etc

nikomatsakis (Jul 09 2019 at 17:21, on Zulip):

anyway doesn't seem like the most pressing concern ever :)

nikomatsakis (Jul 09 2019 at 17:21, on Zulip):

well, the error is weird. the moving of tests less so

nikomatsakis (Jul 09 2019 at 17:22, on Zulip):

Next up:

Mutually recursive async fns are hard to make Send #62284

So this one worries me a bit. I'm not 100% sure though if it should be blocking. But I don't think we really have a plan to fix it?

nikomatsakis (Jul 09 2019 at 17:22, on Zulip):

It seems like recursive functions in general are harder than we would like -- at minimum I expect they merit a chapter in the book?

nikomatsakis (Jul 09 2019 at 17:22, on Zulip):

We should have a chapter like "surprisingly hard things" and talk about the (current) workarounds :)

Giles Cope (Jul 09 2019 at 17:23, on Zulip):

^ this

nikomatsakis (Jul 09 2019 at 17:23, on Zulip):

I personally would be satisfied with that for stabilization purposes

nikomatsakis (Jul 09 2019 at 17:24, on Zulip):

I'm fine of course if we can fix the issue too, though I think we will still need such a chapter probably since recursion in general is a bit tricky

nikomatsakis (Jul 09 2019 at 17:25, on Zulip):

filed "surprisingly hard things" async-book#22

boats (Jul 09 2019 at 17:27, on Zulip):

Regarding recursive functions, we've always known (but I'm sure its not widely known) that you have to at least box them. Unfortunately right now you also have to erase their types because of implementation issues. Ideally you would just have to box them, for the same reason you can't have a recursive struct without indirection.

nikomatsakis (Jul 09 2019 at 17:27, on Zulip):

Yes

nikomatsakis (Jul 09 2019 at 17:27, on Zulip):

So I didn't realize it

nikomatsakis (Jul 09 2019 at 17:27, on Zulip):

But it makes sense

nikomatsakis (Jul 09 2019 at 17:28, on Zulip):

In any case showing the correct "recipe" makes sense

boats (Jul 09 2019 at 17:28, on Zulip):

Obviously TCO something something ideally there'd be some compiler transform to avoid it someday in the future in some cases, etc

nikomatsakis (Jul 09 2019 at 17:28, on Zulip):

I was thinking about bigger refactorings we could do to make it so that just boxing suffices

nikomatsakis (Jul 09 2019 at 17:28, on Zulip):

but that's clearly out of scope

nikomatsakis (Jul 09 2019 at 17:29, on Zulip):

Do we generally agree then that "solving"

Mutually recursive async fns are hard to make Send #62284

is more of a "nice to have"?

nikomatsakis (Jul 09 2019 at 17:29, on Zulip):

(If we document)

Giles Cope (Jul 09 2019 at 17:30, on Zulip):

for async recursion does the compiler give a helpful error if it's not boxed?

nikomatsakis (Jul 09 2019 at 17:30, on Zulip):

not really

nikomatsakis (Jul 09 2019 at 17:30, on Zulip):

that could be another thing to shoot for

boats (Jul 09 2019 at 17:31, on Zulip):

I'm not sure about that particular example, but it would be nice if there were some small changes (even just diagnostics like Giles suggests) we could make in scope to improve the experience with recursive functions

nikomatsakis (Jul 09 2019 at 17:31, on Zulip):

some scenarios give you something like this (playground)

error[E0720]: opaque type expands to a recursive type
 --> src/main.rs:6:24
  |
6 | async fn foo(n: usize) {
  |                        ^ expands to self-referential type
  |
  = note: expanded type is `std::future::GenFuture<[static generator@src/main.rs:6:24: 10:2 n:usize {usize, bool, std::pin::Pin<std::boxed::Box<impl std::future::Future>>, ()}]>`
nikomatsakis (Jul 09 2019 at 17:31, on Zulip):

clearly this could be more obvious :)

nikomatsakis (Jul 09 2019 at 17:32, on Zulip):

but the good news is that it suggests a clear-ish place to "hook"

boats (Jul 09 2019 at 17:32, on Zulip):

oof the use of self-referential there is not helpful!

nikomatsakis (Jul 09 2019 at 17:32, on Zulip):

i.e., an opaque type that arose from async fn

nikomatsakis (Jul 09 2019 at 17:32, on Zulip):

oof the use of self-referential there is not helpful!

yeah, true, it's misleading, makes one think of Pin

boats (Jul 09 2019 at 17:32, on Zulip):

exactly

boats (Jul 09 2019 at 17:32, on Zulip):

if you search it you'll get really useless info that will confuse you

nikomatsakis (Jul 09 2019 at 17:32, on Zulip):

(I withdraw the word "realistic" I used -- I meant more like "naive attempts at recursion")

nikomatsakis (Jul 09 2019 at 17:33, on Zulip):

should we file an issue on the diagnostic then?

nikomatsakis (Jul 09 2019 at 17:33, on Zulip):

sounds reasonable to me, @Giles Cope are you interested in maybe tackling it?

boats (Jul 09 2019 at 17:33, on Zulip):

Yea, adding a special note in that case seems really doable

Giles Cope (Jul 09 2019 at 17:33, on Zulip):

yeah, I like great error messages, I'll have a crack

Giles Cope (Jul 09 2019 at 17:34, on Zulip):

If you put in the issue what you'd like it to say that would be even better.

nikomatsakis (Jul 09 2019 at 17:34, on Zulip):

filing an issue now

boats (Jul 09 2019 at 17:35, on Zulip):

I'm really confused by the send issue because its got async fns returning futures..

nikomatsakis (Jul 09 2019 at 17:35, on Zulip):

filed https://github.com/rust-lang/rust/issues/62539

nikomatsakis (Jul 09 2019 at 17:36, on Zulip):

@Giles Cope maybe self-assign in that issue

nikomatsakis (Jul 09 2019 at 17:36, on Zulip):

I'm really confused by the send issue because its got async fns returning futures..

yeah I discussed that some with @Taylor Cramer, I think it's kind of a "pseduo-stream" thing going on. I'm not clear on whether we can improve diagnostics in that case or not.

boats (Jul 09 2019 at 17:37, on Zulip):

Okay, I see. I don't think this should block stabilization because its not "normal recursion"

centril (Jul 09 2019 at 17:37, on Zulip):

anyway doesn't seem like the most pressing concern ever :slight_smile:

Not sure why you labeled it as blocking

centril (Jul 09 2019 at 17:37, on Zulip):

I intended the issue as "cleanup"

centril (Jul 09 2019 at 17:37, on Zulip):

but the WASM test failure doesn't look good on the other hand

boats (Jul 09 2019 at 17:37, on Zulip):

Like if you couldnt write an adapter which boxes your straightforward recursive call, that would seem like a blocker to me

centril (Jul 09 2019 at 17:37, on Zulip):

Possibly suggesting something unsound going on?

centril (Jul 09 2019 at 17:38, on Zulip):

(context being https://github.com/rust-lang/rust/pull/62270)

nikomatsakis (Jul 09 2019 at 17:39, on Zulip):

Not sure why you labeled it as blocking

I guess I figured it'd get closed quick :)

centril (Jul 09 2019 at 17:39, on Zulip):

@nikomatsakis that's probably true ;)

centril (Jul 09 2019 at 17:41, on Zulip):

One unclear issue to triage: https://github.com/rust-lang/rust/issues/62506

centril (Jul 09 2019 at 17:42, on Zulip):

Seems blocking since it's an ICE in the surface we want to stabilize

nikomatsakis (Jul 09 2019 at 17:42, on Zulip):

Fun

nikomatsakis (Jul 09 2019 at 17:42, on Zulip):

Yeah, probably. It seems to be an error related to the stuff that is captured across an await point being incorrectly predicated

nikomatsakis (Jul 09 2019 at 17:43, on Zulip):

Perhaps arising from @Aaron Hill's PR that tweaked the visitor order

centril (Jul 09 2019 at 17:43, on Zulip):

labeling as such and ccing tmandry / matthewjasper

nikomatsakis (Jul 09 2019 at 17:44, on Zulip):

a first step would be to minimize

nikomatsakis (Jul 09 2019 at 17:44, on Zulip):

it's currently embedded in some bigger project

Giles Cope (Jul 09 2019 at 17:45, on Zulip):

I can minimise it if you want.

nikomatsakis (Jul 09 2019 at 17:45, on Zulip):

That'd be :100:

nikomatsakis (Jul 09 2019 at 17:45, on Zulip):

OK, well, we're out of time, but @Giles Cope if you want to take a crack at minimizing it, I'm sure it'd be quite helpful

Giles Cope (Jul 09 2019 at 17:46, on Zulip):

will do

nikomatsakis (Jul 09 2019 at 17:46, on Zulip):

Seems like we got through everything but the async unsafe fn question, but I think that's not really something we should discuss in this meeting anyhow

nikomatsakis (Jul 09 2019 at 17:48, on Zulip):

thanks all! :tada:

centril (Jul 09 2019 at 17:49, on Zulip):

\o

tmandry (Jul 09 2019 at 18:48, on Zulip):

(tmandry, did you see that error?)

yes I did and was able to reproduce locally. I think some change exposed an existing place where we assume all variant layouts are enums

tmandry (Jul 09 2019 at 21:23, on Zulip):

^ actually nevermind, that was something else

tmandry (Jul 09 2019 at 21:23, on Zulip):

(deleted)

Last update: Nov 18 2019 at 02:15UTC