Skip to content

ICE: deeply_normalize should not be called with pending obligations #133868

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

Closed
matthiaskrgr opened this issue Dec 4, 2024 · 6 comments · Fixed by #140021
Closed

ICE: deeply_normalize should not be called with pending obligations #133868

matthiaskrgr opened this issue Dec 4, 2024 · 6 comments · Fixed by #140021
Assignees
Labels
C-bug Category: This is a bug. 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. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

pub trait TraitA {
    type AssocB = T;
}
pub trait TraitB {
    type AssocB;
}

pub trait MethodTrait {
    fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a>;
}

impl<T: TraitB> MethodTrait for T
where
    <T::AssocB as TraitA>::AssocB: TraitA,
{
    // }
    fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> {}
}
original code

original:

pub struct Wrapper<T>(T);
struct Struct;

pub trait TraitA {
    type AssocB = T;
}
pub trait TraitB {
    type AssocB;
}

pub fn helper(v: impl MethodTrait) {
    // monomorphization instantiates something it then normalizes to:
    //
    // Closure(
    //   DefId(0:27 ~ unnamed_1[00e7]::{impl#0}::method::{closure#0}),
    //   [
    // must be a method (through Self), the example below doesn't work (as a standalone function)
    //     i16,
    //     Binder {
    //       value: extern "RustCall" fn((&'^0 (),)) -> Alias(Projection, AliasTy { args: [StructX, '^0], def_id: DefId(0:10 ~ unnamed_1[00e7]::TraitA::AssocA), .. }),
    //       bound_vars: [Region(BrAnon)]
    //     },
    //     ()
    //   ]
    // ),
    //
    // This should be completely normalized but isn't.
    // so, normalizing again gives (StructX is inserted) for
    // Alias(Projection, AliasTy { args: [StructX, '^0], def_id: DefId(0:10 ~ unnamed_1[00e7]::TraitA::AssocA), .. })
    //
    // Closure(
    //   DefId(0:27 ~ unnamed_1[00e7]::{impl#0}::method::{closure#0}),
    pub struct Wrapper<T>(T);
    //     Wrapper1<StructX>,
    //     i16,
    //     Binder {
    //       value: extern "RustCall" fn((&'^0 (),)) -> StructX, bound_vars: [Region(BrAnon)]
    //     },
    //     ()
    //   ]
    // ).
    let _local_that_causes_ice = v.method();
}

pub fn main() {
    helper(WrapperT::AssocB as TraitA);
}

pub trait MethodTrait {
    type Assoc<'a>;

    fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a>;
}

impl<T: TraitB> MethodTrait for T
where
    <T::AssocB as TraitA>::AssocB: TraitA,
{
    type Assoc<'a> = <T::AssocB as TraitA>::AssocA<'t>;

    // must be a method (through Self), the example below doesn't work (as a standalone function)
    // fn helper2<M: MethodTrait>(_v: M) -> impl for<'a> FnMut(&'a ()) -> M::Assoc<'a> {
    //    move |_| loop {}
    // }
    fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> {
        move |_| loop {}
    }
}

impl<T, B> TraitB for Wrapper<B>
where
    B: TraitB<AssocB = T>,
{
    type AssocB = T;
}

impl TraitB for Struct {
    type AssocB = Struct;
}

impl TraitA for Struct {
    type AssocA<'t> = Self;
}

Version information

rustc 1.85.0-nightly (96e51d948 2024-12-04)
binary: rustc
commit-hash: 96e51d9482405e400dec53750f3b263d45784ada
commit-date: 2024-12-04
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5

Possibly related line of code:

