Stream: t-compiler/wg-nll

Topic: issue-52078-implied-bounds


nikomatsakis (Jul 18 2018 at 14:01, on Zulip):

@lqd did you want to talk about this issue at some point?

lqd (Jul 18 2018 at 14:03, on Zulip):

sure :)

nikomatsakis (Jul 18 2018 at 14:08, on Zulip):

ok so the thing I would want to do to debug this....

nikomatsakis (Jul 18 2018 at 14:10, on Zulip):

to start, I would enable RUST_LOG=rustc_mir::borrow_check and look for the output from the add_implied_bounds function

lqd (Jul 18 2018 at 14:17, on Zulip):

ok I'll do that as soon as my build completes, somehow debug assertions got turned off in this build, sad trombone

lqd (Jul 18 2018 at 14:42, on Zulip):

it's mostly

DEBUG 2018-07-18T14:39:00Z: rustc_mir::borrow_check::nll::universal_regions: build: input_or_output=&mut <Drain<'_, T> as Join>::Value
DEBUG 2018-07-18T14:39:00Z: rustc_mir::borrow_check::nll::universal_regions: add_implied_bounds(ty=&mut <Drain<'_, T> as Join>::Value)
DEBUG 2018-07-18T14:39:00Z: rustc_mir::borrow_check::nll::universal_regions: add_outlives_bounds(bound=RegionSubRegion('_#2r, '_#4r))
DEBUG 2018-07-18T14:39:00Z: rustc_mir::borrow_check::nll::universal_regions: relate_universal_regions: fr_a='_#4r outlives fr_b='_#2r
DEBUG 2018-07-18T14:39:00Z: rustc_mir::borrow_check::nll::universal_regions: add_outlives_bounds(bound=RegionSubParam('_#2r, T/#1))
DEBUG 2018-07-18T14:39:00Z: rustc_mir::borrow_check::nll::universal_regions: add_outlives_bounds(bound=RegionSubParam('_#1r, T/#1))
DEBUG 2018-07-18T14:39:00Z: rustc_mir::borrow_check::nll::universal_regions: build: input_or_output=()
DEBUG 2018-07-18T14:39:00Z: rustc_mir::borrow_check::nll::universal_regions: add_implied_bounds(ty=())
nikomatsakis (Jul 18 2018 at 14:43, on Zulip):

hmm

nikomatsakis (Jul 18 2018 at 14:43, on Zulip):

try with -Zverbose

lqd (Jul 18 2018 at 14:43, on Zulip):

and then the relate_universal_regions (which reminds me of something I was in Polonius, that we generate regions outliving themselves, I don't know if it's that big of a problem)

nikomatsakis (Jul 18 2018 at 14:43, on Zulip):

still, add_outlives_bounds(bound=RegionSubRegion('_#2r, '_#4r)) looks relevant

nikomatsakis (Jul 18 2018 at 14:44, on Zulip):

can you gist the full output somewhere?

lqd (Jul 18 2018 at 14:44, on Zulip):

https://gist.github.com/lqd/dfda486e0d99b53d828bf3c1673d73b5

lqd (Jul 18 2018 at 14:44, on Zulip):

doing the verbose one now

lqd (Jul 18 2018 at 14:47, on Zulip):

the verbose one looks surprisingly similar https://gist.github.com/lqd/18f805512135d5873b5c97520202866c

nikomatsakis (Jul 18 2018 at 14:47, on Zulip):

the only difference is that regions don't get printed as '_

lqd (Jul 18 2018 at 14:48, on Zulip):

oh good to know thank you

nikomatsakis (Jul 18 2018 at 14:48, on Zulip):

so what I am looking for here

nikomatsakis (Jul 18 2018 at 14:48, on Zulip):

and, actually, i'm not sure I see

nikomatsakis (Jul 18 2018 at 14:48, on Zulip):

let me back up :)

nikomatsakis (Jul 18 2018 at 14:48, on Zulip):

the way that this code works

nikomatsakis (Jul 18 2018 at 14:48, on Zulip):

is that the universal_regions computes which of the free regions on the function may be related to one another

nikomatsakis (Jul 18 2018 at 14:49, on Zulip):

(as an aside, I want to rename universal_regions back to free_regions at some point)

nikomatsakis (Jul 18 2018 at 14:49, on Zulip):

so e.g. we would wnat to compute here that -- because of an implied bound -- we know that 'b: 'a or whatever

nikomatsakis (Jul 18 2018 at 14:49, on Zulip):

in this case I think 'a is assigned '_#1r`

nikomatsakis (Jul 18 2018 at 14:49, on Zulip):

as you can see from this line:

lqd (Jul 18 2018 at 14:49, on Zulip):

yeah

nikomatsakis (Jul 18 2018 at 14:49, on Zulip):
DEBUG 2018-07-18T14:45:19Z: rustc_mir::borrow_check::nll::universal_regions: build: indices=UniversalRegionIndices { indices: {ReEarlyBound(0, 'a): '_#1r, ReStatic: '_#0r} }DEBUG 2018-07-18T14:45:19Z: rustc_mir::borrow_check::nll::universal_regions: build: indices=UniversalRegionIndices { indices: {ReEarlyBound(0, 'a): '_#1r, ReStatic: '_#0r} }
nikomatsakis (Jul 18 2018 at 14:50, on Zulip):

and 'b is '_#2r`

nikomatsakis (Jul 18 2018 at 14:50, on Zulip):

as you can see ultimately from this type:

DEBUG 2018-07-18T14:45:19Z: rustc_mir::borrow_check::nll::universal_regions: build: input_or_output=&'_#2r mut <Drain<'_#1r, T> as Join>::Value
nikomatsakis (Jul 18 2018 at 14:50, on Zulip):

<&'_#2r mut <Drain<'_#1r, T> as Join>::Value, that is

nikomatsakis (Jul 18 2018 at 14:50, on Zulip):

so we'd expect to see that '_#1r: '_#2r

nikomatsakis (Jul 18 2018 at 14:51, on Zulip):

but i do .. not see that

nikomatsakis (Jul 18 2018 at 14:51, on Zulip):

so that is sort of curious

lqd (Jul 18 2018 at 14:51, on Zulip):

it would look like an add_outlive_bounds of '_#2r and '_#1r ?

lqd (Jul 18 2018 at 14:51, on Zulip):

or a relate_universal_regions log ?

nikomatsakis (Jul 18 2018 at 14:51, on Zulip):

yeah, or later on, when we dump the full relations

nikomatsakis (Jul 18 2018 at 14:52, on Zulip):

e.g. here: https://gist.github.com/lqd/18f805512135d5873b5c97520202866c#file-z-verbose-L19-L34

nikomatsakis (Jul 18 2018 at 14:52, on Zulip):

implied outlives bounds are computed by this function in infer

nikomatsakis (Jul 18 2018 at 14:52, on Zulip):

so maybe we should re-run with RUST_LOG=rustc::infer::outlives::bounds as well

nikomatsakis (Jul 18 2018 at 14:52, on Zulip):

(also keep the rustc_mir)

nikomatsakis (Jul 18 2018 at 14:53, on Zulip):

hmm that fn doesn't have as many debug! as I would like

nikomatsakis (Jul 18 2018 at 14:53, on Zulip):

we might want to log rustc::ty::wf too

nikomatsakis (Jul 18 2018 at 14:54, on Zulip):

to get the output from this call

lqd (Jul 18 2018 at 14:54, on Zulip):

I can just use commas to have more than one module with RUST_LOG right ?

nikomatsakis (Jul 18 2018 at 14:55, on Zulip):

yes

lqd (Jul 18 2018 at 14:55, on Zulip):

I should add that to the rustc-guide

lqd (Jul 18 2018 at 14:57, on Zulip):

https://gist.github.com/lqd/a44290e6e898ad8740b41c3515de06b9

lqd (Jul 18 2018 at 15:00, on Zulip):

is it me or the outlives::bounds logs don't tell us much rn ?

nikomatsakis (Jul 18 2018 at 15:00, on Zulip):

yeah there aren't many debug!

nikomatsakis (Jul 18 2018 at 15:00, on Zulip):

next step might be to add some :)

lqd (Jul 18 2018 at 15:00, on Zulip):

I can add them yeah

nikomatsakis (Jul 18 2018 at 15:01, on Zulip):

still, I think I see the problem

nikomatsakis (Jul 18 2018 at 15:01, on Zulip):

interesting problem

nikomatsakis (Jul 18 2018 at 15:01, on Zulip):

I wonder if tmandry's PR will help here actually

nikomatsakis (Jul 18 2018 at 15:01, on Zulip):

so I think what is happening is that:

nikomatsakis (Jul 18 2018 at 15:01, on Zulip):

we normalize &'_#2r mut <Drain<'_#1r, T> as Join>::Value

nikomatsakis (Jul 18 2018 at 15:01, on Zulip):

in so doing, we create a result &'4 Option<T> or something

nikomatsakis (Jul 18 2018 at 15:01, on Zulip):

this '4 is a new variable that we created

nikomatsakis (Jul 18 2018 at 15:02, on Zulip):

it is equated with '1

nikomatsakis (Jul 18 2018 at 15:02, on Zulip):

but the universal regions code doesn't recognize that

nikomatsakis (Jul 18 2018 at 15:02, on Zulip):

tmandry's PR pulled some of this logic into a query

lqd (Jul 18 2018 at 15:02, on Zulip):

oh

nikomatsakis (Jul 18 2018 at 15:02, on Zulip):

which might mean that we get back a more "normalized" result

nikomatsakis (Jul 18 2018 at 15:02, on Zulip):

let me take a look at its current status

nikomatsakis (Jul 18 2018 at 15:02, on Zulip):

cc @Tyler Mandry -- but I think they are on vacation

nikomatsakis (Jul 18 2018 at 15:02, on Zulip):

the PR is https://github.com/rust-lang/rust/pull/51959

nikomatsakis (Jul 18 2018 at 15:03, on Zulip):

yeah, needs rebase

nikomatsakis (Jul 18 2018 at 15:03, on Zulip):

I think I'll try to take it over... I'll ping them on discord though

lqd (Jul 18 2018 at 15:03, on Zulip):

unlucky

nikomatsakis (Jul 18 2018 at 15:06, on Zulip):

indeed I do not get an ICE with their branch

lqd (Jul 18 2018 at 15:06, on Zulip):

it doesn't ICE

lqd (Jul 18 2018 at 15:06, on Zulip):

it's just an error

nikomatsakis (Jul 18 2018 at 15:07, on Zulip):

er, yes, well, it compiles successfully anyway

lqd (Jul 18 2018 at 15:07, on Zulip):

oh ok then :)

nikomatsakis (Jul 18 2018 at 15:07, on Zulip):

we could investigate another bug :)

lqd (Jul 18 2018 at 15:07, on Zulip):

that's awesome to hear

lqd (Jul 18 2018 at 15:07, on Zulip):

as I feel there's been a lot of those similar errors in the crater run

nikomatsakis (Jul 18 2018 at 15:07, on Zulip):

ah, cool

nikomatsakis (Jul 18 2018 at 15:07, on Zulip):

I'm going to try and rebase the PR against master then

lqd (Jul 18 2018 at 15:08, on Zulip):

there was one ICE we talked about yesterday which we could look at

nikomatsakis (Jul 18 2018 at 15:08, on Zulip):

yes which was that...

lqd (Jul 18 2018 at 15:08, on Zulip):

it was #52384

lqd (Jul 18 2018 at 15:09, on Zulip):

(I have to step away for 10-15mins though sorry)

lqd (Jul 18 2018 at 15:09, on Zulip):

brb

nikomatsakis (Jul 18 2018 at 15:12, on Zulip):

no worries. I'll do some rebasing. I actually may have to run an errand too

nikomatsakis (Jul 18 2018 at 15:12, on Zulip):

greek stores have kind of wacky hours that must be respected :)

lqd (Jul 18 2018 at 15:55, on Zulip):

(I'm back btw, and have a couple hours of free time :)

nikomatsakis (Jul 18 2018 at 18:57, on Zulip):

@lqd whoops, sorry

Last update: Nov 21 2019 at 13:05UTC