Skip to content

ICE when building compiler plugin with nll #49250

Closed

Description

@real-felix

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);
   |                              ^^^^^^^^^

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    A-pluginsArea: compiler plugins (removed in https://github.com/rust-lang/rust/pull/116412)
    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
    A-NLLArea: Non-lexical lifetimes (NLL)
    on Mar 21, 2018
  2. emilyalbini commented on Mar 21, 2018

    @emilyalbini
    Member

    cc @rust-lang/wg-compiler-nll

  3. matthewjasper commented on Apr 14, 2018

    @matthewjasper
    Contributor

    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;
    }
  4. self-assigned this
    on Apr 16, 2018
  5. nikomatsakis commented on Apr 24, 2018

    @nikomatsakis
    Contributor

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

  6. removed their assignment
    on Apr 24, 2018
  7. added
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    and removed
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    on Apr 25, 2018
  8. nikomatsakis commented on Jul 3, 2018

    @nikomatsakis
    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.

  9. self-assigned this
    on Jul 3, 2018
  10. nikomatsakis commented on Jul 6, 2018

    @nikomatsakis
    Contributor

    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.

  11. pnkfelix commented on Jul 24, 2018

    @pnkfelix
    Contributor

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

  12. nikomatsakis commented on Jul 28, 2018

    @nikomatsakis
    Contributor

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

  13. Mark-Simulacrum commented on Jul 31, 2018

    @Mark-Simulacrum
    Member

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

  14. nikomatsakis commented on Aug 6, 2018

    @nikomatsakis
    Contributor

    I can confirm this is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-NLLArea: Non-lexical lifetimes (NLL)A-pluginsArea: compiler plugins (removed in https://github.com/rust-lang/rust/pull/116412)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️NLL-completeWorking towards the "valid code works" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions