Skip to content

ICE in specialization_graph with bound on associated type #33187

Closed
@eefriedman

Description

@eefriedman
struct Foo<A>;

impl<A: Copy> Copy for Foo<A> where <A as Repr>::Data:Copy { }

trait Repr {
    type Data;
}

impl<A> Repr for A {
    type Data = u32;
}

fn main() {
}
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:325
stack backtrace:
   1:     0x7ff75f60f9f0 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f
   2:     0x7ff75f61d11b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
   3:     0x7ff75f61ccbc - std::panicking::default_hook::hc2c969e7453d080c
   4:     0x7ff75f5e1caf - std::sys_common::unwind::begin_unwind_inner::h30e12d15ce2b2e25
   5:     0x7ff75f5e3d98 - std::sys_common::unwind::begin_unwind_fmt::hb2de8a9968d38523
   6:     0x7ff75f60d241 - rust_begin_unwind
   7:     0x7ff75f666b3f - core::panicking::panic_fmt::h257ceb0aa351d801
   8:     0x7ff75f667638 - core::panicking::panic::h4bb1497076d04ab9
   9:     0x7ff75bff05fc - _<traits..specialize..specialization_graph..Ancestors<'a, 'tcx> as core..iter..Iterator>::next::h7147156404fb9e05
  10:     0x7ff75bff0795 - _<core..iter..FlatMap<I, U, F> as core..iter..Iterator>::next::h828d8102cc21304e
  11:     0x7ff75bfbfcfe - rustc::traits::project::assoc_ty_def::ha7b710e5cc8961da
  12:     0x7ff75bfbc38e - rustc::traits::project::opt_normalize_projection_type::hd401bc5d8f51dd72
  13:     0x7ff75bfa71a6 - rustc::traits::project::normalize_projection_type::h25faf43528a9cab3
  14:     0x7ff75be5922c - _<traits..project..AssociatedTypeNormalizer<'a, 'b, 'tcx> as ty..fold..TypeFolder<'tcx>>::fold_ty::h68ee7bafadfb4356
  15:     0x7ff75bf8d264 - rustc::ty::fold::TypeFolder::fold_substs::h3aaf2aa2e6bf8bc7
  16:     0x7ff75bf8cfb2 - rustc::ty::fold::TypeFolder::fold_trait_ref::h40721108f270d5d5
  17:     0x7ff75bf8cec5 - rustc::ty::structural_impls::_<impl ty..fold..TypeFoldable<'tcx> for ty..Predicate<'tcx>>::super_fold_with::h131e072307513cfa
  18:     0x7ff75bf8cc70 - _<collections..vec..Vec<T> as core..iter..FromIterator<T>>::from_iter::h28505a0ca1d1fa32
  19:     0x7ff75bf8c4dd - rustc::traits::project::normalize_with_depth::hc94c585f83408487
  20:     0x7ff75bf8a440 - rustc::traits::normalize_param_env_or_error::he5dcfc543f46138d
  21:     0x7ff75bfe66b5 - rustc::ty::_<impl ty..context..TyCtxt<'tcx>>::construct_parameter_environment::h39e7cc89dbbc65e8
  22:     0x7ff75bf12779 - rustc::ty::ParameterEnvironment::for_item::h60bbcc27637ed544
  23:     0x7ff75cd41e29 - rustc_typeck::coherence::CoherenceChecker::check_implementations_of_copy::_$u7b$$u7b$closure$u7d$$u7d$::h0b460e93c34c1f3b
  24:     0x7ff75cc3f707 - rustc_typeck::coherence::check_coherence::hf9aadc549bfbd78c
  25:     0x7ff75cc383b4 - rustc_typeck::check_crate::hb08ba31a6a5f65b5
  26:     0x7ff75fb6b6b0 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::h5a042a091cd7658c
  27:     0x7ff75fb69798 - rustc::ty::context::TyCtxt::create_and_enter::h3f9051bcccbd93e4
  28:     0x7ff75fb661ae - rustc_driver::driver::phase_3_run_analysis_passes::h9c723484c588a35b
  29:     0x7ff75fb387af - rustc_driver::driver::compile_input::h0629572e6f316b31
  30:     0x7ff75fb203e4 - rustc_driver::run_compiler::h8902aebf8b1849a8
  31:     0x7ff75fb1d851 - std::sys_common::unwind::try::try_fn::h4c74456035d0fcc7
  32:     0x7ff75f60d1cb - __rust_try
  33:     0x7ff75f60d15d - std::sys_common::unwind::inner_try::h47a4d9cd4a369dcd
  34:     0x7ff75fb1e09a - _<F as std..boxed..FnBox<A>>::call_box::h27f542a39f1d61ef
  35:     0x7ff75f61b2b4 - std::sys::thread::Thread::new::thread_start::h6f266e069bf4ec2b
  36:     0x7ff757437423 - start_thread
  37:     0x7ff75f279cbc - clone
  38:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-specializationArea: Trait impl specializationI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions