Skip to content

ICE when invoking attribute macro on crate root #41211

Closed
@abonander

Description

@abonander
Contributor

An ICE occurs when invoking a procedural macro attribute on the root of a crate with #![my_proc_macro].

Relevant backtrace frames:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src\libcore\option.rs:329
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: syntax::ext::expand::MacroExpander::expand_crate
             at C:\Users\cyber\Rust\rust\src\libsyntax\ext\expand.rs:225
   1: rustc_driver::driver::phase_2_configure_and_expand::{{closure}}<closure>
             at C:\Users\cyber\Rust\rust\src\librustc_driver\driver.rs:699

This happens on the latest nightly [rustc 1.18.0-nightly (ad36c2f55 2017-04-09)], however because I'm lazy I got this backtrace from the last debug build from my last PR so the lines have moved. I suspect it's one of the two unwraps() at line 217.

cc @jseyfried

Activity

added
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
on Apr 11, 2017
self-assigned this
on Apr 13, 2017
abonander

abonander commented on Apr 18, 2017

@abonander
ContributorAuthor

@jseyfried If you haven't started on this one I'll go ahead and take a crack at it since people are stumbling on it.

abonander

abonander commented on Apr 18, 2017

@abonander
ContributorAuthor

That second unwrap is syntax::ptr::P::unwrap() which is infallible. That's kind of misleading, but okay.

added a commit that references this issue on Apr 20, 2017
910532e
added 3 commits that reference this issue on Apr 22, 2017

Rollup merge of rust-lang#41432 - abonander:issue_41211, r=jseyfried

c150d0e

Rollup merge of rust-lang#41432 - abonander:issue_41211, r=jseyfried

9283402

Rollup merge of rust-lang#41432 - abonander:issue_41211, r=jseyfried

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

Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @TimNN@abonander@jseyfried

      Issue actions

        ICE when invoking attribute macro on crate root · Issue #41211 · rust-lang/rust