Skip to content

ICE when hitting recursion limit with crate attrs #105700

Closed
@jruderman

Description

@jruderman

Found with a modified fuzz-rustc

Code

#![recursion_limit="4"]
#![k1]
#![k2]
#![k3]
#![k4]
#![k5]

ICE

thread <unnamed> panicked at 'internal error: entered unreachable code', compiler/rustc_expand/src/base.rs:446

Backtrace
   0:        0x108b08796 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd6dea84f06cc919a
   1:        0x108b6715a - core::fmt::write::h91ecc43dcb5a87d3
   2:        0x108afac5c - std::io::Write::write_fmt::hc922635edee92051
   3:        0x108b0857a - std::sys_common::backtrace::print::h86bd5791976d67a9
   4:        0x108b0b8e3 - std::panicking::default_hook::{{closure}}::h32c4d35e1d887df2
   5:        0x108b0b638 - std::panicking::default_hook::hcd90b2b89f8c0e15
   6:        0x108b0c0a3 - std::panicking::rust_panic_with_hook::h9198f3fe823c744c
   7:        0x108b0be33 - std::panicking::begin_panic_handler::{{closure}}::h935bfbd23a054b53
   8:        0x108b08c38 - std::sys_common::backtrace::__rust_end_short_backtrace::h1a500d61b73a0659
   9:        0x108b0bb3d - _rust_begin_unwind
  10:        0x108b93903 - core::panicking::panic_fmt::he9045b6279698c2c
  11:        0x108b939d7 - core::panicking::panic::h8341ec280685e050
  12:        0x118529672 - <rustc_expand[5335689204dc94a0]::base::DummyResult as rustc_expand[5335689204dc94a0]::base::MacResult>::make_crate
  13:        0x11851a9cb - <rustc_expand[5335689204dc94a0]::expand::AstFragmentKind>::make_from
  14:        0x11850b6b0 - <rustc_expand[5335689204dc94a0]::expand::MacroExpander>::fully_expand_fragment
  15:        0x11850a8ac - <rustc_expand[5335689204dc94a0]::expand::MacroExpander>::expand_crate
  16:        0x118b70d2b - <rustc_session[78db928f84e94300]::session::Session>::time::<core[d953718cd3bcc963]::result::Result<rustc_ast[9bcfca4c6a3003da]::ast::Crate, rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>, rustc_interface[9fb4355f0ea261b0]::passes::configure_and_expand::{closure#1}>
  17:        0x118b93fab - rustc_interface[9fb4355f0ea261b0]::passes::configure_and_expand
  18:        0x118b1f06e - <rustc_interface[9fb4355f0ea261b0]::queries::Queries>::expansion
  19:        0x1183438b6 - rustc_span[e3bcd7e2de09f7c3]::with_source_map::<core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>, rustc_interface[9fb4355f0ea261b0]::interface::run_compiler<core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>, rustc_driver[f5ca9ba73eed523d]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  20:        0x1183358ee - <scoped_tls[10e5aad72c190240]::ScopedKey<rustc_span[e3bcd7e2de09f7c3]::SessionGlobals>>::set::<rustc_interface[9fb4355f0ea261b0]::interface::run_compiler<core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>, rustc_driver[f5ca9ba73eed523d]::run_compiler::{closure#1}>::{closure#0}, core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>>
  21:        0x1183043b7 - std[e9f68177e3155681]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9fb4355f0ea261b0]::util::run_in_thread_pool_with_globals<rustc_interface[9fb4355f0ea261b0]::interface::run_compiler<core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>, rustc_driver[f5ca9ba73eed523d]::run_compiler::{closure#1}>::{closure#0}, core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>>
  22:        0x1182e6db9 - <<std[e9f68177e3155681]::thread::Builder>::spawn_unchecked_<rustc_interface[9fb4355f0ea261b0]::util::run_in_thread_pool_with_globals<rustc_interface[9fb4355f0ea261b0]::interface::run_compiler<core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>, rustc_driver[f5ca9ba73eed523d]::run_compiler::{closure#1}>::{closure#0}, core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d953718cd3bcc963]::result::Result<(), rustc_errors[6e8b1009bf902fa9]::ErrorGuaranteed>>::{closure#1} as core[d953718cd3bcc963]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  23:        0x11a2d93a7 - std::sys::unix::thread::Thread::new::thread_start::h6bf891e61773eb8a
  24:     0x7ff80c3874e1 - __pthread_start

Regression

Regression in nightly-2021-12-02, perhaps from #91313 (@petrochenkov)

Might be related to #99478

Version

rustc 1.68.0-nightly (bdb07a8ec 2022-12-11)
binary: rustc
commit-hash: bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4
commit-date: 2022-12-11
host: x86_64-apple-darwin
release: 1.68.0-nightly
LLVM version: 15.0.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions