Skip to content

[ICE]: path with Res::Err but no error emitted #154334

@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: --crate-type=lib
#![feature(min_generic_const_args)]
#![feature(fn_delegation)]
#![feature(adt_const_params)]
#![feature(unsized_const_params)]
trait Trait<'a, T, const N: str> {
    fn foo<'v, A, B>(&self) {}
}
reuse Trait::foo;

Version information

rustc 1.96.0-nightly (0312931d8 2026-03-24)
binary: rustc
commit-hash: 0312931d8c0ba1a28268a12c06202b68cbc65f76
commit-date: 2026-03-24
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(min_generic_const_args) -Zcrate-attr=feature(fn_delegation) -Zcrate-attr=feature(adt_const_params) -Zcrate-attr=feature(unsized_const_params) --crate-type=lib

Program output

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:12
  |
1 | #![feature(min_generic_const_args)]
  |            ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: the feature `fn_delegation` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:12
  |
1 | #![feature(fn_delegation)]
  |            ^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information

warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:12
  |
1 | #![feature(unsized_const_params)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information

warning: trait `Trait` is never used
 --> /tmp/icemaker_global_tempdir.LtqFCJZ8uZYC/rustc_testrunner_tmpdir_reporting.ZousLE5EqGw3/mvce.rs:1:7
  |
1 | trait Trait<'a, T, const N: str> {
  |       ^^^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: function `foo` is never used
 --> /tmp/icemaker_global_tempdir.LtqFCJZ8uZYC/rustc_testrunner_tmpdir_reporting.ZousLE5EqGw3/mvce.rs:4:14
  |
4 | reuse Trait::foo;
  |              ^^^

warning: 5 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: Unexpected const type: str
 --> /tmp/icemaker_global_tempdir.LtqFCJZ8uZYC/rustc_testrunner_tmpdir_reporting.ZousLE5EqGw3/mvce.rs:4:14
  |
4 | reuse Trait::foo;
  |              ^^^
  |
note: delayed at /rustc-dev/0312931d8c0ba1a28268a12c06202b68cbc65f76/compiler/rustc_ast_lowering/src/delegation/generics.rs:527:22
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         4: <rustc_ast_lowering::LoweringContext<rustc_ast_lowering::ResolverDelayedAstLowering>>::get_external_generics
         5: <rustc_ast_lowering::LoweringContext<rustc_ast_lowering::ResolverDelayedAstLowering>>::get_parent_generics
         6: <rustc_ast_lowering::LoweringContext<rustc_ast_lowering::ResolverDelayedAstLowering>>::lower_delegation
         7: <rustc_ast_lowering::LoweringContext<rustc_ast_lowering::ResolverDelayedAstLowering>>::lower_item_kind
         8: <rustc_ast_lowering::item::ItemLowerer<rustc_ast_lowering::ResolverDelayedAstLowering>>::lower_node
         9: rustc_ast_lowering::lower_delayed_owner
        10: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 0]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        11: rustc_query_impl::query_impl::lower_delayed_owner::execute_query_non_incr::__rust_end_short_backtrace
        12: rustc_middle::hir::map::hir_crate_items
        13: rustc_query_impl::query_impl::hir_crate_items::invoke_provider_fn::__rust_begin_short_backtrace
        14: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>, false>
        15: rustc_query_impl::query_impl::hir_crate_items::execute_query_non_incr::__rust_end_short_backtrace
        16: rustc_interface::passes::analysis
        17: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        18: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        19: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        20: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        21: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        22: <std::sys::thread::unix::Thread>::new::thread_start
        23: <unknown>
        24: <unknown>
      
 --> /tmp/icemaker_global_tempdir.LtqFCJZ8uZYC/rustc_testrunner_tmpdir_reporting.ZousLE5EqGw3/mvce.rs:4:14
  |
4 | reuse Trait::foo;
  |              ^^^

error: internal compiler error: path with `Res::Err` but no error emitted
 --> /tmp/icemaker_global_tempdir.LtqFCJZ8uZYC/rustc_testrunner_tmpdir_reporting.ZousLE5EqGw3/mvce.rs:4:14
  |
4 | reuse Trait::foo;
  |              ^^^
  |
note: delayed at /rustc-dev/0312931d8c0ba1a28268a12c06202b68cbc65f76/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:2290:22
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
         4: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty
         5: rustc_hir_analysis::collect::type_of::type_of
         6: rustc_query_impl::query_impl::type_of::invoke_provider_fn::__rust_begin_short_backtrace
         7: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>, false>
         8: rustc_query_impl::query_impl::type_of::execute_query_non_incr::__rust_end_short_backtrace
         9: rustc_hir_analysis::check::check::check_item_type
        10: rustc_hir_analysis::check::wfcheck::check_well_formed
        11: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        12: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        13: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        14: rustc_hir_analysis::check::wfcheck::check_type_wf
        15: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        16: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        17: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        18: rustc_hir_analysis::check_crate
        19: rustc_interface::passes::analysis
        20: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        21: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        22: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        23: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        24: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        25: <std::sys::thread::unix::Thread>::new::thread_start
        26: <unknown>
        27: <unknown>
      
 --> /tmp/icemaker_global_tempdir.LtqFCJZ8uZYC/rustc_testrunner_tmpdir_reporting.ZousLE5EqGw3/mvce.rs:4:14
  |
4 | reuse Trait::foo;
  |              ^^^

error: internal compiler error: failed to report fulfillment errors
  |
  = note: delayed at /rustc-dev/0312931d8c0ba1a28268a12c06202b68cbc65f76/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs:284:47
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
             2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
             3: <rustc_errors::DiagCtxtHandle>::delayed_bug::<&str>
             4: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
             5: rustc_hir_analysis::check::wfcheck::check_well_formed
             6: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
             7: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
             8: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
             9: rustc_hir_analysis::check::wfcheck::check_type_wf
            10: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
            11: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
            12: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
            13: rustc_hir_analysis::check_crate
            14: rustc_interface::passes::analysis
            15: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
            16: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
            17: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
            18: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            19: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            20: <std::sys::thread::unix::Thread>::new::thread_start
            21: <unknown>
            22: <unknown>
          

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 (0312931d8 2026-03-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(min_generic_const_args) -Z crate-attr=feature(fn_delegation) -Z crate-attr=feature(adt_const_params) -Z crate-attr=feature(unsized_const_params) --crate-type lib -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@rustbot label +F-min_generic_const_args +F-fn_delegation +F-adt_const_params +F-unsized_const_params

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-adt_const_params`#![feature(adt_const_params)]`F-fn_delegation`#![feature(fn_delegation)]`F-min_generic_const_args`#![feature(min_generic_const_args)]`F-unsized_const_params`#![feature(unsized_const_params)]`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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    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