Stream: wg-async-foundations

Topic: lifetime elision #63388


nikomatsakis (Aug 12 2019 at 19:43, on Zulip):

ok, wait, what am I saying, this code really wants to be part of resolve lifetimes

nikomatsakis (Aug 12 2019 at 19:47, on Zulip):

@Taylor Cramer so -- why do we have to do this logic in HIR lowering? Seems like instead we could move the logic to resolve-lifetimes to avoid duplication. For example:

async fn foo(...) -> &[&u32] { .. }

could get converted to

type Foo<'E> = &'E [ &'E u32 ];
fn foo(...) -> Foo<'_> { .. }

or even

type Foo<'E1, 'E2> = &'E1 [ &'E2 u32 ];
fn foo(...) -> Foo<'_, '_> { .. }
nikomatsakis (Aug 12 2019 at 19:48, on Zulip):

i.e., we create a fresh parameter for each elided lifetime, and then the "value" we supply for that parameter is '_

nikomatsakis (Aug 12 2019 at 19:48, on Zulip):

or we create at most one parameter, same thing

nikomatsakis (Aug 12 2019 at 19:48, on Zulip):

as a benefit, I think all the complex elision cases would "just work"

nikomatsakis (Aug 12 2019 at 19:55, on Zulip):

let me see if I can implement that

centril (Aug 12 2019 at 20:24, on Zulip):

I rolled up the 2 current approved async PRs with p=50 so they should test in 3 hours or so

nikomatsakis (Aug 12 2019 at 20:25, on Zulip):

welp I think I implemented the scheme I described ab ove

nikomatsakis (Aug 12 2019 at 20:25, on Zulip):

of course, it hasn't even finished building yet, much less having been tested

nikomatsakis (Aug 12 2019 at 20:42, on Zulip):

seems to work

nikomatsakis (Aug 12 2019 at 20:43, on Zulip):

also, code is way simpler

nikomatsakis (Aug 12 2019 at 20:53, on Zulip):

ok ok it's not quite right, but getting close

centril (Aug 12 2019 at 21:03, on Zulip):

@nikomatsakis nice; can you also include some more tests, e.g. the ones in https://github.com/rust-lang/rust/issues/63388#issuecomment-520557204 ?

nikomatsakis (Aug 12 2019 at 21:03, on Zulip):

@centril yep, already did that

centril (Aug 12 2019 at 21:03, on Zulip):

great :slight_smile:

nikomatsakis (Aug 12 2019 at 21:03, on Zulip):

I'm just double checking that the behavior in all of your tests matches

centril (Aug 12 2019 at 21:04, on Zulip):

there's also the README.md that might need some updating ^^

nikomatsakis (Aug 12 2019 at 21:04, on Zulip):

yes, I did that too

nikomatsakis (Aug 12 2019 at 21:04, on Zulip):

which is why I'm double checking

centril (Aug 12 2019 at 21:04, on Zulip):

hehe, awesome

nikomatsakis (Aug 12 2019 at 21:04, on Zulip):

to be sure I'm not lying :)

nikomatsakis (Aug 12 2019 at 21:08, on Zulip):

@centril just to be clear, the original test from #63388 is included in your original test suite, right?

nikomatsakis (Aug 12 2019 at 21:08, on Zulip):

i.e., I don't have to add that one

centril (Aug 12 2019 at 21:08, on Zulip):

lemme double check

nikomatsakis (Aug 12 2019 at 21:10, on Zulip):

I just checked

nikomatsakis (Aug 12 2019 at 21:10, on Zulip):

it's in ref-self.rs

centril (Aug 12 2019 at 21:11, on Zulip):

ah but that one is slightly different in that it isn't a // check-pass test

centril (Aug 12 2019 at 21:12, on Zulip):

(notice that the test in the issue returns self, which makes it pass)

centril (Aug 12 2019 at 21:12, on Zulip):

(in ref-self.rs it returns f, which makes it fail)

centril (Aug 12 2019 at 21:14, on Zulip):

@nikomatsakis ^-- would be good to include the // check-pass version to have more confidence

nikomatsakis (Aug 12 2019 at 21:14, on Zulip):

OK

centril (Aug 12 2019 at 21:18, on Zulip):

thanks

nikomatsakis (Aug 12 2019 at 21:19, on Zulip):

@centril you should find it in https://github.com/rust-lang/rust/pull/63499 -- issue-63388-4.rs I think

centril (Aug 12 2019 at 21:19, on Zulip):

-4 :P wow =)

centril (Aug 12 2019 at 21:26, on Zulip):

@nikomatsakis the docs in README.md are slightly off; some Xs for "Pass?" turned into s when the non-async fn test is also X

centril (Aug 12 2019 at 21:27, on Zulip):

but that's mostly a nit

nikomatsakis (Aug 12 2019 at 22:01, on Zulip):

@centril oh maybe I misunderstood the structure of the docs; I thought "check" would mean "match non async" :)

centril (Aug 12 2019 at 22:05, on Zulip):

That was the point of the second "conforms" column =P

centril (Aug 13 2019 at 13:17, on Zulip):

@nikomatsakis I'm looking forward to the day where no PR fails due to a lack of --bless --compare-mode=nll

centril (Aug 13 2019 at 13:17, on Zulip):

of course, they'll fail due to a lack of --compare-mode=polonius instead ;)

nikomatsakis (Aug 13 2019 at 13:18, on Zulip):

I had a feeling I was forgetting something related to nll and bless

nikomatsakis (Aug 13 2019 at 13:18, on Zulip):

It is also annoying that x.py --test never terminates on my machine

nikomatsakis (Aug 13 2019 at 13:18, on Zulip):

it errors out somewhere in run-pass fulldeps

centril (Aug 13 2019 at 13:18, on Zulip):

aw :frown: known issue / file one?

nikomatsakis (Aug 13 2019 at 13:18, on Zulip):
[run-make] run-make-fulldeps/linker-output-non-utf8
nikomatsakis (Aug 13 2019 at 13:18, on Zulip):

I'm not sure, I was going to maybe search for it today

nikomatsakis (Aug 13 2019 at 13:30, on Zulip):

(filed https://github.com/rust-lang/rust/issues/63520)

nikomatsakis (Aug 13 2019 at 14:10, on Zulip):

@Taylor Cramer if you can re-review last commit of https://github.com/rust-lang/rust/pull/63501, would be great

Last update: Nov 18 2019 at 00:35UTC