Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uplibrustc_mir/borrow_check/nll/universal_regions.rs:824: cannot convert ReFree ... #51351
Comments
matthewjasper
added
A-NLL
WG-compiler-nll
labels
Jun 4, 2018
This comment has been minimized.
This comment has been minimized.
|
Self contained example #![feature(nll)]
fn produce<'a>()
{
move || {
let x: &'a () = &();
};
}
fn main() {} |
This comment has been minimized.
This comment has been minimized.
DutchGhost
commented
Jun 4, 2018
•
|
no need for a move, or closure, just the let expression already ICE's #![feature(nll)]
fn crash<'a>() {
let x: &'a () = &();
}
fn main() {} |
kennytm
referenced this issue
Jun 21, 2018
Closed
NLL compiler panic - "cannot convert <type> to a region vid" #51676
kennytm
added
I-ICE
C-bug
labels
Jun 21, 2018
This comment has been minimized.
This comment has been minimized.
|
Alternative repro taken from #51676: #![feature(nll)]
fn crash<'a>() {
let x: &'a str = "?";
}
fn main() {} |
nikomatsakis
added
the
NLL-complete
label
Jun 29, 2018
nikomatsakis
added this to the Rust 2018 Preview 2 milestone
Jun 29, 2018
This comment has been minimized.
This comment has been minimized.
|
High priority, blocks bootstrap too |
This comment has been minimized.
This comment has been minimized.
|
OK, so, I remember this problem. It's a pain in the neck, but we gotta fix it. The problem is that we categorize rust/src/librustc/middle/resolve_lifetime.rs Lines 2481 to 2483 in 860d169 However, the actual definition used in the code is a bit broader: rust/src/librustc/middle/resolve_lifetime.rs Lines 2548 to 2558 in 860d169 The reason that being late-bound makes a difference is because of how the universal regions code tries to instantiate and find all the lifetime parameters. It begins by looking the "generics" for the function: those include the early-bound regions. Then it instantiates all the remaining free regions that appear in the argument types -- that is supposed to capture the late-bound regions. But for a region like The rust/src/librustc/middle/resolve_lifetime.rs Lines 195 to 215 in 860d169 In particular, the rust/src/librustc/middle/resolve_lifetime.rs Lines 207 to 210 in 860d169 This can be accessed via the (Annoyingly, that field doesn't contain all late-bound regions -- only the named ones. Anonymous ones are found later, during type conversion.) What we would have to do is extend the rust/src/librustc_mir/borrow_check/nll/universal_regions.rs Lines 458 to 463 in 860d169 After this step, we need to load the full set of named, late-bound regions and then check for each of them whether they were found amongst the types -- or maybe we should just add a new field to the |
This comment has been minimized.
This comment has been minimized.
|
OK, that was a first round of mentoring instructions, but there are maybe 50% notes to myself and not necessarily expected to be understood. Still, nominating for this week, and I can try to leave better notes. |
nikomatsakis
added
the
I-nominated
label
Jul 3, 2018
kennytm
added
P-high
and removed
P-high
labels
Jul 3, 2018
nikomatsakis
added
the
E-mentor
label
Jul 3, 2018
This comment has been minimized.
This comment has been minimized.
|
look at it |
This comment has been minimized.
This comment has been minimized.
|
So @mikhail-m1 I was looking over this issue again and it occurs to me that I think that the bug in the original issue may not be solved by my proposed fix (though some of the minimizations will be, I think). I'm going to look a bit into that and maybe split off a second issue with a different minimization. |
nikomatsakis
referenced this issue
Jul 6, 2018
Closed
universal-regions table not populated with late bound lifetimes from parent functions #52113
nikomatsakis
assigned
mikhail-m1
Jul 17, 2018
mikhail-m1
added a commit
to mikhail-m1/rust
that referenced
this issue
Jul 22, 2018
mikhail-m1
added a commit
to mikhail-m1/rust
that referenced
this issue
Jul 22, 2018
mikhail-m1
added a commit
to mikhail-m1/rust
that referenced
this issue
Jul 23, 2018
mikhail-m1
added a commit
to mikhail-m1/rust
that referenced
this issue
Jul 25, 2018
mikhail-m1
pushed a commit
to mikhail-m1/rust
that referenced
this issue
Jul 27, 2018
mikhail-m1
added a commit
to mikhail-m1/rust
that referenced
this issue
Jul 27, 2018
mikhail-m1
added a commit
to mikhail-m1/rust
that referenced
this issue
Jul 29, 2018
bors
added a commit
that referenced
this issue
Jul 29, 2018
This comment has been minimized.
This comment has been minimized.
|
Should be fixed now |
Palmik commentedJun 4, 2018
NLL
I tried this code:
I expected to see this happen: To not cause panic in the compiler.
Instead, this happened: Panic.
These are the enabled features:
Meta
rustc --version --verbose:Backtrace: