-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-fn_delegation`#![feature(fn_delegation)]``#![feature(fn_delegation)]`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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
auto-reduced (treereduce-rust):
fn main() {
fn foo<const N: dyn for<'a> Foo>() {}
reuse foo;
}original:
#![feature(fn_delegation)]
fn main() {
trait Foo {}
fn foo<const N: dyn for<'a> Foo>() {}
reuse foo;
}Version information
rustc 1.96.0-nightly (b90dc1e59 2026-03-04)
binary: rustc
commit-hash: b90dc1e597db0bbc0cab0eccb39747b1a9d7e607
commit-date: 2026-03-04
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0
Possibly related line of code:
rust/compiler/rustc_ast_lowering/src/item.rs
Lines 59 to 71 in b90dc1e
| ) { | |
| let mut lctx = LoweringContext::new(self.tcx, self.ast_index, self.resolver); | |
| lctx.with_hir_id_owner(owner, |lctx| f(lctx)); | |
| for (def_id, info) in lctx.children { | |
| let owner = self.owners.ensure_contains_elem(def_id, || hir::MaybeOwner::Phantom); | |
| assert!( | |
| matches!(owner, hir::MaybeOwner::Phantom), | |
| "duplicate copy of {def_id:?} in lctx.children" | |
| ); | |
| *owner = info; | |
| } | |
| } |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0428]: the name `foo` is defined multiple times
--> /tmp/icemaker_global_tempdir.Ga6lCnolTuPb/rustc_testrunner_tmpdir_reporting.2qQadq94BiHG/mvce.rs:3:5
|
2 | fn foo<const N: dyn for<'a> Foo>() {}
| ---------------------------------- previous definition of the value `foo` here
3 | reuse foo;
| ^^^^^^^^^^ `foo` redefined here
|
= note: `foo` must be defined only once in the value namespace of this block
error[E0405]: cannot find trait `Foo` in this scope
--> /tmp/icemaker_global_tempdir.Ga6lCnolTuPb/rustc_testrunner_tmpdir_reporting.2qQadq94BiHG/mvce.rs:2:33
|
2 | fn foo<const N: dyn for<'a> Foo>() {}
| ^^^ not found in this scope
error[E0658]: functions delegation is not yet fully implemented
--> /tmp/icemaker_global_tempdir.Ga6lCnolTuPb/rustc_testrunner_tmpdir_reporting.2qQadq94BiHG/mvce.rs:3:5
|
3 | reuse foo;
| ^^^^^^^^^^
|
= note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
= help: add `#![feature(fn_delegation)]` to the crate attributes to enable
= note: this compiler was built on 2026-03-04; consider upgrading it if it is out of date
thread 'rustc' (2500919) panicked at /rustc-dev/b90dc1e597db0bbc0cab0eccb39747b1a9d7e607/compiler/rustc_ast_lowering/src/item.rs:65:13:
duplicate copy of DefId(0:6 ~ mvce[50a2]::main::foo::'a) in lctx.children
stack backtrace:
0: 0x7fd17c55b73b - <<std[82796cbe7e14e686]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[723ec164f49f73a3]::fmt::Display>::fmt
1: 0x7fd17cc22948 - core[723ec164f49f73a3]::fmt::write
2: 0x7fd17c572746 - <std[82796cbe7e14e686]::sys::stdio::unix::Stderr as std[82796cbe7e14e686]::io::Write>::write_fmt
3: 0x7fd17c531818 - std[82796cbe7e14e686]::panicking::default_hook::{closure#0}
4: 0x7fd17c54eba3 - std[82796cbe7e14e686]::panicking::default_hook
5: 0x7fd17b53866c - std[82796cbe7e14e686]::panicking::update_hook::<alloc[774c2fc5b8157a70]::boxed::Box<rustc_driver_impl[cc40153740e5fbc5]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7fd17c54ee82 - std[82796cbe7e14e686]::panicking::panic_with_hook
7: 0x7fd17c5318d8 - std[82796cbe7e14e686]::panicking::panic_handler::{closure#0}
8: 0x7fd17c528609 - std[82796cbe7e14e686]::sys::backtrace::__rust_end_short_backtrace::<std[82796cbe7e14e686]::panicking::panic_handler::{closure#0}, !>
9: 0x7fd17c53333d - __rustc[eda097aff079559a]::rust_begin_unwind
10: 0x7fd17911c61c - core[723ec164f49f73a3]::panicking::panic_fmt
11: 0x7fd17d3df342 - <rustc_ast_lowering[734997e02f9e6df7]::item::ItemLowerer>::lower_node
12: 0x7fd17d3d63a7 - rustc_ast_lowering[734997e02f9e6df7]::lower_to_hir
13: 0x7fd17de8a6e8 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::hir_crate::invoke_provider_fn::__rust_begin_short_backtrace
14: 0x7fd17de895c4 - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_middle[9b0503ad92008f82]::query::caches::SingleCache<rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 8usize]>>, false>
15: 0x7fd17de8904f - rustc_query_impl[eb5d4e66a16195f6]::query_impl::hir_crate::execute_query_non_incr::__rust_end_short_backtrace
16: 0x7fd17cd472c3 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::opt_hir_owner_nodes::invoke_provider_fn::__rust_begin_short_backtrace
17: 0x7fd17cd4648a - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_data_structures[b07b151140ce4279]::vec_cache::VecCache<rustc_span[da1975f195527d0f]::def_id::LocalDefId, rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[9b0503ad92008f82]::dep_graph::graph::DepNodeIndex>, false>
18: 0x7fd17cd46105 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::opt_hir_owner_nodes::execute_query_non_incr::__rust_end_short_backtrace
19: 0x7fd17d53ffe6 - <rustc_middle[9b0503ad92008f82]::ty::context::TyCtxt>::hir_owner_node
20: 0x7fd17de8fc91 - rustc_middle[9b0503ad92008f82]::hir::map::hir_crate_items
21: 0x7fd17de8b2b1 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::hir_crate_items::invoke_provider_fn::__rust_begin_short_backtrace
22: 0x7fd17de895c4 - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_middle[9b0503ad92008f82]::query::caches::SingleCache<rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 8usize]>>, false>
23: 0x7fd17de88dcf - rustc_query_impl[eb5d4e66a16195f6]::query_impl::hir_crate_items::execute_query_non_incr::__rust_end_short_backtrace
24: 0x7fd17cd42dd8 - rustc_interface[5358b22c06b9f13b]::passes::analysis
25: 0x7fd17de8835c - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_middle[9b0503ad92008f82]::query::caches::SingleCache<rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 0usize]>>, false>
26: 0x7fd17de880bb - rustc_query_impl[eb5d4e66a16195f6]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
27: 0x7fd17de5bdad - rustc_interface[5358b22c06b9f13b]::interface::run_compiler::<(), rustc_driver_impl[cc40153740e5fbc5]::run_compiler::{closure#0}>::{closure#1}
28: 0x7fd17de322be - std[82796cbe7e14e686]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5358b22c06b9f13b]::util::run_in_thread_with_globals<rustc_interface[5358b22c06b9f13b]::util::run_in_thread_pool_with_globals<rustc_interface[5358b22c06b9f13b]::interface::run_compiler<(), rustc_driver_impl[cc40153740e5fbc5]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
29: 0x7fd17de32920 - <std[82796cbe7e14e686]::thread::lifecycle::spawn_unchecked<rustc_interface[5358b22c06b9f13b]::util::run_in_thread_with_globals<rustc_interface[5358b22c06b9f13b]::util::run_in_thread_pool_with_globals<rustc_interface[5358b22c06b9f13b]::interface::run_compiler<(), rustc_driver_impl[cc40153740e5fbc5]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[723ec164f49f73a3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
30: 0x7fd17de337ac - <std[82796cbe7e14e686]::sys::thread::unix::Thread>::new::thread_start
31: 0x7fd1778a098b - <unknown>
32: 0x7fd177924a0c - <unknown>
33: 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.96.0-nightly (b90dc1e59 2026-03-04) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [hir_crate] getting the crate HIR
#1 [opt_hir_owner_nodes] getting HIR owner items in ``
#2 [hir_crate_items] getting HIR crate items
#3 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0405, E0428, E0658.
For more information about an error, try `rustc --explain E0405`.
@rustbot label +F-fn_delegation
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-fn_delegation`#![feature(fn_delegation)]``#![feature(fn_delegation)]`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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.