[ICE]: autodiff:not implemented
Open
Nobody has claimed this yet.
C-bug
F-autodiff
I-ICE
S-bug-has-test
S-has-mcve
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
//rustc
#![feature(autodiff)]
#[core::autodiff::autodiff_forward(fd_inner, Dual)]
fn f(_x: struct S<const N: usize, T>([T; N]) where T: Iterator<Item = u32>) {}
Meta
rustc --version --verbose:
rustc 1.99.0-nightly (ad3d0bc14 2026-07-31)
binary: rustc
commit-hash: ad3d0bc141a02cf446e384136d250a1f6950fed5
commit-date: 2026-07-31
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8
Error output
error: expected type, found keyword `struct`
--> ./Bug.rs:3:10
|
3 | fn f(_x: struct S<const N: usize, T>([T; N]) where T: Iterator<Item = u32>) {}
| ^^^^^^ expected type
error: expected one of `:`, `@`, or `|`, found `>`
--> ./Bug.rs:3:36
|
3 | fn f(_x: struct S<const N: usize, T>([T; N]) where T: Iterator<Item = u32>) {}
| ^ expected one of `:`, `@`, or `|`
error: expected 2 activities, but found 1
--> ./Bug.rs:2:1
|
2 | #[core::autodiff::autodiff_forward(fd_inner, Dual)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Backtrace
thread 'rustc' (3316818) panicked at /rustc-dev/ad3d0bc141a02cf446e384136d250a1f6950fed5/compiler/rustc_builtin_macros/src/autodiff.rs:566:26:
not implemented
stack backtrace:
0: 0x7fc47d2c7a06 - <<std[83a5d38283ccaf0a]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[dd05a50edc8fb225]::fmt::Display>::fmt
1: 0x7fc47da0a958 - core[dd05a50edc8fb225]::fmt::write
2: 0x7fc47d2dcb4c - <std[83a5d38283ccaf0a]::sys::stdio::unix::Stderr as core[dd05a50edc8fb225]::io::write::Write>::write_fmt
3: 0x7fc47d29aeaa - std[83a5d38283ccaf0a]::panicking::default_hook::{closure#0}
4: 0x7fc47d2bb9b3 - std[83a5d38283ccaf0a]::panicking::default_hook
5: 0x7fc47c22977b - std[83a5d38283ccaf0a]::panicking::update_hook::<alloc[fc3e6e3cedfc2867]::boxed::Box<rustc_driver_impl[4d341f08808842a2]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7fc47d2bbe52 - std[83a5d38283ccaf0a]::panicking::panic_with_hook
7: 0x7fc47d29af94 - std[83a5d38283ccaf0a]::panicking::panic_handler::{closure#0}
8: 0x7fc47d292b79 - std[83a5d38283ccaf0a]::sys::backtrace::__rust_end_short_backtrace::<std[83a5d38283ccaf0a]::panicking::panic_handler::{closure#0}, !>
9: 0x7fc47d29c95d - __rustc[ebe1dd44d2b7d011]::rust_begin_unwind
10: 0x7fc479f8bbdc - core[dd05a50edc8fb225]::panicking::panic_fmt
11: 0x7fc47a37e4e2 - core[dd05a50edc8fb225]::panicking::panic
12: 0x7fc47bff2da5 - rustc_builtin_macros[b6f3effaeb8c8780]::autodiff::llvm_enzyme::expand_with_mode
13: 0x7fc47c009bf7 - <rustc_builtin_macros[b6f3effaeb8c8780]::autodiff::llvm_enzyme::expand_forward as rustc_expand[6767d9785d118df5]::base::MultiItemModifier>::expand
14: 0x7fc47f1d7474 - <rustc_expand[6767d9785d118df5]::expand::MacroExpander>::fully_expand_fragment
15: 0x7fc47f1d0180 - <rustc_expand[6767d9785d118df5]::expand::MacroExpander>::expand_crate
16: 0x7fc47e305869 - rustc_interface[2c4fc24e203d38c5]::passes::resolver_for_lowering_raw
17: 0x7fc47e305016 - rustc_query_impl[c5fbf8bbbde2d049]::query_impl::resolver_for_lowering_raw::invoke_provider_fn::__rust_begin_short_backtrace
18: 0x7fc47ed145c1 - rustc_query_impl[c5fbf8bbbde2d049]::execution::try_execute_query::<rustc_middle[f5f43f33f8b944bb]::query::caches::SingleCache<rustc_middle[f5f43f33f8b944bb]::query::erase::ErasedData<[u8; 24usize]>>, false>
19: 0x7fc47ed14338 - rustc_query_impl[c5fbf8bbbde2d049]::query_impl::resolver_for_lowering_raw::execute_query_non_incr::__rust_end_short_backtrace
20: 0x7fc47ecb8676 - rustc_interface[2c4fc24e203d38c5]::interface::run_compiler::<(), rustc_driver_impl[4d341f08808842a2]::run_compiler::{closure#0}>::{closure#2}
21: 0x7fc47ed223e4 - std[83a5d38283ccaf0a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2c4fc24e203d38c5]::util::run_in_thread_with_globals<rustc_interface[2c4fc24e203d38c5]::util::run_in_thread_pool_with_globals<rustc_interface[2c4fc24e203d38c5]::interface::run_compiler<(), rustc_driver_impl[4d341f08808842a2]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
22: 0x7fc47ed221ad - <std[83a5d38283ccaf0a]::thread::lifecycle::spawn_unchecked<rustc_interface[2c4fc24e203d38c5]::util::run_in_thread_with_globals<rustc_interface[2c4fc24e203d38c5]::util::run_in_thread_pool_with_globals<rustc_interface[2c4fc24e203d38c5]::interface::run_compiler<(), rustc_driver_impl[4d341f08808842a2]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[dd05a50edc8fb225]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
23: 0x7fc47ed2e43a - <std[83a5d38283ccaf0a]::sys::thread::unix::Thread>::new::thread_start
24: 0x7fc47828aaa4 - start_thread
at ./nptl/pthread_create.c:447:8
25: 0x7fc478317c6c - clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
26: 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: please attach the file at `/home/bug/rustc-ice-2026-08-01T10_33_31-3316808.txt` to your bug report
note: rustc 1.99.0-nightly (ad3d0bc14 2026-07-31) 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
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
Start with the reproducer and the panic location in compiler/rustc_builtin_macros/src/autodiff.rs:566, especially llvm_enzyme::expand_with_mode. Run the example with the reported nightly compiler, then trace how the autodiff attribute handles this malformed generic parameter. Done should include regression coverage for the reproducer and ensure compilation no longer reaches an unexpected panic.
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
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100