-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.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
Rustc: rustc 1.40.0 (73528e339 2019-12-16)
uname -a
: Darwin Carls-MacBook-Pro-2.local 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec 1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64
I have crafted a declarative macro that results in rustc
entering an infinite loop and never completing.
Repro:
#[macro_export]
macro_rules! lock {
// Done normalizing
(@ { $($t:tt)* }) => {
};
(@ { $($t:tt)* } $a:pat, $b:expr, $c:block $($r:tt)* ) => {
$crate:lock!(@{ $($t)* $a,$b, $c, } $($r)*)
};
( $($t:tt)* ) => {
$crate::lock!(@{} $($t:tt)*)
}
}
fn main() {
lock! {
foo, bar(), {
println!("WAT!");
}
}
}
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.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.