Skip to content

[ICE]: 1.95.0 - No type for node HirId #156299

@TehPers

Description

@TehPers

Code

use proc_macro2::TokenStream;
use syn::parse::{ParseBuffer, ParseStream};

fn foo(_: ParseStream) {}

fn test_foo() {
    let input = TokenStream::new();
    let result = (move |input: ParseBuffer| Ok(foo(input)))
        .parse2(input)
        .unwrap();
}

Meta

rustc --version --verbose:

rustc 1.95.0 (59807616e 2026-04-14)
binary: rustc
commit-hash: 59807616e1fa2540724bfbac14d7976d7e4a3860
commit-date: 2026-04-14
host: x86_64-unknown-linux-gnu
release: 1.95.0
LLVM version: 22.1.2

Error output

error: internal compiler error: /rustc-dev/59807616e1fa2540724bfbac14d7976d7e4a3860/compiler/rustc_middle/src/ty/typeck_results.rs:326:13: node_type: no type for node HirId(DefId(0:8 ~ ice_repro[446b]::test_foo).15) (expr `move |input: ParseBuffer|`)


thread 'rustc' (121815) panicked at /rustc-dev/59807616e1fa2540724bfbac14d7976d7e4a3860/compiler/rustc_middle/src/ty/typeck_results.rs:326:13:
Box<dyn Any>
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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: rustc 1.95.0 (59807616e 2026-04-14) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `test_foo`
#1 [analysis] running analysis passes on crate `ice_repro`
end of query stack
error: could not compile `ice-repro` (lib)

Caused by:
  process didn't exit successfully: `/home/tehpers/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name ice_repro --edition=2024 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=235 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=43381e5be9c10862 -C extra-filename=-d28b6d0dad6ba43b --out-dir /home/tehpers/repos/ice-repro/target/debug/deps -C incremental=/home/tehpers/repos/ice-repro/target/debug/incremental -L dependency=/home/tehpers/repos/ice-repro/target/debug/deps --extern proc_macro2=/home/tehpers/repos/ice-repro/target/debug/deps/libproc_macro2-bd9dcd1cddcb1a55.rmeta --extern syn=/home/tehpers/repos/ice-repro/target/debug/deps/libsyn-ae7472e77795fcfd.rmeta` (exit status: 101)
Backtrace

error: internal compiler error: /rustc-dev/59807616e1fa2540724bfbac14d7976d7e4a3860/compiler/rustc_middle/src/ty/typeck_results.rs:326:13: node_type: no type for node HirId(DefId(0:8 ~ ice_repro[446b]::test_foo).15) (expr `move |input: ParseBuffer|`)


thread 'rustc' (121892) panicked at /rustc-dev/59807616e1fa2540724bfbac14d7976d7e4a3860/compiler/rustc_middle/src/ty/typeck_results.rs:326:13:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_middle::ty::typeck_results::TypeckResults>::expr_ty
   7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::suggest_deref_or_ref
   8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::suggest_deref_ref_or_into
   9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::emit_type_mismatch_suggestions
  10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::emit_coerce_suggestions
  11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::report_arg_errors
  12: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_call
  13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  14: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_call
  15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  16: rustc_hir_typeck::check::check_fn
  17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_closure
  18: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  19: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_method_call
  20: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_method_call
  22: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  24: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
  25: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26: rustc_hir_typeck::check::check_fn
  27: rustc_hir_typeck::typeck_with_inspect::{closure#0}
      [... omitted 1 frame ...]
  28: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis::check_crate::{closure#2}>::{closure#0}
  29: rustc_hir_analysis::check_crate
  30: rustc_interface::passes::analysis
  31: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, true>
  32: 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.

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: rustc 1.95.0 (59807616e 2026-04-14) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `test_foo`
#1 [analysis] running analysis passes on crate `ice_repro`
end of query stack
error: could not compile `ice-repro` (lib)

Caused by:
  process didn't exit successfully: `/home/tehpers/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name ice_repro --edition=2024 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=235 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=43381e5be9c10862 -C extra-filename=-d28b6d0dad6ba43b --out-dir /home/tehpers/repos/ice-repro/target/debug/deps -C incremental=/home/tehpers/repos/ice-repro/target/debug/incremental -L dependency=/home/tehpers/repos/ice-repro/target/debug/deps --extern proc_macro2=/home/tehpers/repos/ice-repro/target/debug/deps/libproc_macro2-bd9dcd1cddcb1a55.rmeta --extern syn=/home/tehpers/repos/ice-repro/target/debug/deps/libsyn-ae7472e77795fcfd.rmeta` (exit status: 101)

Cargo.toml

[package]
name = "ice-repro"
version = "0.1.0"
edition = "2024"

[dependencies]
proc-macro2 = "1.0.106"
syn = "2.0.117"

Cargo.lock

# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4

[[package]]
name = "ice-repro"
version = "0.1.0"
dependencies = [
 "proc-macro2",
 "syn",
]

[[package]]
name = "proc-macro2"
version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
dependencies = [
 "unicode-ident",
]

[[package]]
name = "quote"
version = "1.0.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
dependencies = [
 "proc-macro2",
]

[[package]]
name = "syn"
version = "2.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
dependencies = [
 "proc-macro2",
 "quote",
 "unicode-ident",
]

[[package]]
name = "unicode-ident"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions