Skip to content
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 when invoking attribute macro on crate root #41211

Closed
abonander opened this Issue Apr 11, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@abonander
Copy link
Contributor

abonander commented Apr 11, 2017

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

@abonander

This comment has been minimized.

Copy link
Contributor Author

abonander commented Apr 18, 2017

@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

This comment has been minimized.

Copy link
Contributor Author

abonander commented Apr 18, 2017

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

abonander added a commit to abonander/rust that referenced this issue Apr 20, 2017

Don't panic if an attribute macro fails to resolve at crate root
Adds temporary regression test; this ideally should work as-is (rust-lang#41430)

Closes rust-lang#41211

frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 22, 2017

Rollup merge of rust-lang#41432 - abonander:issue_41211, r=jseyfried
Don't panic if an attribute macro fails to resolve at crate root

Adds temporary regression test; this ideally should work as-is (rust-lang#41430)

Closes rust-lang#41211

r? @jseyfried

frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 22, 2017

Rollup merge of rust-lang#41432 - abonander:issue_41211, r=jseyfried
Don't panic if an attribute macro fails to resolve at crate root

Adds temporary regression test; this ideally should work as-is (rust-lang#41430)

Closes rust-lang#41211

r? @jseyfried

frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 22, 2017

Rollup merge of rust-lang#41432 - abonander:issue_41211, r=jseyfried
Don't panic if an attribute macro fails to resolve at crate root

Adds temporary regression test; this ideally should work as-is (rust-lang#41430)

Closes rust-lang#41211

r? @jseyfried

@bors bors closed this in #41432 Apr 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.