Stream: t-compiler/wg-nll

Topic: Empty regions and LBL


Matthew Jasper (Sep 21 2019 at 15:45, on Zulip):

Have we decided that this should compile? https://github.com/rust-lang/rust/blob/0a985f2c86add139d880882c968e68747b366be6/src/test/ui/hrtb/due-to-where-clause.rs
cc @nikomatsakis

Matthew Jasper (Sep 21 2019 at 15:48, on Zulip):

NLL is allowing for<'b> FooS<'_>: Foo<'b> on line 6 because '_ is completely unconstrained, so it can be 'empty.

Matthew Jasper (Sep 21 2019 at 15:49, on Zulip):

The lexical region solver doesn't allow this kind of reasoning (and NLL usually doesn't because most regions end up with at least a liveness constraint).

centril (Sep 21 2019 at 16:19, on Zulip):

@Matthew Jasper seems like sound reasoning on NLL's part; why would we not allow this?

Matthew Jasper (Sep 21 2019 at 16:26, on Zulip):

Because such reasoning applies only in very specific situations. The fairly similar ({test::<FooS<'_>>}(&mut 42)); fails to compile with and without NLL

centril (Sep 21 2019 at 16:28, on Zulip):

@Matthew Jasper why does the block version not work?

Matthew Jasper (Sep 21 2019 at 16:29, on Zulip):

'_ is now live between the block finishing evaluation and the function being called, so is not 'empty.

centril (Sep 21 2019 at 16:37, on Zulip):

@Matthew Jasper I guess I don't understand how that came to be.

The reasoning "'_ is completely unconstrained, so it can be 'empty" seems sane tho.

nikomatsakis (Sep 23 2019 at 20:04, on Zulip):

I'm not very happy with 'empty, @Matthew Jasper

nikomatsakis (Sep 23 2019 at 20:05, on Zulip):

that's the main reason I backed out from the universe work

nikomatsakis (Sep 23 2019 at 20:06, on Zulip):

partly because it doesn't have an obvious analogous in polonius

nikomatsakis (Sep 23 2019 at 20:07, on Zulip):

though you can make interpretations that make sense

nikomatsakis (Sep 23 2019 at 20:08, on Zulip):

Interesting question to ask how we would deny this in NLL mode -- I guess by requiring that all the types outlive the call, which .. I'm a bit surprised we don't require

nikomatsakis (Sep 23 2019 at 20:08, on Zulip):

Is that an oversight?

nikomatsakis (Sep 23 2019 at 20:13, on Zulip):

Hmm, is this comment just wrong?

nikomatsakis (Sep 23 2019 at 20:15, on Zulip):

seems like it might be

nikomatsakis (Sep 23 2019 at 20:15, on Zulip):

in particular, we probably don't require that the types of constants are live at the point of us?

nikomatsakis (Oct 01 2019 at 20:53, on Zulip):

I guess that this commit from #64749 address this, @Matthew Jasper?

lqd (Oct 01 2019 at 21:00, on Zulip):

that's also how I understood it

Matthew Jasper (Oct 01 2019 at 21:01, on Zulip):

Yes

Matthew Jasper (Oct 01 2019 at 21:04, on Zulip):

@lqd what happened to the work you were doing to improve these errors?

Matthew Jasper (Oct 01 2019 at 21:05, on Zulip):

I was working on a PR that made them more common without flags.

lqd (Oct 01 2019 at 21:05, on Zulip):

ah damn, the issues were closed with the leak-check revival and I forgot about it, I think I've seen some of Aaron Hill's PRs touch on those areas

lqd (Oct 01 2019 at 21:07, on Zulip):

I do remember having issues emitting "expected/found" trait errors at this point of the pipeline, and think have seen others with this same problem

lqd (Oct 01 2019 at 21:09, on Zulip):

I can find that work again, and if that's ok we can talk about those related issues and how to fix then

lqd (Oct 01 2019 at 21:16, on Zulip):

(some of the work was merged though, but there were a bunch of other paths triggering this specific unclear error)

lqd (Oct 01 2019 at 22:06, on Zulip):

I've seen some of Aaron Hill's PRs touch on those areas

for example #63678 just in case you hadn't seen it

Last update: Nov 21 2019 at 14:05UTC