Skip to content

ICE when building compiler plugin with nll #49250

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
real-felix opened this issue Mar 21, 2018 · 9 comments
Closed

ICE when building compiler plugin with nll #49250

real-felix opened this issue Mar 21, 2018 · 9 comments
Assignees
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-NLL Area: Non-lexical lifetimes (NLL) A-plugins Area: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ NLL-complete Working towards the "valid code works" goal T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@real-felix
Copy link

I tried the example of compiler plugin and added only the nll feature.

The result is an ICE:

error: internal compiler error: broken MIR in NodeId(186) (Terminator { source_info: SourceInfo { span: src/lib.rs:60:5: 60:40, scope: scope[0] }, kind: _2 = const rustc_plugin::Registry::register_macro(move _3, move _4, move _6) -> [return: bb2, unwind: bb1] }): bad arg #2 (for<'cx, 'r, 's> fn(&'cx mut syntax::ext::base::ExtCtxt<'r>, syntax::codemap::Span, &'s [syntax::tokenstream::TokenTree]) -> std::boxed::Box<syntax::ext::base::MacResult + 'cx> <- for<'r, 's, 't0> fn(&'r mut syntax::ext::base::ExtCtxt<'s>, syntax::codemap::Span, &'t0 [syntax::tokenstream::TokenTree]) -> std::boxed::Box<syntax::ext::base::MacResult>): RegionsOverlyPolymorphic(BrNamed(crate11:DefIndex(1:1022), 'cx), '_#17r)
  --> src/lib.rs:60:30
   |
60 |     reg.register_macro("rn", expand_rn);
   |                              ^^^^^^^^^

error: internal compiler error: broken MIR in NodeId(186) (Terminator { source_info: SourceInfo { span: src/lib.rs:60:5: 60:40, scope: scope[0] }, kind: _2 = const rustc_plugin::Registry::register_macro(move _3, move _4, move _6) -> [return: bb2, unwind: bb1] }): bad arg #2 (for<'cx, 'r, 's> fn(&'cx mut syntax::ext::base::ExtCtxt<'r>, syntax::codemap::Span, &'s [syntax::tokenstream::TokenTree]) -> std::boxed::Box<syntax::ext::base::MacResult + 'cx> <- for<'r, 's, 't0> fn(&'r mut syntax::ext::base::ExtCtxt<'s>, syntax::codemap::Span, &'t0 [syntax::tokenstream::TokenTree]) -> std::boxed::Box<syntax::ext::base::MacResult>): RegionsOverlyPolymorphic(BrNamed(crate11:DefIndex(1:1022), 'cx), '_#17r)
  --> src/lib.rs:60:30
   |
60 |     reg.register_macro("rn", expand_rn);
   |                              ^^^^^^^^^
@estebank estebank added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-plugins Area: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-NLL Area: Non-lexical lifetimes (NLL) labels Mar 21, 2018
@pietroalbini
Copy link
Member

cc @rust-lang/wg-compiler-nll

@nikomatsakis nikomatsakis added the NLL-complete Working towards the "valid code works" goal label Apr 3, 2018
@matthewjasper
Copy link
Contributor

matthewjasper commented Apr 14, 2018

Ran into this when trying to bootstrap with NLL. Small repro case:

#![feature(nll)]

fn foo<'r>(_: &'r ()) -> &'static () { &() }

fn main() {
    let f: for<'r> fn(&'r ()) -> &'r () = foo;
}

@spastorino spastorino self-assigned this Apr 16, 2018
@nikomatsakis
Copy link
Contributor

This might, like #48071, be due to #33684

@spastorino spastorino removed their assignment Apr 24, 2018
@jkordish jkordish added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. and removed C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Apr 25, 2018
@nikomatsakis nikomatsakis added this to the Rust 2018 Preview 2 milestone Jul 3, 2018
@nikomatsakis
Copy link
Contributor

I think we have to fix this -- it's blocking bootstrap and it's a serious ICE. But I'm not sure what's the best fix. I have an idea but it's a bit aggressive -- still, I think I might give it a spin. The basic idea is to rerite the subtyping code to use universes, which should solve #48071 and help pave the way for chalkification. I don't think I have the bandwidth to mentor this, though, and will instead just try and do it. Assigning myself.

@nikomatsakis nikomatsakis self-assigned this Jul 3, 2018
@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jul 6, 2018

In-progress branch nll-issue-48071-universe-and-sub -- basically works but I have to re-enable user-given type annotations and also I'd like to tweak the performance.

@pnkfelix
Copy link
Member

visited for triage. this should be fixed via PR #52488 (which is WIP but hopefully will be ready soon).

@nikomatsakis
Copy link
Contributor

OK, #52488 has landed. This should be fixed.

@Mark-Simulacrum
Copy link
Member

@rust-lang/wg-compiler-nll Can someone take a look and confirm this is fixed?

@nikomatsakis
Copy link
Contributor

I can confirm this is fixed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-NLL Area: Non-lexical lifetimes (NLL) A-plugins Area: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ NLL-complete Working towards the "valid code works" goal T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

9 participants