Closed
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
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: The lexing & parsing of Rust source code to an ASTCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
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