rust-lang / rust-lang/rust

[ICE]: `something went wrong with structurally_normalize_ty`

Open
#156,699 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-reborrow I-ICE needs-triage T-compiler WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

auto-reduced (treereduce-rust):

use std::marker::CoerceShared;

trait CustomMarker<'a> {}
impl<'a, T> CoerceShared<<T as Iterator>::Item> for dyn CustomMarker<'a> {}

original:

#![feature(reborrow)]
use std::marker::CoerceShared;

trait CustomMarker<'a> {}
impl<'a, T> CoerceShared<<T as Iterator>::Item> for dyn CustomMarker<'a> {}

fn main() {}

Version information

rustc 1.97.0-nightly (5ea817c65 2026-05-18)
binary: rustc
commit-hash: 5ea817c65e4896167300b7d2550781b98da9901a
commit-date: 2026-05-18
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4

Possibly related line of code:
https://github.com/rust-lang/rust/blob/5ea817c65e4896167300b7d2550781b98da9901a/compiler/rustc_hir_analysis/src/coherence/builtin.rs#L622-L634

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.rNQ0I38I4caE/rustc_testrunner_tmpdir_reporting.JFF8O9yuc3VD/mvce.rs:4:76
  |
4 | impl<'a, T> CoerceShared<<T as Iterator>::Item> for dyn CustomMarker<'a> {}
  |                                                                            ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.rNQ0I38I4caE/rustc_testrunner_tmpdir_reporting.JFF8O9yuc3VD/mvce.rs`

error[E0658]: use of unstable library feature `reborrow`
 --> /tmp/icemaker_global_tempdir.rNQ0I38I4caE/rustc_testrunner_tmpdir_reporting.JFF8O9yuc3VD/mvce.rs:1:5
  |
1 | use std::marker::CoerceShared;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #145612 <https://github.com/rust-lang/rust/issues/145612> for more information
  = help: add `#![feature(reborrow)]` to the crate attributes to enable
  = note: this compiler was built on 2026-05-18; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `reborrow`
 --> /tmp/icemaker_global_tempdir.rNQ0I38I4caE/rustc_testrunner_tmpdir_reporting.JFF8O9yuc3VD/mvce.rs:4:13
  |
4 | impl<'a, T> CoerceShared<<T as Iterator>::Item> for dyn CustomMarker<'a> {}
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #145612 <https://github.com/rust-lang/rust/issues/145612> for more information
  = help: add `#![feature(reborrow)]` to the crate attributes to enable
  = note: this compiler was built on 2026-05-18; consider upgrading it if it is out of date


thread 'rustc' (2205128) panicked at /rustc-dev/5ea817c65e4896167300b7d2550781b98da9901a/compiler/rustc_hir_analysis/src/coherence/builtin.rs:628:9:
not yet implemented: something went wrong with structurally_normalize_ty
stack backtrace:
   0:     0x7f777d08ddb9 - <<std[febbc7d5ef9e8e1f]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[aa07da85d566abbf]::fmt::Display>::fmt
   1:     0x7f777d81a888 - core[aa07da85d566abbf]::fmt::write
   2:     0x7f777d0a4aa6 - <std[febbc7d5ef9e8e1f]::sys::stdio::unix::Stderr as std[febbc7d5ef9e8e1f]::io::Write>::write_fmt
   3:     0x7f777d063dfe - std[febbc7d5ef9e8e1f]::panicking::default_hook::{closure#0}
   4:     0x7f777d081473 - std[febbc7d5ef9e8e1f]::panicking::default_hook
   5:     0x7f777be7f031 - std[febbc7d5ef9e8e1f]::panicking::update_hook::<alloc[66402de0da046d42]::boxed::Box<rustc_driver_impl[6c9a40b2ab140533]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f777d081752 - std[febbc7d5ef9e8e1f]::panicking::panic_with_hook
   7:     0x7f777d063ef4 - std[febbc7d5ef9e8e1f]::panicking::panic_handler::{closure#0}
   8:     0x7f777d05abc9 - std[febbc7d5ef9e8e1f]::sys::backtrace::__rust_end_short_backtrace::<std[febbc7d5ef9e8e1f]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f777d06592d - __rustc[280a9ea41858211c]::rust_begin_unwind
  10:     0x7f777a2d090c - core[aa07da85d566abbf]::panicking::panic_fmt
  11:     0x7f777de6db64 - rustc_hir_analysis[911523de3d691631]::coherence::builtin::check_trait
  12:     0x7f777de71ebb - rustc_hir_analysis[911523de3d691631]::coherence::coherent_trait
  13:     0x7f777de71a27 - rustc_query_impl[dc639321cf6e8af7]::query_impl::coherent_trait::invoke_provider_fn::__rust_begin_short_backtrace
  14:     0x7f777dc6bd48 - rustc_query_impl[dc639321cf6e8af7]::execution::try_execute_query::<rustc_middle[16cd8b9ebbd7d037]::query::caches::DefIdCache<rustc_middle[16cd8b9ebbd7d037]::query::erase::ErasedData<[u8; 1usize]>>, false>
  15:     0x7f777dc6ae9c - rustc_query_impl[dc639321cf6e8af7]::query_impl::coherent_trait::execute_query_non_incr::__rust_end_short_backtrace
  16:     0x7f777dd59f25 - rustc_hir_analysis[911523de3d691631]::check::check::check_item_type
  17:     0x7f777dd5641c - rustc_hir_analysis[911523de3d691631]::check::wfcheck::check_well_formed
  18:     0x7f777dd563f7 - rustc_query_impl[dc639321cf6e8af7]::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  19:     0x7f777dd559e6 - rustc_query_impl[dc639321cf6e8af7]::execution::try_execute_query::<rustc_data_structures[11d21e362a720300]::vec_cache::VecCache<rustc_span[69dba1113f30a056]::def_id::LocalDefId, rustc_middle[16cd8b9ebbd7d037]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[16cd8b9ebbd7d037]::dep_graph::graph::DepNodeIndex>, false>
  20:     0x7f777dd5577b - rustc_query_impl[dc639321cf6e8af7]::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  21:     0x7f777dd52469 - rustc_hir_analysis[911523de3d691631]::check::wfcheck::check_type_wf
  22:     0x7f777dd52379 - rustc_query_impl[dc639321cf6e8af7]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  23:     0x7f777e9b3edc - rustc_query_impl[dc639321cf6e8af7]::execution::try_execute_query::<rustc_middle[16cd8b9ebbd7d037]::query::caches::SingleCache<rustc_middle[16cd8b9ebbd7d037]::query::erase::ErasedData<[u8; 1usize]>>, false>
  24:     0x7f777e9b3cb7 - rustc_query_impl[dc639321cf6e8af7]::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  25:     0x7f777dafe2db - rustc_hir_analysis[911523de3d691631]::check_crate
  26:     0x7f777daf9c61 - rustc_interface[3e547b2b11ba9fdb]::passes::analysis
  27:     0x7f777e9b3289 - rustc_query_impl[dc639321cf6e8af7]::execution::try_execute_query::<rustc_middle[16cd8b9ebbd7d037]::query::caches::SingleCache<rustc_middle[16cd8b9ebbd7d037]::query::erase::ErasedData<[u8; 0usize]>>, false>
  28:     0x7f777e9b2f69 - rustc_query_impl[dc639321cf6e8af7]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  29:     0x7f777e9ce7cd - rustc_interface[3e547b2b11ba9fdb]::interface::run_compiler::<(), rustc_driver_impl[6c9a40b2ab140533]::run_compiler::{closure#0}>::{closure#1}
  30:     0x7f777e998740 - std[febbc7d5ef9e8e1f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3e547b2b11ba9fdb]::util::run_in_thread_with_globals<rustc_interface[3e547b2b11ba9fdb]::util::run_in_thread_pool_with_globals<rustc_interface[3e547b2b11ba9fdb]::interface::run_compiler<(), rustc_driver_impl[6c9a40b2ab140533]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  31:     0x7f777e998e2d - <std[febbc7d5ef9e8e1f]::thread::lifecycle::spawn_unchecked<rustc_interface[3e547b2b11ba9fdb]::util::run_in_thread_with_globals<rustc_interface[3e547b2b11ba9fdb]::util::run_in_thread_pool_with_globals<rustc_interface[3e547b2b11ba9fdb]::interface::run_compiler<(), rustc_driver_impl[6c9a40b2ab140533]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[aa07da85d566abbf]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7f777e999c2c - <std[febbc7d5ef9e8e1f]::sys::thread::unix::Thread>::new::thread_start
  33:     0x7f7777e9697a - <unknown>
  34:     0x7f7777f1a2bc - <unknown>
  35:                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.97.0-nightly (5ea817c65 2026-05-18) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [coherent_trait] coherence checking all impls of trait `core::marker::CoerceShared`
#1 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.rNQ0I38I4caE/rustc_testrunner_tmpdir_reporting.JFF8O9yuc3VD/mvce.rs:4:1: 4:73>` is well-formed
#2 [check_type_wf] checking that types are well-formed
#3 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.

@rustbot label +F-reborrow

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reduced a.rs reproducer and compiler/rustc_hir_analysis/src/coherence/builtin.rs around lines 622-634, then run the shown nightly rustc command with the reborrow feature. Trace the coherent_trait query and add regression coverage for this input. Done means the compiler reports an appropriate error or handles the case without an internal compiler error.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.