{
if self.infcx.next_trait_solver() {
crate::solve::deeply_normalize(self, value)
} else {
if fulfill_cx.has_pending_obligations() {
let pending_obligations = fulfill_cx.pending_obligations();
span_bug!(
pending_obligations[0].cause.span,
"deeply_normalize should not be called with pending obligations: \
{pending_obligations:#?}"
);
}
let value = self

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

Program output

error[E0412]: cannot find type `T` in this scope
 --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:2:19
  |
2 |     type AssocB = T;
  |                   ^ not found in this scope

error[E0658]: associated type defaults are unstable
 --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:2:5
  |
2 |     type AssocB = T;
  |     ^^^^^^^^^^^^^^^^
  |
  = note: see issue #29661 <https://github.com/rust-lang/rust/issues/29661> for more information
  = help: add `#![feature(associated_type_defaults)]` to the crate attributes to enable
  = note: this compiler was built on 2024-12-04; consider upgrading it if it is out of date

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

error[E0277]: the trait bound `<T as TraitB>::AssocB: TraitA` is not satisfied
  --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:17:5
   |
17 |     fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitA` is not implemented for `<T as TraitB>::AssocB`
   |
help: consider further restricting the associated type
   |
17 |     fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> where <T as TraitB>::AssocB: TraitA {}
   |                                                                      +++++++++++++++++++++++++++++++++++

error[E0220]: associated type `Assoc` not found for `Self`
 --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:9:60
  |
9 |     fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a>;
  |                                                            ^^^^^ associated type `Assoc` not found

error[E0220]: associated type `Assoc` not found for `Self`
  --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:17:60
   |
17 |     fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> {}
   |                                                            ^^^^^ associated type `Assoc` not found

error[E0277]: the trait bound `<T as TraitB>::AssocB: TraitA` is not satisfied
  --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:17:24
   |
17 |     fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> {}
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitA` is not implemented for `<T as TraitB>::AssocB`
   |
help: consider further restricting the associated type
   |
17 |     fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> where <T as TraitB>::AssocB: TraitA {}
   |                                                                      +++++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `<T as TraitB>::AssocB: TraitA` is not satisfied
  --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:12:1
   |
12 | / impl<T: TraitB> MethodTrait for T
13 | | where
14 | |     <T::AssocB as TraitA>::AssocB: TraitA,
   | |__________________________________________^ the trait `TraitA` is not implemented for `<T as TraitB>::AssocB`
   |
help: consider further restricting the associated type
   |
14 |     <T::AssocB as TraitA>::AssocB: TraitA, <T as TraitB>::AssocB: TraitA
   |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0277]: the trait bound `<T as TraitB>::AssocB: TraitA` is not satisfied
  --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:12:1
   |
12 | / impl<T: TraitB> MethodTrait for T
13 | | where
14 | |     <T::AssocB as TraitA>::AssocB: TraitA,
15 | | {
16 | |     // }
17 | |     fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> {}
18 | | }
   | |_^ the trait `TraitA` is not implemented for `<T as TraitB>::AssocB`
   |
help: consider further restricting the associated type
   |
14 |     <T::AssocB as TraitA>::AssocB: TraitA, <T as TraitB>::AssocB: TraitA
   |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0277]: the trait bound `<T as TraitB>::AssocB: TraitA` is not satisfied
  --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:17:24
   |
