-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
ICE bootstrapping rustc with NLL enabled #48071
Comments
I'd like to work on this. |
@Aaron1011 any progress? want me to take a look at all? |
@nikomatsakis: I haven't yet been able to reproduce this, due to #48129 stopping compilation. I'll try to work around that issue locally, and see if I can reproduce + investigate the original issue. |
@nikomatsakis: I ran across another issue while trying to reach the ICE: #48224 |
@nikomatsakis: Until the intermediate issues are resolved, I don't think I'll be able to reproduce this. |
@Aaron1011 this branch #48372 clears the way |
Hmm, but on that branch I am now encountering the |
Actually, the issue-48071 branch on my repo reproduces the problem. You have to build like so:
|
Error that I get is (lightly edited):
Removing explicit paths:
The problem seems to be the return type. |
Minimized: #![allow(warnings)]
#![feature(dyn_trait)]
#![feature(nll)]
trait Foo {
fn foo(&self) { }
}
impl Foo for () {
}
type MakeFooFn = for<'a> fn(&'a u8) -> Box<dyn Foo + 'a>;
fn make_foo(x: &u8) -> Box<dyn Foo + 'static> {
Box::new(())
}
fn main() {
let x: MakeFooFn = make_foo as MakeFooFn;
} |
I think the problem is that there is a missing coercion of sorts, or else that this code in the NLL type checker is too strict: rust/src/librustc_mir/borrow_check/nll/type_check/mod.rs Lines 1308 to 1330 in 27a046e
In particular, it constructs the "reified" form of the fn pointer in |
(Hmm, I have a vague memory of solving a similar problem somewhere else, where we were rolling multiple coercions into one. It's sort of debatable what's right here, I suppose -- probably we should change the NLL type checker to use |
OK well that proposed change didn't actually fix anything =) |
Tagging as NLL-deferred -- this is blocked on @sgrif's work at the moment and there exists a workaround for within rustc. |
Hmm. I'm going to mark this as high priority because it blocks bootstrap. I think it's a bit tricky to fix. While bike riding recently though I had some ideas here -- I realized that we could probably write a custom bit of subtyping code used only (initially) by the MIR type checker. The hope would be that this is faster than canonicalizing etc. This code could use a universe-based check. This would sidestep the limitations of our existing subtyping algorithm which are biting us here. It would also help eliminate a blocker for chalk integration later. I may take a stab at this. |
OK, my branch is now working and passing tests. I want to clean it up some and perhaps try to improve its performance though. |
visited for triage. this should be fixed via PR #52488 (which is WIP but hopefully will be ready soon). |
… r=<try> introduce universes to NLL type check This branch aims to fix #48071 and also advance chalk integration a bit at the same time. It re-implements the subtyping/type-equating check so that NLL doesn't "piggy back" on the subtyping code of the old type checker. This new code uses the "universe-based" approach to handling higher-ranked lifetimes, which sidesteps some of the limitations of the current "leak-based" scheme. This avoids the ICE in #48071. At the same time, I aim for this to potentially be a kind of optimization. This NLL code is (currently) not cached, but it also generates constraints without doing as much instantiation, substitution, and folding. Right now, though, it still piggy backs on the `relate_tys` trait, which is a bit unfortunate -- it means we are doing more hashing and things than we have to. I want to measure the see the perf. Refactoring that trait is something I'd prefer to leave for follow-up work. r? @pnkfelix -- but I want to measure perf etc first
… r=<try> introduce universes to NLL type check This branch aims to fix #48071 and also advance chalk integration a bit at the same time. It re-implements the subtyping/type-equating check so that NLL doesn't "piggy back" on the subtyping code of the old type checker. This new code uses the "universe-based" approach to handling higher-ranked lifetimes, which sidesteps some of the limitations of the current "leak-based" scheme. This avoids the ICE in #48071. At the same time, I aim for this to potentially be a kind of optimization. This NLL code is (currently) not cached, but it also generates constraints without doing as much instantiation, substitution, and folding. Right now, though, it still piggy backs on the `relate_tys` trait, which is a bit unfortunate -- it means we are doing more hashing and things than we have to. I want to measure the see the perf. Refactoring that trait is something I'd prefer to leave for follow-up work. r? @pnkfelix -- but I want to measure perf etc first
… r=<try> introduce universes to NLL type check This branch aims to fix #48071 and also advance chalk integration a bit at the same time. It re-implements the subtyping/type-equating check so that NLL doesn't "piggy back" on the subtyping code of the old type checker. This new code uses the "universe-based" approach to handling higher-ranked lifetimes, which sidesteps some of the limitations of the current "leak-based" scheme. This avoids the ICE in #48071. At the same time, I aim for this to potentially be a kind of optimization. This NLL code is (currently) not cached, but it also generates constraints without doing as much instantiation, substitution, and folding. Right now, though, it still piggy backs on the `relate_tys` trait, which is a bit unfortunate -- it means we are doing more hashing and things than we have to. I want to measure the see the perf. Refactoring that trait is something I'd prefer to leave for follow-up work. r? @pnkfelix -- but I want to measure perf etc first
… r=pnkfelix introduce universes to NLL type check This branch aims to fix #48071 and also advance chalk integration a bit at the same time. It re-implements the subtyping/type-equating check so that NLL doesn't "piggy back" on the subtyping code of the old type checker. This new code uses the "universe-based" approach to handling higher-ranked lifetimes, which sidesteps some of the limitations of the current "leak-based" scheme. This avoids the ICE in #48071. At the same time, I aim for this to potentially be a kind of optimization. This NLL code is (currently) not cached, but it also generates constraints without doing as much instantiation, substitution, and folding. Right now, though, it still piggy backs on the `relate_tys` trait, which is a bit unfortunate -- it means we are doing more hashing and things than we have to. I want to measure the see the perf. Refactoring that trait is something I'd prefer to leave for follow-up work. r? @pnkfelix -- but I want to measure perf etc first
When I try to bootstrap rustc with NLL enabled, I get an odd ICE compiling
libsyntax_ext
:The text was updated successfully, but these errors were encountered: