Repository navigation
Open
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.F-autodiff`#![feature(autodiff)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-found-by-fuzzingStatus: This issue was found using fuzzing. It may not arise in practical cases.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
Description
Code
#![feature(macro_attr)]
#![feature(autodiff)]
macro_rules! forward_referenced_attr {
attr() {} => {}
}
use std::autodiff::autodiff_reverse;
#[autodiff_reverse(Active)]
#[forward_referenced_attr]
fn main() {}Mutant of tests/codegen-llvm/autodiff/identical_fnc.rs
and tests/ui/macros/macro-rules-attr-error.rs.
Meta
rustc --version --verbose:
rustc 1.95.0-nightly (7f99507f5 2026-02-19)
binary: rustc
commit-hash: 7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312
commit-date: 2026-02-19
host: x86_64-apple-darwin
release: 1.95.0-nightly
LLVM version: 22.1.0
Error output
Command: rustc
thread 'rustc' (15497734) panicked at /rustc-dev/7f99507f57e6c4aa0dce3daf6a13cca8cd4dd312/compiler/rustc_ast/src/attr/mod.rs:335:36:
attribute is missing tokens: Attribute { kind: Normal(NormalAttr { item: AttrItem { unsafety: Default, path: Path { span: no-location (#0), segments: [PathSegment { ident: rustc_autodiff#0, id: NodeId(4294967040), args: None }], tokens: None }, args: Unparsed(Empty), tokens: None }, tokens: None }), id: AttrId(5), style: Outer, span: iter1_f4c11fd339fddc5a.rs:10:1: 10:28 (#4) }
Backtrace
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: <rustc_ast::ast::Attribute>::token_trees
3: rustc_ast::tokenstream::attrs_and_tokens_to_token_trees
4: <rustc_ast::tokenstream::TokenStream>::from_ast::<alloc::boxed::Box<rustc_ast::ast::Item>>
5: <rustc_expand::expand::MacroExpander>::expand_invoc
6: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
7: <rustc_expand::expand::MacroExpander>::expand_crate
8: rustc_interface::passes::configure_and_expand
9: rustc_interface::passes::resolver_for_lowering_raw
[... omitted 1 frame ...]
10: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
11: 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 `/Volumes/T7/workspace/out-260219/scratch/rustc-ice-2026-02-20T08_03_58-60492.txt` to your bug report
note: rustc 1.95.0-nightly (7f99507f5 2026-02-19) running on x86_64-apple-darwin
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
Notes
-
ICE location:
compiler/rustc_ast/src/attr/mod.rs Line-335
rust/compiler/rustc_ast/src/attr/mod.rs
Lines 330 to 344 in ef70767
pub fn token_trees(&self) -> Vec<TokenTree> { match self.kind { AttrKind::Normal(ref normal) => normal .tokens .as_ref() .unwrap_or_else(|| panic!("attribute is missing tokens: {self:?}")) .to_attr_token_stream() .to_token_trees(), AttrKind::DocComment(comment_kind, data) => vec![TokenTree::token_alone( token::DocComment(comment_kind, self.style, data), self.span, )], } } } -
Seems like
autodiffis the core part to trigger the ICE, since the combination of autodiff and contracts features also shows the same ICE location (e.g., using both requires attribute & autodiff_reverse attributes). -
Duplication Check
- Search result of "attribute is missing tokens" shows ICE with multiple attributes on a test function #100263, which is related to test framework.
@rustbot label +F-autodiff
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.F-autodiff`#![feature(autodiff)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-found-by-fuzzingStatus: This issue was found using fuzzing. It may not arise in practical cases.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
Activity
ci: pin foundation nightly toolchain to 2026-07-08
bb1yd commentedon Nov 2, 2026
@rustbot claim