[ICE]: `DefId does not appear in children of DefId`
@cjgillot is already working on this.
Since Jun 22, 2026.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
fn make_coroutine() {
|assert_eq!(
3,
foo(|()| {
use std::ops::Add;
v.add(3);
})
)| {};
}
fn main() {}
A mutant of glacier2's fixed/121096-1.rs, simplified manually.
Meta
rustc --version --verbose:
rustc 1.98.0-nightly (91fe22da8 2026-06-21)
binary: rustc
commit-hash: 91fe22da8084a1c9e993d78d4a56f22ab8396236
commit-date: 2026-06-21
host: x86_64-apple-darwin
release: 1.98.0-nightly
LLVM version: 22.1.7
Error output
command: rustc
error: expected identifier, found keyword `match`
--> abcd.rs:2:6
|
2 | |assert_eq!(
| ______^
3 | | 3,
4 | | foo(|()| {
5 | | use std::ops::Add;
6 | | v.add(3);
7 | | })
8 | | )| {};
| |_____^ expected identifier, found keyword
|
help: escape `match` to use it as an identifier
--> /Users/jb/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/macros/mod.rs:44:9
|
44 | r#match (&$left, &$right) {
| ++
error: macro expansion ignores `{` and any tokens following
--> /Users/jb/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/macros/mod.rs:44:33
|
44 | match (&$left, &$right) {
| ^
|
::: abcd.rs:2:6
|
2 | |assert_eq!(
| ______-
3 | | 3,
4 | | foo(|()| {
5 | | use std::ops::Add;
6 | | v.add(3);
7 | | })
8 | | )| {};
| |_____- caused by the macro expansion here
|
= note: the usage of `assert_eq!` is likely invalid in pattern context
error[E0425]: cannot find value `v` in this scope
--> abcd.rs:6:13
|
6 | v.add(3);
| ^ not found in this scope
error[E0531]: cannot find tuple struct or tuple variant `r#match` in this scope
--> abcd.rs:2:6
|
2 | |assert_eq!(
| ______^
3 | | 3,
4 | | foo(|()| {
5 | | use std::ops::Add;
6 | | v.add(3);
7 | | })
8 | | )| {};
| |_____^ not found in this scope
error: arbitrary expressions aren't allowed in patterns
--> abcd.rs:4:9
|
4 | / foo(|()| {
5 | | use std::ops::Add;
6 | | v.add(3);
7 | | })
| |__________^
|
= note: the `expr` fragment specifier forces the metavariable's content to be an expression
thread 'rustc' (12434060) panicked at /rustc-dev/91fe22da8084a1c9e993d78d4a56f22ab8396236/compiler/rustc_ast_lowering/src/lib.rs:643:13:
DefId(0:6 ~ abcd[aa16]::make_coroutine::{closure#0}::{closure#0}) does not appear in children of DefId(0:3 ~ abcd[aa16]::make_coroutine)
Backtrace
thread 'rustc' (12434060) panicked at /rustc-dev/91fe22da8084a1c9e993d78d4a56f22ab8396236/compiler/rustc_ast_lowering/src/lib.rs:643:13:
DefId(0:6 ~ abcd[aa16]::make_coroutine::{closure#0}::{closure#0}) does not appear in children of DefId(0:3 ~ abcd[aa16]::make_coroutine)
stack backtrace:
0: 0x1094ac3a5 - <<std[a20328c213e1acde]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[e554cc35b0d1b68]::fmt::Display>::fmt
1: 0x10602b707 - core[e554cc35b0d1b68]::fmt::write
2: 0x1094c3ca5 - <std[a20328c213e1acde]::sys::stdio::unix::Stderr as std[a20328c213e1acde]::io::Write>::write_fmt
3: 0x10947b754 - std[a20328c213e1acde]::panicking::default_hook::{closure#0}
4: 0x10949ca37 - std[a20328c213e1acde]::panicking::default_hook
5: 0x106e03c24 - std[a20328c213e1acde]::panicking::update_hook::<alloc[ceb85cf88a7697a4]::boxed::Box<rustc_driver_impl[9fe47791ec7f9771]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x10949cdf7 - std[a20328c213e1acde]::panicking::panic_with_hook
7: 0x10947b811 - std[a20328c213e1acde]::panicking::panic_handler::{closure#0}
8: 0x10946f649 - std[a20328c213e1acde]::sys::backtrace::__rust_end_short_backtrace::<std[a20328c213e1acde]::panicking::panic_handler::{closure#0}, !>
9: 0x10947cdf4 - __rustc[d0241b7fe89c64df]::rust_begin_unwind
10: 0x10958712b - core[e554cc35b0d1b68]::panicking::panic_fmt
11: 0x1095c31fb - rustc_ast_lowering[315b6ebe866b0d06]::lower_to_hir::{closure#0}::{closure#0}
12: 0x106300a87 - rustc_ast_lowering[315b6ebe866b0d06]::lower_to_hir::{closure#0}
13: 0x1063100cf - rustc_ast_lowering[315b6ebe866b0d06]::lower_to_hir
14: 0x108885ad6 - rustc_query_impl[a66d654594d8defc]::query_impl::lower_to_hir::invoke_provider_fn::__rust_begin_short_backtrace
15: 0x10865684c - rustc_query_impl[a66d654594d8defc]::execution::try_execute_query::<rustc_data_structures[8122b38ee432a77]::vec_cache::VecCache<rustc_span[6c206711ced636e2]::def_id::LocalDefId, rustc_middle[998151d76a1f1c67]::query::erase::ErasedData<[u8; 16usize]>, rustc_middle[998151d76a1f1c67]::dep_graph::graph::DepNodeIndex>, false>
16: 0x108885b6c - rustc_query_impl[a66d654594d8defc]::query_impl::lower_to_hir::execute_query_non_incr::__rust_end_short_backtrace
17: 0x1078a0412 - <rustc_middle[998151d76a1f1c67]::hir::provide::{closure#1} as core[e554cc35b0d1b68]::ops::function::FnOnce<(rustc_middle[998151d76a1f1c67]::ty::context::TyCtxt, rustc_span[6c206711ced636e2]::def_id::LocalDefId)>>::call_once
18: 0x1088bde26 - rustc_query_impl[a66d654594d8defc]::query_impl::hir_owner::invoke_provider_fn::__rust_begin_short_backtrace
19: 0x10865de51 - rustc_query_impl[a66d654594d8defc]::execution::try_execute_query::<rustc_data_structures[8122b38ee432a77]::vec_cache::VecCache<rustc_span[6c206711ced636e2]::def_id::LocalDefId, rustc_middle[998151d76a1f1c67]::query::erase::ErasedData<[u8; 32usize]>, rustc_middle[998151d76a1f1c67]::dep_graph::graph::DepNodeIndex>, false>
20: 0x1088bdecf - rustc_query_impl[a66d654594d8defc]::query_impl::hir_owner::execute_query_non_incr::__rust_end_short_backtrace
21: 0x107c5d2fc - <rustc_middle[998151d76a1f1c67]::ty::context::TyCtxt>::hir_owner_parent
22: 0x107be45c2 - <rustc_middle[998151d76a1f1c67]::lint::ShallowLintLevelMap>::lint_level_spec_at_node::{closure#0}::{closure#0}
23: 0x107c31f6a - <rustc_middle[998151d76a1f1c67]::lint::ShallowLintLevelMap>::lint_level_spec_at_node
24: 0x107c3f225 - <rustc_middle[998151d76a1f1c67]::ty::context::TyCtxt>::lint_level_spec_at_node
25: 0x1071a3b02 - rustc_hir_analysis[c311080b1fc768c4]::check_unused::check_unused_traits
26: 0x108694053 - rustc_query_impl[a66d654594d8defc]::execution::try_execute_query::<rustc_middle[998151d76a1f1c67]::query::caches::SingleCache<rustc_middle[998151d76a1f1c67]::query::erase::ErasedData<[u8; 0usize]>>, false>
27: 0x10889c522 - rustc_query_impl[a66d654594d8defc]::query_impl::check_unused_traits::execute_query_non_incr::__rust_end_short_backtrace
28: 0x10714e9c2 - rustc_hir_analysis[c311080b1fc768c4]::check_crate
29: 0x107826701 - rustc_interface[16404cc120fb2eee]::passes::analysis
30: 0x108694053 - rustc_query_impl[a66d654594d8defc]::execution::try_execute_query::<rustc_middle[998151d76a1f1c67]::query::caches::SingleCache<rustc_middle[998151d76a1f1c67]::query::erase::ErasedData<[u8; 0usize]>>, false>
31: 0x1088bc742 - rustc_query_impl[a66d654594d8defc]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
32: 0x106db0c9f - rustc_interface[16404cc120fb2eee]::passes::create_and_enter_global_ctxt::<core[e554cc35b0d1b68]::option::Option<rustc_interface[16404cc120fb2eee]::queries::Linker>, rustc_driver_impl[9fe47791ec7f9771]::run_compiler::{closure#0}::{closure#2}>
33: 0x106e03019 - rustc_interface[16404cc120fb2eee]::interface::run_compiler::<(), rustc_driver_impl[9fe47791ec7f9771]::run_compiler::{closure#0}>::{closure#1}
34: 0x106df81e1 - std[a20328c213e1acde]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[16404cc120fb2eee]::util::run_in_thread_with_globals<rustc_interface[16404cc120fb2eee]::util::run_in_thread_pool_with_globals<rustc_interface[16404cc120fb2eee]::interface::run_compiler<(), rustc_driver_impl[9fe47791ec7f9771]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
35: 0x106e0c1eb - <std[a20328c213e1acde]::thread::lifecycle::spawn_unchecked<rustc_interface[16404cc120fb2eee]::util::run_in_thread_with_globals<rustc_interface[16404cc120fb2eee]::util::run_in_thread_pool_with_globals<rustc_interface[16404cc120fb2eee]::interface::run_compiler<(), rustc_driver_impl[9fe47791ec7f9771]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e554cc35b0d1b68]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
36: 0x1094a8d51 - <std[a20328c213e1acde]::sys::thread::unix::Thread>::new::thread_start
37: 0x7ff817d62e05 - __pthread_start
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/260622_ice_case_review/tmp/rustc-ice-2026-06-22T10_34_25-8659.txt` to your bug report
note: rustc 1.98.0-nightly (91fe22da8 2026-06-21) running on x86_64-apple-darwin
query stack during panic:
#0 [lower_to_hir] lowering HIR for `make_coroutine::{closure#0}::{closure#0}`
#1 [hir_owner] getting owner for `make_coroutine::{closure#0}::{closure#0}`
... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error[E0425]: cannot find function `foo` in this scope
--> abcd.rs:4:9
|
4 | foo(|()| {
| ^^^ not found in this scope
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0425, E0531.
For more information about an error, try `rustc --explain E0425`.
Notes
-
ICE location:
rustc_ast_lowering/src/lib.rs Line-643
https://github.com/rust-lang/rust/blob/91fe22da8084a1c9e993d78d4a56f22ab8396236/compiler/rustc_ast_lowering/src/lib.rs#L641-L648 -
ICE location at
nightly-2026-03-02(80381278a) :rustc_middle/src/hir/mod.rs Line-412
https://github.com/rust-lang/rust/blob/80381278a08582356c13b0f52af92d27c567c230/compiler/rustc_middle/src/hir/mod.rs#L409-L413 -
There exists no issue with the keyword
"does not appear in children of"(Issue Page Query Link), so I think there are no duplicates.- and also, there exists only one open "No HirId for DefId" issue (Issue Page Query Link), which requires feature
generic_assert, so I guess this issue is not a duplicated one.
- and also, there exists only one open "No HirId for DefId" issue (Issue Page Query Link), which requires feature
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.
Assessment
This issue has not been assessed yet.