Skip to content

ICE with inner function #[test_case] #107454

Closed
@astrum-nova

Description

@astrum-nova

Minimized

fn init() {
    #[test_case]
    fn function27() {}
}

Original report

This happens when a test function is declared inside another function, the one where the tests start running to be precise, using a custom testing framework in a no_std environment.

thread 'rustc' panicked at 'expected Item', compiler\rustc_expand\src\base.rs:148:18
stack backtrace:

   0:     0x7ffd3cc89da2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h51cbe37f66a51707
   1:     0x7ffd3ccc5b0b - core::fmt::write::h5c78deaf4d8a1717
   2:     0x7ffd3cc7ce3a - <std::io::IoSlice as core::fmt::Debug>::fmt::he493d27c141d515f
   3:     0x7ffd3cc89aeb - std::sys::common::alloc::realloc_fallback::h8441730297e6dd3d
   4:     0x7ffd3cc8d499 - std::panicking::default_hook::h1fc51507de475e03
   5:     0x7ffd3cc8d11b - std::panicking::default_hook::h1fc51507de475e03
   6:     0x7ffd256910cf - rustc_driver[f6c6ae1dae99c3a4]::describe_lints
   7:     0x7ffd3cc8ddff - std::panicking::rust_panic_with_hook::h9b4ec48ed01143e7
   8:     0x7ffd3cc8db1b - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::hafe6d61d6276438c
   9:     0x7ffd3cc8aa9f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h51cbe37f66a51707
  10:     0x7ffd3cc8d810 - rust_begin_unwind
  11:     0x7ffd3ccfb9a5 - core::panicking::panic_fmt::h60c5d107fadefb54
  12:     0x7ffd228566ff - <rustc_expand[d208009879dd3b2d]::base::Annotatable>::expect_item
  13:     0x7ffd25484a57 - <rustc_builtin_macros[3f8ae38c2d7d73a1]::format::PositionUsedAs as core[ac0928afaaba8a6b]::fmt::Debug>::fmt
  14:     0x7ffd239eea5e - <rustc_expand[d208009879dd3b2d]::expand::MacroExpander>::fully_expand_fragment
  15:     0x7ffd2284e0c9 - <rustc_expand[d208009879dd3b2d]::expand::MacroExpander>::expand_crate
  16:     0x7ffd229a8e4c - rustc_interface[eee0500530781d4a]::interface::parse_check_cfg
  17:     0x7ffd229cdc02 - rustc_interface[eee0500530781d4a]::passes::configure_and_expand
  18:     0x7ffd22998531 - <rustc_interface[eee0500530781d4a]::queries::Queries>::expansion
  19:     0x7ffd229990d5 - <rustc_interface[eee0500530781d4a]::queries::Queries>::global_ctxt
  20:     0x7ffd227ad48d - rustc_driver[f6c6ae1dae99c3a4]::args::arg_expand_all
  21:     0x7ffd2279133c - <rustc_data_structures[cc058e1d54c120e6]::temp_dir::MaybeTempDir>::new
  22:     0x7ffd227acc77 - rustc_driver[f6c6ae1dae99c3a4]::args::arg_expand_all
  23:     0x7ffd2279ae63 - <rustc_data_structures[cc058e1d54c120e6]::temp_dir::MaybeTempDir>::new
  24:     0x7ffd227934ad - <rustc_data_structures[cc058e1d54c120e6]::temp_dir::MaybeTempDir>::new
  25:     0x7ffd3cca057c - std::sys::windows::thread::Thread::new::hf27b16c8cd567952
  26:     0x7ffdc2f57614 - BaseThreadInitThunk
  27:     0x7ffdc40626a1 - RtlUserThreadStart

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.69.0-nightly (1e225413a 2023-01-28) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -Z unstable-options

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions