-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed as duplicate of#100263
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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
I forgot the use test_case::test_case, and used the macro incorrectly. That got me an ICE:
Code
#[cfg(test)]
mod test {
type Result = std::result::Result<(), Box<dyn std::error::Error>>;
#[test_case(true, "ooops")]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn repro(_tracing: bool) -> Result {
Ok(())
}
}
fn main() {
println!("Hello, world!");
}With the following Cargo.toml file:
[package]
name = "repro-ice-2024-12"
version = "0.1.0"
edition = "2021"
[dev-dependencies]
test-case = "3.3.1"
tokio = { version = "1.42", features = ["full", "macros"] }Meta
rustc --version --verbose:
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: aarch64-apple-darwin
release: 1.83.0
LLVM version: 19.1.1
Also repros with nightly:
rustup run nightly rustc --version --verbose
rustc 1.85.0-nightly (4d669fb34 2024-12-08)
binary: rustc
commit-hash: 4d669fb34e7db6f3825d01e4c59b7996f0531431
commit-date: 2024-12-08
host: aarch64-apple-darwin
release: 1.85.0-nightly
LLVM version: 19.1.5
Error output
Compiling repro-ice-2024-12 v0.1.0 (/Users/coryan/repros/repro-ice-2024-12)
error[E0658]: use of unstable library feature 'custom_test_frameworks': custom test frameworks are an unstable feature
--> src/main.rs:5:7
|
5 | #[test_case(true, "ooops")]
| ^^^^^^^^^
|
= note: see issue #50297 <https://github.com/rust-lang/rust/issues/50297> for more information
error: malformed `test_case` attribute input
--> src/main.rs:5:5
|
5 | #[test_case(true, "ooops")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[test_case]`
thread 'rustc' panicked at compiler/rustc_ast/src/attr/mod.rs:210:36:
attribute is missing tokens: Attribute { kind: Normal(NormalAttr { item: AttrItem { unsafety: Default, path: Path { span: src/main.rs:5:5: 5:32 (#4), segments: [PathSegment { ident: rustc_test_marker#4, id: NodeId(4294967040), args: None }], tokens: None }, args: Eq(src/main.rs:5:5: 5:32 (#4), Ast(Expr { id: NodeId(4294967040), kind: Lit(Lit { kind: Str, symbol: "test::repro", suffix: None }), span: src/main.rs:5:5: 5:32 (#4), attrs: [], tokens: None })), tokens: None }, tokens: None }), id: AttrId(35), style: Outer, span: src/main.rs:5:5: 5:32 (#4) }
stack backtrace:
0: 0x10d6ab0ac - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7adefaad4a31afc0
1: 0x10ab0ebf4 - core::fmt::write::h381c0b0ce6ab972a
2: 0x10d69f040 - std::io::Write::write_fmt::h75af97148630d8d3
3: 0x10d6aaf6c - std::sys::backtrace::BacktraceLock::print::h8baf33e22611de71
4: 0x10d6ad440 - std::panicking::default_hook::{{closure}}::h369c7295ef58c5b1
5: 0x10d6ad28c - std::panicking::default_hook::h50746358288a9d6a
6: 0x10b69b6f8 - <alloc[9e098254554c5838]::boxed::Box<rustc_driver_impl[2ba876bd46efdf49]::install_ice_hook::{closure#0}> as core[6ba870000645607f]::ops::function::Fn<(&dyn for<'a, 'b> core[6ba870000645607f]::ops::function::Fn<(&'a std[18ac8b95e3b389da]::panic::PanicHookInfo<'b>,), Output = ()> + core[6ba870000645607f]::marker::Send + core[6ba870000645607f]::marker::Sync, &std[18ac8b95e3b389da]::panic::PanicHookInfo)>>::call
7: 0x10d6adccc - std::panicking::rust_panic_with_hook::h7d795911432661cb
8: 0x10d6ad948 - std::panicking::begin_panic_handler::{{closure}}::h36f15310ecbde379
9: 0x10d6ab554 - std::sys::backtrace::__rust_end_short_backtrace::heed121414170e0c7
10: 0x10d6ad60c - _rust_begin_unwind
11: 0x10fd98b54 - core::panicking::panic_fmt::h17b1b80ec02ffd19
12: 0x10ad64ad4 - <rustc_ast[e14a65cb842a5dd3]::ast::Attribute>::token_trees
13: 0x10ad88718 - rustc_ast[e14a65cb842a5dd3]::tokenstream::attrs_and_tokens_to_token_trees
14: 0x10b853438 - <rustc_ast[e14a65cb842a5dd3]::tokenstream::TokenStream>::from_ast::<rustc_ast[e14a65cb842a5dd3]::ptr::P<rustc_ast[e14a65cb842a5dd3]::ast::Item>>
15: 0x10b7d94d0 - <rustc_expand[7bc2ae1715089ce3]::expand::MacroExpander>::fully_expand_fragment
16: 0x10b7d7ab8 - <rustc_expand[7bc2ae1715089ce3]::expand::MacroExpander>::expand_crate
17: 0x10bfdf9e4 - rustc_interface[b7ee42a0f694265f]::passes::resolver_for_lowering_raw
18: 0x10cc5e508 - rustc_query_impl[54d0809e421041ba]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[54d0809e421041ba]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5138617138d99ce9]::query::erase::Erased<[u8; 16usize]>>
19: 0x10cca9348 - <rustc_query_impl[54d0809e421041ba]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[6ba870000645607f]::ops::function::FnOnce<(rustc_middle[5138617138d99ce9]::ty::context::TyCtxt, ())>>::call_once
20: 0x10cbc5ae0 - rustc_query_system[f55e8beb91aab0dd]::query::plumbing::try_execute_query::<rustc_query_impl[54d0809e421041ba]::DynamicConfig<rustc_query_system[f55e8beb91aab0dd]::query::caches::SingleCache<rustc_middle[5138617138d99ce9]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[54d0809e421041ba]::plumbing::QueryCtxt, true>
21: 0x10cda8bf0 - rustc_query_impl[54d0809e421041ba]::query_impl::resolver_for_lowering_raw::get_query_incr::__rust_end_short_backtrace
22: 0x10b6eaac4 - <rustc_middle[5138617138d99ce9]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[2ba876bd46efdf49]::run_compiler::{closure#0}::{closure#1}::{closure#3}, &rustc_data_structures[4ea10da2abf0fcab]::steal::Steal<(rustc_middle[5138617138d99ce9]::ty::ResolverAstLowering, alloc[9e098254554c5838]::rc::Rc<rustc_ast[e14a65cb842a5dd3]::ast::Crate>)>>
23: 0x10b6e9c44 - <rustc_interface[b7ee42a0f694265f]::interface::Compiler>::enter::<rustc_driver_impl[2ba876bd46efdf49]::run_compiler::{closure#0}::{closure#1}, core[6ba870000645607f]::result::Result<core[6ba870000645607f]::option::Option<rustc_interface[b7ee42a0f694265f]::queries::Linker>, rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>>
24: 0x10b6e08b4 - rustc_span[1fbc2a1e28a50ad9]::create_session_globals_then::<core[6ba870000645607f]::result::Result<(), rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>, rustc_interface[b7ee42a0f694265f]::util::run_in_thread_with_globals<rustc_interface[b7ee42a0f694265f]::interface::run_compiler<core[6ba870000645607f]::result::Result<(), rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>, rustc_driver_impl[2ba876bd46efdf49]::run_compiler::{closure#0}>::{closure#1}, core[6ba870000645607f]::result::Result<(), rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
25: 0x10b6d00ac - std[18ac8b95e3b389da]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b7ee42a0f694265f]::util::run_in_thread_with_globals<rustc_interface[b7ee42a0f694265f]::interface::run_compiler<core[6ba870000645607f]::result::Result<(), rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>, rustc_driver_impl[2ba876bd46efdf49]::run_compiler::{closure#0}>::{closure#1}, core[6ba870000645607f]::result::Result<(), rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6ba870000645607f]::result::Result<(), rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>>
26: 0x10b6e7f48 - <<std[18ac8b95e3b389da]::thread::Builder>::spawn_unchecked_<rustc_interface[b7ee42a0f694265f]::util::run_in_thread_with_globals<rustc_interface[b7ee42a0f694265f]::interface::run_compiler<core[6ba870000645607f]::result::Result<(), rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>, rustc_driver_impl[2ba876bd46efdf49]::run_compiler::{closure#0}>::{closure#1}, core[6ba870000645607f]::result::Result<(), rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6ba870000645607f]::result::Result<(), rustc_span[1fbc2a1e28a50ad9]::ErrorGuaranteed>>::{closure#1} as core[6ba870000645607f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
27: 0x10d6b8050 - std::sys::pal::unix::thread::Thread::new::thread_start::h44ebc83f14222f58
28: 0x183ea32e4 - __pthread_deallocate
error: 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.83.0 (90b35a623 2024-11-26) running on aarch64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
For more information about this error, try `rustc --explain E0658`.
error: could not compile `repro-ice-2024-12` (bin "repro-ice-2024-12" test) due to 2 previous errors
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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.