17 |     fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> {}
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitA` is not implemented for `<T as TraitB>::AssocB`
   |
help: consider further restricting the associated type
   |
14 |     <T::AssocB as TraitA>::AssocB: TraitA, <T as TraitB>::AssocB: TraitA
   |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: internal compiler error: compiler/rustc_trait_selection/src/traits/normalize.rs:69:17: deeply_normalize should not be called with pending obligations: [
                                    Obligation(predicate=Binder { value: TraitPredicate(<_ as TraitA>, polarity:Positive), bound_vars: [] }, depth=1),
                                ]
 --> /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:9:24
  |
9 |     fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a>;
  |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/normalize.rs:69:17:
Box<dyn Any>
stack backtrace:
   0:     0x7f404913b59a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7d5d2ef8548ea862
   1:     0x7f4049813e26 - core::fmt::write::hc7f1fcf2cd4d0b24
   2:     0x7f404a7f4751 - std::io::Write::write_fmt::h5dae3cf637b1b14c
   3:     0x7f404913b3f2 - std::sys::backtrace::BacktraceLock::print::h603d5439a4d48e27
   4:     0x7f404913d91a - std::panicking::default_hook::{{closure}}::h317c28a5ebbd850f
   5:     0x7f404913d763 - std::panicking::default_hook::h0f4f8ead395a2965
   6:     0x7f40482bbb88 - std[b886acd6fb60b0a8]::panicking::update_hook::<alloc[e4e71b9a99f0d22f]::boxed::Box<rustc_driver_impl[c07627fafa57377e]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7f404913e0d8 - std::panicking::rust_panic_with_hook::he1329bac1e03080f
   8:     0x7f40482f10a1 - std[b886acd6fb60b0a8]::panicking::begin_panic::<rustc_errors[c4cb0ec99f59abcb]::ExplicitBug>::{closure#0}
   9:     0x7f40482e6246 - std[b886acd6fb60b0a8]::sys::backtrace::__rust_end_short_backtrace::<std[b886acd6fb60b0a8]::panicking::begin_panic<rustc_errors[c4cb0ec99f59abcb]::ExplicitBug>::{closure#0}, !>
  10:     0x7f40482e2d29 - std[b886acd6fb60b0a8]::panicking::begin_panic::<rustc_errors[c4cb0ec99f59abcb]::ExplicitBug>
  11:     0x7f40482fb041 - <rustc_errors[c4cb0ec99f59abcb]::diagnostic::BugAbort as rustc_errors[c4cb0ec99f59abcb]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7f404884f8bc - <rustc_errors[c4cb0ec99f59abcb]::DiagCtxtHandle>::span_bug::<rustc_span[5535563d387a33e2]::span_encoding::Span, alloc[e4e71b9a99f0d22f]::string::String>
  13:     0x7f40488e2227 - rustc_middle[67be29f945e3ecf0]::util::bug::opt_span_bug_fmt::<rustc_span[5535563d387a33e2]::span_encoding::Span>::{closure#0}
  14:     0x7f40488ca74a - rustc_middle[67be29f945e3ecf0]::ty::context::tls::with_opt::<rustc_middle[67be29f945e3ecf0]::util::bug::opt_span_bug_fmt<rustc_span[5535563d387a33e2]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  15:     0x7f40488ca5db - rustc_middle[67be29f945e3ecf0]::ty::context::tls::with_context_opt::<rustc_middle[67be29f945e3ecf0]::ty::context::tls::with_opt<rustc_middle[67be29f945e3ecf0]::util::bug::opt_span_bug_fmt<rustc_span[5535563d387a33e2]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  16:     0x7f404738acf7 - rustc_middle[67be29f945e3ecf0]::util::bug::span_bug_fmt::<rustc_span[5535563d387a33e2]::span_encoding::Span>
  17:     0x7f4049b83090 - <rustc_trait_selection[8b7799daf48e843f]::traits::engine::ObligationCtxt<rustc_trait_selection[8b7799daf48e843f]::traits::FulfillmentError>>::assumed_wf_types_and_report_errors
  18:     0x7f404a004b26 - rustc_hir_analysis[e6847c1464713c9a]::check::compare_impl_item::check_type_bounds
  19:     0x7f404a22849d - rustc_hir_analysis[e6847c1464713c9a]::check::compare_impl_item::compare_impl_item
  20:     0x7f404a225dd1 - rustc_query_impl[d2f5d943c2280edc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d2f5d943c2280edc]::query_impl::compare_impl_item::dynamic_query::{closure#2}::{closure#0}, rustc_middle[67be29f945e3ecf0]::query::erase::Erased<[u8; 1usize]>>
  21:     0x7f404a1cf730 - rustc_query_system[254f9b8bf6b2b5ec]::query::plumbing::try_execute_query::<rustc_query_impl[d2f5d943c2280edc]::DynamicConfig<rustc_data_structures[d98f95e3c765a7d0]::vec_cache::VecCache<rustc_span[5535563d387a33e2]::def_id::LocalDefId, rustc_middle[67be29f945e3ecf0]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[254f9b8bf6b2b5ec]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[d2f5d943c2280edc]::plumbing::QueryCtxt, false>
  22:     0x7f404a1cf201 - rustc_query_impl[d2f5d943c2280edc]::query_impl::compare_impl_item::get_query_non_incr::__rust_end_short_backtrace
  23:     0x7f4045dbbf66 - rustc_hir_analysis[e6847c1464713c9a]::check::check::check_item_type
  24:     0x7f40471754b4 - rustc_hir_analysis[e6847c1464713c9a]::check::wfcheck::check_well_formed
  25:     0x7f404a1cf487 - rustc_query_impl[d2f5d943c2280edc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d2f5d943c2280edc]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[67be29f945e3ecf0]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7f404a1cf748 - rustc_query_system[254f9b8bf6b2b5ec]::query::plumbing::try_execute_query::<rustc_query_impl[d2f5d943c2280edc]::DynamicConfig<rustc_data_structures[d98f95e3c765a7d0]::vec_cache::VecCache<rustc_span[5535563d387a33e2]::def_id::LocalDefId, rustc_middle[67be29f945e3ecf0]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[254f9b8bf6b2b5ec]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[d2f5d943c2280edc]::plumbing::QueryCtxt, false>
  27:     0x7f404a1cf462 - rustc_query_impl[d2f5d943c2280edc]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f404a1d01ec - rustc_hir_analysis[e6847c1464713c9a]::check::wfcheck::check_mod_type_wf
  29:     0x7f404a1d000b - rustc_query_impl[d2f5d943c2280edc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d2f5d943c2280edc]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[67be29f945e3ecf0]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7f404a62b784 - rustc_query_system[254f9b8bf6b2b5ec]::query::plumbing::try_execute_query::<rustc_query_impl[d2f5d943c2280edc]::DynamicConfig<rustc_query_system[254f9b8bf6b2b5ec]::query::caches::DefaultCache<rustc_span[5535563d387a33e2]::def_id::LocalModDefId, rustc_middle[67be29f945e3ecf0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d2f5d943c2280edc]::plumbing::QueryCtxt, false>
  31:     0x7f404a62b518 - rustc_query_impl[d2f5d943c2280edc]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f4049ac9adc - rustc_hir_analysis[e6847c1464713c9a]::check_crate
  33:     0x7f404a13a57c - rustc_interface[14bb8bd49e3c2011]::passes::run_required_analyses
  34:     0x7f404a3cfd5e - rustc_interface[14bb8bd49e3c2011]::passes::analysis
  35:     0x7f404a3cfd2f - rustc_query_impl[d2f5d943c2280edc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d2f5d943c2280edc]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[67be29f945e3ecf0]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7f404a7bc37a - rustc_query_system[254f9b8bf6b2b5ec]::query::plumbing::try_execute_query::<rustc_query_impl[d2f5d943c2280edc]::DynamicConfig<rustc_query_system[254f9b8bf6b2b5ec]::query::caches::SingleCache<rustc_middle[67be29f945e3ecf0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d2f5d943c2280edc]::plumbing::QueryCtxt, false>
  37:     0x7f404a7bc04e - rustc_query_impl[d2f5d943c2280edc]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f404a88c239 - rustc_interface[14bb8bd49e3c2011]::interface::run_compiler::<core[dd48f16c736a3ea3]::result::Result<(), rustc_span[5535563d387a33e2]::ErrorGuaranteed>, rustc_driver_impl[c07627fafa57377e]::run_compiler::{closure#0}>::{closure#1}
  39:     0x7f404a71a3c7 - std[b886acd6fb60b0a8]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[14bb8bd49e3c2011]::util::run_in_thread_with_globals<rustc_interface[14bb8bd49e3c2011]::util::run_in_thread_pool_with_globals<rustc_interface[14bb8bd49e3c2011]::interface::run_compiler<core[dd48f16c736a3ea3]::result::Result<(), rustc_span[5535563d387a33e2]::ErrorGuaranteed>, rustc_driver_impl[c07627fafa57377e]::run_compiler::{closure#0}>::{closure#1}, core[dd48f16c736a3ea3]::result::Result<(), rustc_span[5535563d387a33e2]::ErrorGuaranteed>>::{closure#0}, core[dd48f16c736a3ea3]::result::Result<(), rustc_span[5535563d387a33e2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dd48f16c736a3ea3]::result::Result<(), rustc_span[5535563d387a33e2]::ErrorGuaranteed>>
  40:     0x7f404a71a062 - <<std[b886acd6fb60b0a8]::thread::Builder>::spawn_unchecked_<rustc_interface[14bb8bd49e3c2011]::util::run_in_thread_with_globals<rustc_interface[14bb8bd49e3c2011]::util::run_in_thread_pool_with_globals<rustc_interface[14bb8bd49e3c2011]::interface::run_compiler<core[dd48f16c736a3ea3]::result::Result<(), rustc_span[5535563d387a33e2]::ErrorGuaranteed>, rustc_driver_impl[c07627fafa57377e]::run_compiler::{closure#0}>::{closure#1}, core[dd48f16c736a3ea3]::result::Result<(), rustc_span[5535563d387a33e2]::ErrorGuaranteed>>::{closure#0}, core[dd48f16c736a3ea3]::result::Result<(), rustc_span[5535563d387a33e2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dd48f16c736a3ea3]::result::Result<(), rustc_span[5535563d387a33e2]::ErrorGuaranteed>>::{closure#1} as core[dd48f16c736a3ea3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7f404a7197ab - std::sys::pal::unix::thread::Thread::new::thread_start::h7cc6adb00f817196
  42:     0x7f4044a6a39d - <unknown>
  43:     0x7f4044aef49c - <unknown>
  44:                0x0 - <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.85.0-nightly (96e51d948 2024-12-04) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [compare_impl_item] checking assoc item `<impl at /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:12:1: 14:43>::{synthetic#0}` is compatible with trait definition
#1 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.oqycY4Xka193/rustc_testrunner_tmpdir_reporting.FxaXXxPy3JEq/mvce.rs:12:1: 14:43>` is well-formed
end of query stack
error: aborting due to 11 previous errors

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

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. 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. labels Dec 4, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 4, 2024
@matthiaskrgr
Copy link
Member Author

mvce

trait a {
    type b;
}
trait c {
    fn d->impl
}
impl<e> c e 
where<e as a>::b: a { 
    fn d
}

@compiler-errors
Copy link
Member

@matthiaskrgr: That's not an MCVE. That's "i'm trying to make a test with the minimal amount of tokens", but I'm certain I've noted before that such tests are actually significantly worse than minimizing it conceptually (which is a task that actually requires some puzzle solving to do, rather than just getting a machine to do it). a test that has minimal tokens introduces a bunch of unrelated parser errors and is a bad candidate for a ui test, frankly.

@matthiaskrgr
Copy link
Member Author

MUTS? (minimum unviable token set)? 🙈

@compiler-errors
Copy link
Member

A less esoteric MCVE:

trait Foo {
    type Assoc;
}

trait Bar {
    fn method() -> impl Sized;
}
impl<T> Bar for T where <T as Foo>::Assoc: Sized
 { 
    fn method() {}
}

@compiler-errors compiler-errors self-assigned this Dec 4, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 4, 2024
@jieyouxu jieyouxu added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Dec 5, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Dec 14, 2024
@cuviper
Copy link
Member

cuviper commented Apr 18, 2025

@compiler-errors
Copy link
Member

I put up #140021 to fix the ICE, but I don't believe we should need to backport this given that the regressed crate doesn't even compile on stable.

bors added a commit to rust-lang-ci/rust that referenced this issue Apr 20, 2025
…lcnr

Don't ICE on pending obligations from deep normalization in a loop

See the comment I left inline in `compiler/rustc_trait_selection/src/traits/normalize.rs`.

Fixes rust-lang#133868

r? lcnr
jhpratt added a commit to jhpratt/rust that referenced this issue Apr 21, 2025
…r=lcnr

Don't ICE on pending obligations from deep normalization in a loop

See the comment I left inline in `compiler/rustc_trait_selection/src/traits/normalize.rs`.

Fixes rust-lang#133868

r? lcnr
@bors bors closed this as completed in f79eef9 Apr 21, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 21, 2025
Rollup merge of rust-lang#140021 - compiler-errors:no-deep-norm-ice, r=lcnr

Don't ICE on pending obligations from deep normalization in a loop

See the comment I left inline in `compiler/rustc_trait_selection/src/traits/normalize.rs`.

Fixes rust-lang#133868

r? lcnr
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Apr 22, 2025
Don't ICE on pending obligations from deep normalization in a loop

See the comment I left inline in `compiler/rustc_trait_selection/src/traits/normalize.rs`.

Fixes rust-lang/rust#133868

r? lcnr
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. 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. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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