Closed
Description
I tried this code with -Copt-level=3 --crate-type=lib
(Playground, Godbolt; minimized and modified from r3_core
's failing code):
#![feature(decl_macro)]
macro emit($($m:ident)*) {$(
// Randomize `def_path_hash` by defining them under a module with
// different names
pub mod $m {
pub trait Tr {
type Next: Tr;
}
pub fn hoge<const N: usize, T: Tr>() {
inner::<N, T>();
}
#[inline(always)]
fn inner<const N: usize, T: Tr>() {
inner::<N, T::Next>();
}
}
)*}
// Increase the chance of triggering the bug
emit!(
m00 m01 m02 m03 m04 m05 m06 m07 m08 m09
m10 m11 m12 m13 m14 m15 m16 m17 m18 m19
);
I expected to see this happen: Successful compilation
Instead, this happened: Compiler hangup
Meta
rustc --version --verbose
:
rustc 1.64.0-nightly (f8588549c 2022-07-18)
binary: rustc
commit-hash: f8588549c3c3d45c32b404210cada01e2a45def3
commit-date: 2022-07-18
host: aarch64-apple-darwin
release: 1.64.0-nightly
LLVM version: 14.0.6