-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: internal compiler error: src/librustc/ty/relate.rs:753: impossible case reached: can't relate: (T,) with Lifetime('_#1r) #57156
Comments
Ping @rust-lang/compiler |
Discussed at the T-compiler meeting. P-high to at least bisect and figure out where the regression happened. |
Bisected to nightly-2018-11-04, now going to attempt to bisect to a PR |
Specifically 3fc70e8 |
It's this call to Here is a backtrace with debug symbols, with rustc at 9723a49
|
@mikeyhew hmm, that does seem awfully early in the system to invoke the layout code, now that I think about it -- given that this is just an assertion, maybe we can move that logic later in the compiler? Or maybe i'm on the wrong trail here, and the problem is something else. |
@nikomatsakis By "moving that logic to later in the compiler", do you mean doing the same assertion but delaying it until later? I don't think that would get rid of the error, but I don't really know, and maybe it's worth a shot. If you meant "later" in a more general sense, there are existing checks during codegen, but @eddyb wanted to also have this check in object-safety as an additional safeguard. |
that is what I meant, but I was second guessing that after I wrote it. At minimum, it'd be worth digging in a bit more deeply to understand the ICE. |
Relating a type with a lifetime looks like some sort of very silly error that should be fixed. |
Here's what I've unwrapped so far: While determining if The error occurs during |
btw, more reduced and less erroneous example: trait CP<'a, T>: 'a + Fn(T) -> bool {
fn cb(&self) -> Box<dyn CP<'a, T, Output=bool>>;
}
impl<'a, T, F> CP<'a, T> for F
where F: 'a + Clone + Fn(T) -> bool
{
fn cb(&self) -> Box<dyn CP<'a, T, Output=bool>> {
Box::new(self.clone())
}
}
impl<'a, T> Clone for Box<dyn CP<'a, T, Output=bool>>
where T: 'a
{
fn clone(&self) -> Self {
self.cb()
}
}
fn main() {
let x: Box<dyn CP<i32, Output=bool>> = Box::new(move |x| x == 0);
let y = x.clone();
println!("{}", x(0));
println!("{}", y(1));
} |
This is the obligation:
And this is the predicate being considered as a candidate to fulfill the obligation:
The |
How did the extra lifetime get there? The substs for |
Even more reduced: trait Foo<Args> {
type Output;
}
trait Bar<'a, T>: Foo<T, Output=bool> {
fn cb(&self) -> Box<dyn Bar<'a, T, Output=bool>>;
} remove the The |
OK, I'm going to pack it in for today. Here's what we know: There's an extra lifetime parameter being added to the substs for the My best guess at this point is maybe there's a bug in the canonicalizer that introduces the new region. That's where I would look next. EDIT: but I'm definitely in way over my head here |
You can see that the substs is |
@arielb1 but where does the lifetime come from? It's an anonymous late-bound region, which I thought could be be the lifetime of the reference in FYI I'm pretty sure I won't be able to find the bug — I don't have the time, and I'm not sure what I'm looking for anyway. |
ok I'll have it |
use the correct supertrait substitution in `object_ty_for_trait` beta-nominating because regression. Fixes #57156.
use the correct supertrait substitution in `object_ty_for_trait` beta-nominating because regression. Fixes #57156.
After fixing this, |
I tried the following code in editions 2015 and 2018:
I expected it to print:
And this does happen on stable, but not on beta or nightly, where I get this (this particular error is from nightly):
Meta:
rustc --version --verbose
:Backtrace:
The text was updated successfully, but these errors were encountered: