Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: 🌲 not implemented: NormalizationFailure(Alias(Projection, AliasTy... #130413

Closed
matthiaskrgr opened this issue Sep 15, 2024 · 4 comments · Fixed by #131112
Closed

ICE: 🌲 not implemented: NormalizationFailure(Alias(Projection, AliasTy... #130413

matthiaskrgr opened this issue Sep 15, 2024 · 4 comments · Fixed by #131112
Assignees
Labels
C-bug Category: This is a bug. F-transmutability `#![feature(transmutability)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Sep 15, 2024

auto-reduced (treereduce-rust):

trait Xxx {}

trait Yyy: Xxx {}

trait Aaa {
    type Y: Yyy;
}

trait Bbb {
    type B: for<'a> std::mem::TransmuteFrom<(), ()>;
}

impl<T> Bbb for T
where
    T: Aaa,
    _9F::Y:,
{
    type B = T::Y;
}

original:

trait Www {
    type W;
}

trait Xxx: Www<W = Self::X> {
    type X;
}

trait Yyy: Xxx {}

trait Zzz<'a>: Yyy + Xxx<X = Self::Z> {
    type Z;
}

trait Aaa {
    type Y: Yyy;
}

trait Bbb: Aaa<Y = Self::B> {
    type B: for<'a> std::mem::TransmuteFrom<(), ()>;
}

impl<T> Bbb for T
where
    T: Aaa,
    _9F::Y: for<'a> Zzz<'t>,
{
    type B = T::Y;
}

pub fn main() {}

Version information

rustc 1.83.0-nightly (8c2c9a9ef 2024-09-15)
binary: rustc
commit-hash: 8c2c9a9ef527edb453bcee638d34beb0e7b4616b
commit-date: 2024-09-15
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

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

Program output

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.R0GRNNzkiwFC/rustc_testrunner_tmpdir_reporting.Cp4fKl735t3r/mvce.rs:19:2
   |
19 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.R0GRNNzkiwFC/rustc_testrunner_tmpdir_reporting.Cp4fKl735t3r/mvce.rs`

error[E0658]: use of unstable library feature 'transmutability'
  --> /tmp/icemaker_global_tempdir.R0GRNNzkiwFC/rustc_testrunner_tmpdir_reporting.Cp4fKl735t3r/mvce.rs:10:21
   |
10 |     type B: for<'a> std::mem::TransmuteFrom<(), ()>;
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
   = help: add `#![feature(transmutability)]` to the crate attributes to enable
   = note: this compiler was built on 2024-09-15; consider upgrading it if it is out of date

error[E0747]: type provided when a constant was expected
  --> /tmp/icemaker_global_tempdir.R0GRNNzkiwFC/rustc_testrunner_tmpdir_reporting.Cp4fKl735t3r/mvce.rs:10:49
   |
10 |     type B: for<'a> std::mem::TransmuteFrom<(), ()>;
   |                                                 ^^

thread 'rustc' panicked at compiler/rustc_transmute/src/layout/tree.rs:201:24:
not implemented: NormalizationFailure(Alias(Projection, AliasTy { args: [T/#0], def_id: DefId(0:6 ~ mvce[023b]::Aaa::Y), .. }), Type(Alias(Projection, AliasTy { args: [T/#0], def_id: DefId(0:6 ~ mvce[023b]::Aaa::Y), .. })))
stack backtrace:
   0:     0x711b5d46c1da - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf576e3db34dcd4c0
   1:     0x711b5dc03297 - core::fmt::write::h6031a1fcd647db63
   2:     0x711b5eb10373 - std::io::Write::write_fmt::h9c4d18eebfa610c9
   3:     0x711b5d46c032 - std::sys::backtrace::BacktraceLock::print::hd5d6f94195a58c57
   4:     0x711b5d46e7b1 - std::panicking::default_hook::{{closure}}::he12b6c1c70a494ea
   5:     0x711b5d46e5e4 - std::panicking::default_hook::h79139f377ef49e73
   6:     0x711b5c57090f - std[1fc20c4bf4345a88]::panicking::update_hook::<alloc[31ea272c46cb0a00]::boxed::Box<rustc_driver_impl[bd499d3fdd772cd8]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x711b5d46eed8 - std::panicking::rust_panic_with_hook::hb2e822dcfa6f992d
   8:     0x711b5d46eca7 - std::panicking::begin_panic_handler::{{closure}}::h009211ca5b32b3da
   9:     0x711b5d46c689 - std::sys::backtrace::__rust_end_short_backtrace::h3f6b2521411fe228
  10:     0x711b5d46e974 - rust_begin_unwind
  11:     0x711b5a293d23 - core::panicking::panic_fmt::hfae13f2be10fd19a
  12:     0x711b5d3aad20 - <rustc_transmute[68be87005f1b188a]::layout::tree::rustc::Err as core[72d89f67a2ed16cb]::convert::From<&rustc_middle[75f727fe079a4f22]::ty::layout::LayoutError>>::from
  13:     0x711b5d3aaea4 - <rustc_transmute[68be87005f1b188a]::layout::tree::Tree<rustc_transmute[68be87005f1b188a]::layout::rustc::Def, rustc_transmute[68be87005f1b188a]::layout::rustc::Ref>>::from_ty
  14:     0x711b5d3afd0a - <rustc_transmute[68be87005f1b188a]::rustc::TransmuteTypeEnv>::is_transmutable
  15:     0x711b5d2b5111 - <rustc_trait_selection[fd550b6f72b0e0c6]::error_reporting::TypeErrCtxt>::get_safe_transmute_error_and_reason
  16:     0x711b5d2a7b61 - <rustc_trait_selection[fd550b6f72b0e0c6]::error_reporting::TypeErrCtxt>::report_selection_error
  17:     0x711b5d325d5b - <rustc_trait_selection[fd550b6f72b0e0c6]::error_reporting::TypeErrCtxt>::report_fulfillment_error
  18:     0x711b5d2ee2b7 - <rustc_trait_selection[fd550b6f72b0e0c6]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  19:     0x711b5e26b4e6 - rustc_hir_analysis[f9d0127424903d94]::check::compare_impl_item::check_type_bounds
  20:     0x711b5a055544 - rustc_hir_analysis[f9d0127424903d94]::check::check::check_impl_items_against_trait
  21:     0x711b5b337482 - rustc_hir_analysis[f9d0127424903d94]::check::wfcheck::check_well_formed
  22:     0x711b5e11a3c7 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[75f727fe079a4f22]::query::erase::Erased<[u8; 1usize]>>
  23:     0x711b5e11a63e - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::<rustc_query_impl[85a0e4e3d1ea5e51]::DynamicConfig<rustc_query_system[5ff4688cf420f9ff]::query::caches::VecCache<rustc_hir[bda7baf23f46ef3e]::hir_id::OwnerId, rustc_middle[75f727fe079a4f22]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false>
  24:     0x711b5e11a3a2 - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  25:     0x711b5e11b153 - rustc_hir_analysis[f9d0127424903d94]::check::wfcheck::check_mod_type_wf
  26:     0x711b5e11af91 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[75f727fe079a4f22]::query::erase::Erased<[u8; 1usize]>>
  27:     0x711b5eaaa5bb - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::<rustc_query_impl[85a0e4e3d1ea5e51]::DynamicConfig<rustc_query_system[5ff4688cf420f9ff]::query::caches::DefaultCache<rustc_span[a0fd5433b72e73f5]::def_id::LocalModDefId, rustc_middle[75f727fe079a4f22]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false>
  28:     0x711b5eaaa36d - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  29:     0x711b5e073a49 - rustc_hir_analysis[f9d0127424903d94]::check_crate
  30:     0x711b5e070705 - rustc_interface[21c67170a9071fc5]::passes::run_required_analyses
  31:     0x711b5e9166de - rustc_interface[21c67170a9071fc5]::passes::analysis
  32:     0x711b5e9166b1 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[75f727fe079a4f22]::query::erase::Erased<[u8; 1usize]>>
  33:     0x711b5eaae22e - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::<rustc_query_impl[85a0e4e3d1ea5e51]::DynamicConfig<rustc_query_system[5ff4688cf420f9ff]::query::caches::SingleCache<rustc_middle[75f727fe079a4f22]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false>
  34:     0x711b5eaadf8f - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  35:     0x711b5e900bbc - rustc_interface[21c67170a9071fc5]::interface::run_compiler::<core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>, rustc_driver_impl[bd499d3fdd772cd8]::run_compiler::{closure#0}>::{closure#1}
  36:     0x711b5e9c8850 - std[1fc20c4bf4345a88]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[21c67170a9071fc5]::util::run_in_thread_with_globals<rustc_interface[21c67170a9071fc5]::util::run_in_thread_pool_with_globals<rustc_interface[21c67170a9071fc5]::interface::run_compiler<core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>, rustc_driver_impl[bd499d3fdd772cd8]::run_compiler::{closure#0}>::{closure#1}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#0}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>
  37:     0x711b5e9c8eba - <<std[1fc20c4bf4345a88]::thread::Builder>::spawn_unchecked_<rustc_interface[21c67170a9071fc5]::util::run_in_thread_with_globals<rustc_interface[21c67170a9071fc5]::util::run_in_thread_pool_with_globals<rustc_interface[21c67170a9071fc5]::interface::run_compiler<core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>, rustc_driver_impl[bd499d3fdd772cd8]::run_compiler::{closure#0}>::{closure#1}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#0}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#1} as core[72d89f67a2ed16cb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x711b5e9c92ab - std::sys::pal::unix::thread::Thread::new::thread_start::hfd4e0f9214174c65
  39:     0x711b601ef39d - <unknown>
  40:     0x711b6027449c - <unknown>
  41:                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.83.0-nightly (8c2c9a9ef 2024-09-15) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.R0GRNNzkiwFC/rustc_testrunner_tmpdir_reporting.Cp4fKl735t3r/mvce.rs:13:1: 16:13>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
end of query stack
error[E0433]: failed to resolve: use of undeclared crate or module `_9F`
  --> /tmp/icemaker_global_tempdir.R0GRNNzkiwFC/rustc_testrunner_tmpdir_reporting.Cp4fKl735t3r/mvce.rs:16:5
   |
16 |     _9F::Y:,
   |     ^^^ use of undeclared crate or module `_9F`

error: aborting due to 4 previous errors

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

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Sep 15, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 15, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: not implemented: NormalizationFailure(Alias(Projection, AliasTy... ICE: 🌲 not implemented: NormalizationFailure(Alias(Projection, AliasTy... Sep 15, 2024
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2024-08-22
seems to bisect to #129364

@cyrgani
Copy link
Contributor

cyrgani commented Sep 16, 2024

Slightly more reduction:

#![feature(transmutability)]
trait Aaa {
    type Y;
}

trait Bbb {
    type B: std::mem::TransmuteFrom<()>;
}

impl<T> Bbb for T
where
    T: Aaa,
{
    type B = T::Y;
}

@saethlin saethlin added the F-transmutability `#![feature(transmutability)]` label Sep 18, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Sep 18, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 18, 2024
@jieyouxu
Copy link
Member

Slightly more reduction:

(Note that this reduction should drop the feature gate, as this ICEs without the feature gate)

@jswrenn
Copy link
Member

jswrenn commented Sep 27, 2024

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 3, 2024
TransmuteFrom: Gracefully handle unnormalized types and normalization errors

~~Refactor to share code between `TransmuteFrom`'s trait selection and error reporting code paths. Additionally normalizes the source and destination types, and gracefully handles normalization errors.~~

Fixes rust-lang#130413

r​? `@compiler-errors`
@bors bors closed this as completed in 5b1a2b8 Oct 4, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 4, 2024
Rollup merge of rust-lang#131112 - jswrenn:fix-130413, r=compiler-errors

TransmuteFrom: Gracefully handle unnormalized types and normalization errors

~~Refactor to share code between `TransmuteFrom`'s trait selection and error reporting code paths. Additionally normalizes the source and destination types, and gracefully handles normalization errors.~~

Fixes rust-lang#130413

r​? `@compiler-errors`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-transmutability `#![feature(transmutability)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants