Open
Description
Code
cat hang.rs
trait Trait {
type Assoc;
}
impl Trait for () {
type Assoc = ();
}
macro_rules! m {
([$($t:tt)*] [$($open:tt)*] [$($close:tt)*]) => {
m!{[$($t)*][$($open)*$($open)*][$($close)*$($close)*]}
};
([] [$($open:tt)*] [$($close:tt)*]) => {
fn _f() -> $($open)*()$($close)* {}
};
}
m! {[###########][impl Trait<Assoc =][>]}
Command
rustc -C opt-level=0 hang.rs
I expected to see this happen: The compiler compiles successfully or outputs an error message.
Instead, this happened: The code, as provided below, appears to encounter a hang
The same problem is reproduced on the nightly version(1.75.0-nightly (d627cf0 2023-10-10)) as well.
Meta
rustc --version --verbose
:
rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-unknown-linux-gnu
release: 1.73.0
LLVM version: 17.0.2
There is not any error information or stack information when using export RUST_BACKTRACE=1
Backtrace
<backtrace>
time: 0.000; rss: 30MB -> 32MB ( +2MB) parse_crate