Repository navigation
ICE: non-lifetime passed to :lifetime #50381
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
This code crashes the compiler. However, the location of the error is pointed out, which is nice.
#![feature(macro_lifetime_matcher)]
macro_rules! m { ($x:lifetime) => { } }
m!(a);error: internal compiler error: not a lifetime
--> src/main.rs:5:8
|
5 | m!(a);
| ^
thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:491:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to previous error
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
kennytm commentedon May 2, 2018
cc #34303.
estebank commentedon May 2, 2018
The error occurs during parsing a lifetime unconditionally, which is used during macro parsing:
rust/src/libsyntax/ext/tt/macro_parser.rs
Line 838 in d40a0b3
I would modify the code above to preemptively use
check_lifetime(), and iffalse, emit an appropriate diagnostic error.Also, if this is your first contribution to rustc, https://forge.rust-lang.org/ contains quite a bit of information on how to set up your environment. If you need extra help, feel free to reach out to anyone in the team, here or in gitter.
rleungx commentedon May 3, 2018
I'm interested in taking this issue.
Rollup merge of rust-lang#50416 - rleungx:non-lifetime, r=estebank