ICE `Mismatched open/close delims`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
auto-reduced (treereduce-rust):
impl [u8; (move || {
#![cfg_attr(, )]
struct Inner {
field: [u8; (move || {
#![cfg_attr(, )]
struct Inner {
field: [u8; {
#![cfg_attr
extern crate test_macros;]
!
}]
}
!
})()]
}
!
})()] {
#![cfg_eval]
#![Inner]
}
original:
// compile-flags: -Z span-debug
// aux-build:test-macros.rs
// check-pass
#![feature(cfg_eval)]
#![feature(custom_inner_attributes)]
#![feature(stmt_expr_attributes)]
#![feature(cfg)]
#![no_std] // Don't load unnecessary hygiene information from std
extern crate std;
#[macro_use]
extern crate test_macros;
struct Foo<T>(T);
impl [u8; (move || {
#![cfg_attr(not(FALSE), rustc_dummy(cursed_inner))]
#![allow(unused)]
struct Inner {
field: [u8; (move || {
#![cfg_attr(not(FALSE), rustc_dummy(cursed_inner))]
#![allow(unused)]
struct Inner {
field: [u8; {
#![cfg_attr#[macro_use]
extern crate test_macros;]
!
}]
}
!
})()]
}
!
})()] {
#![cfg_eval]
#![Inner]
#![cfg_attr(not(FALSE), rustc_dummy(evaluated_attr))]
fn bar() {
#[cfg(FALSE)] !
}
}
fn main() {}
Version information
rustc 1.92.0-nightly (bd4a8004c 2025-10-20)
binary: rustc
commit-hash: bd4a8004c2f3b73795cb4c03bf8e7634e4d89677
commit-date: 2025-10-20
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.3
Possibly related line of code:
https://github.com/rust-lang/rust/blob/bd4a8004c2f3b73795cb4c03bf8e7634e4d89677/compiler/rustc_ast/src/tokenstream.rs#L352-L364
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found keyword `extern`
--> /tmp/icemaker_global_tempdir.qS5vrDaBaVIV/rustc_testrunner_tmpdir_reporting.cSFuZtCaaRoW/mvce.rs:28:1
|
25 | struct Inner {
| ----- while parsing this struct
26 | field: [u8; {
27 | #![cfg_attr
| - expected one of `(`, `::`, `=`, `[`, `]`, or `{`
28 | extern crate test_macros;]
| ^^^^^^ unexpected token
error: expected expression, found `]`
--> /tmp/icemaker_global_tempdir.qS5vrDaBaVIV/rustc_testrunner_tmpdir_reporting.cSFuZtCaaRoW/mvce.rs:30:10
|
30 | }]
| ^ expected expression
error: expected one of `)`, `,`, `.`, `?`, or an operator, found `!`
--> /tmp/icemaker_global_tempdir.qS5vrDaBaVIV/rustc_testrunner_tmpdir_reporting.cSFuZtCaaRoW/mvce.rs:33:5
|
31 | }
| - expected one of `)`, `,`, `.`, `?`, or an operator
32 |
33 | !
| ^ unexpected token
error: expected expression, found `}`
--> /tmp/icemaker_global_tempdir.qS5vrDaBaVIV/rustc_testrunner_tmpdir_reporting.cSFuZtCaaRoW/mvce.rs:38:1
|
38 | })()] {
| ^ expected expression
error[E0658]: use of unstable library feature `cfg_eval`: `cfg_eval` is a recently implemented feature
--> /tmp/icemaker_global_tempdir.qS5vrDaBaVIV/rustc_testrunner_tmpdir_reporting.cSFuZtCaaRoW/mvce.rs:39:8
|
39 | #![cfg_eval]
| ^^^^^^^^
|
= note: see issue #82679 <https://github.com/rust-lang/rust/issues/82679> for more information
= help: add `#![feature(cfg_eval)]` to the crate attributes to enable
= note: this compiler was built on 2025-10-20; consider upgrading it if it is out of date
error[E0658]: inner macro attributes are unstable
--> /tmp/icemaker_global_tempdir.qS5vrDaBaVIV/rustc_testrunner_tmpdir_reporting.cSFuZtCaaRoW/mvce.rs:39:8
|
39 | #![cfg_eval]
| ^^^^^^^^
|
= note: see issue #54726 <https://github.com/rust-lang/rust/issues/54726> for more information
= help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable
= note: this compiler was built on 2025-10-20; consider upgrading it if it is out of date
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `,`
--> /tmp/icemaker_global_tempdir.qS5vrDaBaVIV/rustc_testrunner_tmpdir_reporting.cSFuZtCaaRoW/mvce.rs:19:17
|
19 | #![cfg_attr(, )]
| ------------^--- help: must be of the form: `#![cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
thread 'rustc' (1069995) panicked at compiler/rustc_ast/src/tokenstream.rs:358:21:
Mismatched open/close delims: open=Parenthesis close=/tmp/icemaker_global_tempdir.qS5vrDaBaVIV/rustc_testrunner_tmpdir_reporting.cSFuZtCaaRoW/mvce.rs:34:1: 34:2 (#0)
stack backtrace:
0: 0x7f1261c1bad3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7ce1817dc787ae2a
1: 0x7f1262201ad8 - core::fmt::write::h4b44684f3eb278fd
2: 0x7f1261bcfc43 - std::io::Write::write_fmt::hce8030c46a5cc224
3: 0x7f1261be1192 - std::sys::backtrace::BacktraceLock::print::h96e3511f9684deb2
4: 0x7f1261be7269 - std::panicking::default_hook::{{closure}}::h8f19c297eed9b282
5: 0x7f1261be6d93 - std::panicking::default_hook::h419be45792712020
6: 0x7f1260bf3d07 - std[77a4331de3222898]::panicking::update_hook::<alloc[b29b593dea949441]::boxed::Box<rustc_driver_impl[5267ee30c81b0e]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7f1261be768f - std::panicking::panic_with_hook::hb1a2dc8e6eebd27b
8: 0x7f1261be744a - std::panicking::panic_handler::{{closure}}::hd5af40f7328a8837
9: 0x7f1261be12c9 - std::sys::backtrace::__rust_end_short_backtrace::h43c84acb4bc43c12
10: 0x7f1261bc1e5d - __rustc[3e962e80ec1fc39a]::rust_begin_unwind
11: 0x7f125eb61890 - core::panicking::panic_fmt::h87f499a557a86b6c
12: 0x7f1262f4d667 - <rustc_ast[5c8c9754c11ceec9]::tokenstream::LazyAttrTokenStream>::to_attr_token_stream
13: 0x7f12632b6d36 - <&mut <rustc_expand[b98e5e0e4438a5fd]::config::StripUnconfigured>::configure_tokens::{closure#0} as core[98aea282fc88ea4b]::ops::function::FnMut<(&rustc_ast[5c8c9754c11ceec9]::tokenstream::AttrTokenTree,)>>::call_mut
14: 0x7f12632b689d - <rustc_expand[b98e5e0e4438a5fd]::config::StripUnconfigured>::configure_tokens
15: 0x7f12632b6ac1 - <&mut <rustc_expand[b98e5e0e4438a5fd]::config::StripUnconfigured>::configure_tokens::{closure#0} as core[98aea282fc88ea4b]::ops::function::FnMut<(&rustc_ast[5c8c9754c11ceec9]::tokenstream::AttrTokenTree,)>>::call_mut
16: 0x7f12632b689d - <rustc_expand[b98e5e0e4438a5fd]::config::StripUnconfigured>::configure_tokens
17: 0x7f12632b6ac1 - <&mut <rustc_expand[b98e5e0e4438a5fd]::config::StripUnconfigured>::configure_tokens::{closure#0} as core[98aea282fc88ea4b]::ops::function::FnMut<(&rustc_ast[5c8c9754c11ceec9]::tokenstream::AttrTokenTree,)>>::call_mut
18: 0x7f12632b689d - <rustc_expand[b98e5e0e4438a5fd]::config::StripUnconfigured>::configure_tokens
19: 0x7f12632b7a59 - <rustc_builtin_macros[3e1927132dcdc659]::cfg_eval::CfgEval as rustc_ast[5c8c9754c11ceec9]::mut_visit::MutVisitor>::flat_map_item
20: 0x7f12632b4800 - rustc_builtin_macros[3e1927132dcdc659]::cfg_eval::cfg_eval
21: 0x7f12609f5bad - <rustc_builtin_macros[3e1927132dcdc659]::cfg_eval::expand as rustc_expand[b98e5e0e4438a5fd]::base::MultiItemModifier>::expand
22: 0x7f126366fca1 - <rustc_expand[b98e5e0e4438a5fd]::expand::MacroExpander>::fully_expand_fragment
23: 0x7f1263653be9 - <rustc_expand[b98e5e0e4438a5fd]::expand::MacroExpander>::expand_crate
24: 0x7f1262d798e6 - rustc_interface[e8534005bd5cee03]::passes::configure_and_expand
25: 0x7f126331f615 - rustc_interface[e8534005bd5cee03]::passes::resolver_for_lowering_raw
26: 0x7f126331f38d - rustc_query_impl[4f9b9f05dcc10e6c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4f9b9f05dcc10e6c]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[57c44cee7187e787]::query::erase::Erased<[u8; 16usize]>>
27: 0x7f126331f367 - <rustc_query_impl[4f9b9f05dcc10e6c]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[98aea282fc88ea4b]::ops::function::FnOnce<(rustc_middle[57c44cee7187e787]::ty::context::TyCtxt, ())>>::call_once
28: 0x7f126328859f - rustc_query_system[ee3fd6b41b5cadc9]::query::plumbing::try_execute_query::<rustc_query_impl[4f9b9f05dcc10e6c]::DynamicConfig<rustc_query_system[ee3fd6b41b5cadc9]::query::caches::SingleCache<rustc_middle[57c44cee7187e787]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[4f9b9f05dcc10e6c]::plumbing::QueryCtxt, false>
29: 0x7f12632880fc - rustc_query_impl[4f9b9f05dcc10e6c]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
30: 0x7f1263464931 - <rustc_interface[e8534005bd5cee03]::passes::create_and_enter_global_ctxt<core[98aea282fc88ea4b]::option::Option<rustc_interface[e8534005bd5cee03]::queries::Linker>, rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[98aea282fc88ea4b]::ops::function::FnOnce<(&rustc_session[39b43f51f4446db8]::session::Session, rustc_middle[57c44cee7187e787]::ty::context::CurrentGcx, alloc[b29b593dea949441]::sync::Arc<rustc_data_structures[738b40c7f5a39734]::jobserver::Proxy>, &std[77a4331de3222898]::sync::once_lock::OnceLock<rustc_middle[57c44cee7187e787]::ty::context::GlobalCtxt>, &rustc_data_structures[738b40c7f5a39734]::sync::worker_local::WorkerLocal<rustc_middle[57c44cee7187e787]::arena::Arena>, &rustc_data_structures[738b40c7f5a39734]::sync::worker_local::WorkerLocal<rustc_hir[4616985d3bd4a1e2]::Arena>, rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
31: 0x7f126329c895 - rustc_interface[e8534005bd5cee03]::interface::run_compiler::<(), rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}>::{closure#1}
32: 0x7f12632fa6c7 - std[77a4331de3222898]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e8534005bd5cee03]::util::run_in_thread_with_globals<rustc_interface[e8534005bd5cee03]::util::run_in_thread_pool_with_globals<rustc_interface[e8534005bd5cee03]::interface::run_compiler<(), rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
33: 0x7f12632fa3a8 - <<std[77a4331de3222898]::thread::Builder>::spawn_unchecked_<rustc_interface[e8534005bd5cee03]::util::run_in_thread_with_globals<rustc_interface[e8534005bd5cee03]::util::run_in_thread_pool_with_globals<rustc_interface[e8534005bd5cee03]::interface::run_compiler<(), rustc_driver_impl[5267ee30c81b0e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[98aea282fc88ea4b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
34: 0x7f12633009ef - std::sys::thread::unix::Thread::new::thread_start::h5d7739f30ff88cb2
35: 0x7f125cc969cb - <unknown>
36: 0x7f125cd1aa0c - <unknown>
37: 0x0 - <unknown>
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: please make sure that you have updated to the latest nightly
note: rustc 1.92.0-nightly (bd4a8004c 2025-10-20) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0658`.
@rustbot label +F-cfg_eval +F-custom_inner_attributes +F-stmt_expr_attributes +F-cfg
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reduced case with rustc, then inspect LazyAttrTokenStream::to_attr_token_stream in compiler/rustc_ast/src/tokenstream.rs:352-364. Trace how cfg_eval processes the nested malformed attribute tokens; done when this input produces diagnostics without an internal compiler error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100