-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-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
This bug was found with a fuzzer (tree-splicer). Reduced with treereduce, then hand-reduced.
Duplicate searches:
- https://github.com/rust-lang/rust/issues?q=is%3Aissue%20state%3Aopen%20label%3AI-ICE%20resolver_for_lowering_raw&page=2
- https://github.com/rust-lang/rust/issues?q=is%3Aissue%20state%3Aopen%20label%3AI-ICE%20tokenstream.rs
Code
enum A {
A
const A: A = {
#[derive(Clone, Eq, Debug, Hash)]
struct A
where
A: A< {
struct A<A: A< {
#[cfg]
A
} >>
;
enum A
,
,
}
} >;
};Full program
enum A<A> {
A(A)
A{ ,
}
const A: () = {
#[link_name = "__builtin_ia32_ptestnmb128"]
enum A {
Method {
,
/// Find the params corresponded to generic arg
method: CalledMethod,
/// See `OffendingFilterExpr::IsSome`
side_effect_expr_span: Option<Span>,
},
Adt { param_name: Ident, },
}
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vld2))]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
enum A { A(A), }
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, E0080, Debug, strong_ref, Hash)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, missing_component, Hash)]
struct A<A: A>(B)
where
A: A< {
#[derive(Copy, Clone PartialEq, Eq, PartialOrd, Ord Debug, Hash)]
#[repr(i16)]
#[derive(Copy, Clone PartialEq, , PartialOrd, Ord, Debug, Hash)]
enum A { A, A{ } }
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Default, Hash)]
struct A<A> {
A: A
}
#[derive(Copy, Clone, PartialEq, constraint_category, PartialOrd, Ord, Debug, Hash)]
struct A<A: A< {
[derive(Copy, CompletedTest, PartialEq Eq, Ord, Debug Hash)]
enum A { A(A), }
#[repr(i16)]
#[link(name = b"The `build.profiler` config option requires `compiler-rt` sources from LLVM.")]
enum A { A, A{ C C: } }
#[cfg((target_os = b"solaris", target_os "illumos"))]
struct A<A> {
,
pub description: &'static str,
pub default_severity: Severity,
pub warn_since: Option<Edition>,
deny_since: Option<MergeState,
-4
#[derive(location_const_line, Clone, , Eq, PartialOrd, Ord, Debug, Hash)]
struct A<A: parens: _>(B)
where
A A< continue >;
#[derive(f(&) => &mut buf, expectedk - i, b"", ;
"rounding-down mismatch for v={v}, i={i}: \
actual {actual:?}, expected {expected:?}",
v = vstr, i = -i)]
enum AnySubTrait<A> {
Or(ThinVec<TyPat>),
crate_def_map_super_super A: PrimeCachesProgress },
}
} >>(B)
where
A: A< continue >;
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
enum A<UnexpectedTokenAfterDot>
A(
),
,
}
} >;
#[derive(, Clone, PartialEq, Eq, PartialOrd Ord, Debug, Hash)]
enum A<A> {
A(
),
A { A: A },
}
};
macro A() {
#[]
struct Y<SubdiagnosticEagerLint>(B)
where
B: From<B>(Anonymize, )
#[local_mod( Clone, extend_with_tt_alone, Eq, PartialOrd, Ord Debug, Hash)]
Z<C> {
impl<T> const From<NonZero<T>> for T
where
B { matched_node: code.clone() },
}
}
A!();
fn A() {}Meta
rustc --version --verbose:
rustc 1.94.0-nightly (fa5eda19b 2025-12-12)
binary: rustc
commit-hash: fa5eda19b95201468f5b1c5c035ec2fc06fccd66
commit-date: 2025-12-12
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.5
Error output
error: expected one of `(`, `,`, `=`, `{`, or `}`, found keyword `const`
--> reduced2.rs:3:1
|
2 | A
| - expected one of `(`, `,`, `=`, `{`, or `}`
3 | const A: A = {
| ^^^^^ unexpected token
|
= help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`
error: expected one of `<`, `where`, or `{`, found `,`
--> reduced2.rs:14:9
|
13 | enum A
| -- expected one of `<`, `where`, or `{`
| |
| while parsing this enum
14 | ,
| ^ unexpected token
Backtrace
error: expected one of `(`, `,`, `=`, `{`, or `}`, found keyword `const`
--> reduced2.rs:3:1
|
2 | A
| - expected one of `(`, `,`, `=`, `{`, or `}`
3 | const A: A = {
| ^^^^^ unexpected token
|
= help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`
error: expected one of `<`, `where`, or `{`, found `,`
--> reduced2.rs:14:9
|
13 | enum A
| -- expected one of `<`, `where`, or `{`
| |
| while parsing this enum
14 | ,
| ^ unexpected token
thread 'rustc' (2738366) panicked at compiler/rustc_ast/src/tokenstream.rs:356:84:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic
3: core::option::unwrap_failed
4: <rustc_ast::tokenstream::LazyAttrTokenStream>::to_attr_token_stream
5: rustc_ast::tokenstream::attrs_and_tokens_to_token_trees
6: <rustc_ast::tokenstream::TokenStream>::from_ast::<alloc::boxed::Box<rustc_ast::ast::Stmt>>
7: rustc_builtin_macros::cfg_eval::cfg_eval
8: <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand::{closure#0}
9: <rustc_resolve::Resolver as rustc_expand::base::ResolverExpand>::resolve_derives
10: <rustc_builtin_macros::derive::Expander as rustc_expand::base::MultiItemModifier>::expand
11: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
12: <rustc_expand::expand::MacroExpander>::expand_crate
13: rustc_interface::passes::configure_and_expand
14: rustc_interface::passes::resolver_for_lowering_raw
[... omitted 2 frames ...]
15: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
16: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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: please attach the file at `/home/langston/code/treereduce/rustc-ice-2025-12-13T16_59_17-2738363.txt` to your bug report
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: aborting due to 2 previous errors
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-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.