Skip to content

ICE: with_negative_coherence: None in compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:483:43 #119381

@matthiaskrgr

Description

@matthiaskrgr
Member

even shorter repro:

#![feature(with_negative_coherence)]

struct GenericStruct<const MY_NUM: usize> {
    val: i64,
}

impl<const T: u128> From<GenericStruct<T>> for GenericStruct<{}> {}

auto-reduced (treereduce-rust):

#[derive(Copy)]
struct S<const N: [f32; N]>();

#[derive(Copy)]
struct S<const N: usize>([f32; N]);

#![feature(with_negative_coherence)]

original:

#![crate_type = "lib"]
#![feature(min_specialization)]

#[derive(Copy)]
struct S<const N: [f32; N]>([f32; f32N]);

#[derive(Copy)]
struct S<const N: usize>([f32; N]);

Version information

rustc 1.77.0-nightly (f4d794ea0 2023-12-28)
binary: rustc
commit-hash: f4d794ea0b845413344621d89f6c945062748485
commit-date: 2023-12-28
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(with_negative_coherence)

Program output

error[E0428]: the name `S` is defined multiple times
 --> /tmp/icemaker_global_tempdir.dEdA4AEPEHqR/rustc_testrunner_tmpdir_reporting.Tcz7KehpgNJH/mvce.rs:5:1
  |
2 | struct S<const N: [f32; N]>();
  | ------------------------------ previous definition of the type `S` here
...
5 | struct S<const N: usize>([f32; N]);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `S` redefined here
  |
  = note: `S` must be defined only once in the type namespace of this module

error[E0770]: the type of const parameters must not depend on other generic parameters
 --> /tmp/icemaker_global_tempdir.dEdA4AEPEHqR/rustc_testrunner_tmpdir_reporting.Tcz7KehpgNJH/mvce.rs:2:25
  |
2 | struct S<const N: [f32; N]>();
  |                         ^ the type must not depend on the parameter `N`
  |
  = note: const parameters may not be used in the type of const parameters

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.dEdA4AEPEHqR/rustc_testrunner_tmpdir_reporting.Tcz7KehpgNJH/mvce.rs:5:36
  |
5 | struct S<const N: usize>([f32; N]);compiler/rustc_infer/src/infer/canonical/canonicalizer.rs
  |                                    ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.dEdA4AEPEHqR/rustc_testrunner_tmpdir_reporting.Tcz7KehpgNJH/mvce.rs`

thread 'rustc' panicked at compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:483:43:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7f0271780756 - std::backtrace_rs::backtrace::libunwind::trace::h3a8e5867b01d1b80
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f0271780756 - std::backtrace_rs::backtrace::trace_unsynchronized::he397ef0e45adff5d
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0271780756 - std::sys_common::backtrace::_print_fmt::h25cea7a1fa724fb5
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f0271780756 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hda7577428151df9d
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f02717d3080 - core::fmt::rt::Argument::fmt::hb2ec9e184bf02ba0
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/core/src/fmt/rt.rs:142:9
   5:     0x7f02717d3080 - core::fmt::write::h3465386ebc0a8978
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f027177449f - std::io::Write::write_fmt::hd97c5a975dde240c
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/io/mod.rs:1810:15
   7:     0x7f0271780534 - std::sys_common::backtrace::_print::h40f73d3c1d514bff
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f0271780534 - std::sys_common::backtrace::print::h52313c48a0b47ef2
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f02717832c7 - std::panicking::default_hook::{{closure}}::haa180c42e4a369b8
  10:     0x7f0271783029 - std::panicking::default_hook::h2608c79ece8d0d38
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/panicking.rs:292:9
  11:     0x7f026e554c5c - std[3786b4fe60d6306f]::panicking::update_hook::<alloc[3092222d4273bb6b]::boxed::Box<rustc_driver_impl[5c34c1e050da57aa]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f0271783a16 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb87a29f68be8c251
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/alloc/src/boxed.rs:2029:9
  13:     0x7f0271783a16 - std::panicking::rust_panic_with_hook::h184b82fc904f3d9c
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/panicking.rs:783:13
  14:     0x7f0271783729 - std::panicking::begin_panic_handler::{{closure}}::h67db85fa17afc73b
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/panicking.rs:649:13
  15:     0x7f0271780c56 - std::sys_common::backtrace::__rust_end_short_backtrace::h8eaebecb966c644a
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f02717834c0 - rust_begin_unwind
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/panicking.rs:645:5
  17:     0x7f02717cf785 - core::panicking::panic_fmt::hd644558ff883b3e1
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/core/src/panicking.rs:72:14
  18:     0x7f02717cf843 - core::panicking::panic::h2d0706ee0b925e5e
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/core/src/panicking.rs:144:5
  19:     0x7f026fb8443a - <rustc_infer[c0adb274575b21bc]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[c1725dac3fe0073f]::fold::TypeFolder<rustc_middle[f757abec48a5eb78]::ty::context::TyCtxt>>::fold_const
  20:     0x7f026e7cd0e1 - <rustc_middle[f757abec48a5eb78]::ty::Clause as rustc_type_ir[c1725dac3fe0073f]::fold::TypeFoldable<rustc_middle[f757abec48a5eb78]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[c0adb274575b21bc]::infer::canonical::canonicalizer::Canonicalizer>
  21:     0x7f026e7ef894 - <<rustc_infer[c0adb274575b21bc]::infer::InferCtxt>::canonicalize_query_with_mode<(rustc_middle[f757abec48a5eb78]::ty::Ty, rustc_middle[f757abec48a5eb78]::ty::Ty)>::{closure#0} as core[d43ed1021aff63f4]::ops::function::FnOnce<(rustc_middle[f757abec48a5eb78]::ty::context::TyCtxt, rustc_middle[f757abec48a5eb78]::ty::ParamEnv, &mut rustc_middle[f757abec48a5eb78]::infer::canonical::OriginalQueryValues)>>::call_once
  22:     0x7f026f94ab03 - <rustc_middle[f757abec48a5eb78]::infer::canonical::CanonicalParamEnvCache>::get_or_insert
  23:     0x7f026e7f9ab8 - <rustc_infer[c0adb274575b21bc]::infer::InferCtxt>::canonicalize_query_with_mode::<(rustc_middle[f757abec48a5eb78]::ty::Ty, rustc_middle[f757abec48a5eb78]::ty::Ty)>
  24:     0x7f026f8a989a - <rustc_infer[c0adb274575b21bc]::infer::InferCtxt>::super_combine_tys::<rustc_infer[c0adb274575b21bc]::infer::relate::equate::Equate>
  25:     0x7f026f89c2e6 - <rustc_infer[c0adb274575b21bc]::infer::relate::equate::Equate as rustc_middle[f757abec48a5eb78]::ty::relate::TypeRelation>::tys
  26:     0x7f026fe743a2 - <rustc_infer[c0adb274575b21bc]::infer::at::At>::eq::<rustc_middle[f757abec48a5eb78]::ty::sty::TraitRef>
  27:     0x7f026fe73edf - rustc_trait_selection[a1ce0c536377f08f]::traits::coherence::equate_impl_headers
  28:     0x7f026f051c90 - rustc_trait_selection[a1ce0c536377f08f]::traits::coherence::impl_intersection_has_negative_obligation
  29:     0x7f026fe75ff5 - rustc_trait_selection[a1ce0c536377f08f]::traits::coherence::overlap
  30:     0x7f027022605e - <rustc_middle[f757abec48a5eb78]::traits::specialization_graph::Children as rustc_trait_selection[a1ce0c536377f08f]::traits::specialize::specialization_graph::ChildrenExt>::insert
  31:     0x7f0270225625 - <rustc_middle[f757abec48a5eb78]::traits::specialization_graph::Graph as rustc_trait_selection[a1ce0c536377f08f]::traits::specialize::specialization_graph::GraphExt>::insert
  32:     0x7f02702291cc - rustc_trait_selection[a1ce0c536377f08f]::traits::specialize::specialization_graph_provider
  33:     0x7f0270228bec - rustc_query_impl[6f15f6c85c1a873b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f15f6c85c1a873b]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 8usize]>>
  34:     0x7f026f85e914 - rustc_query_system[7fd09d8d21d1b510]::query::plumbing::try_execute_query::<rustc_query_impl[6f15f6c85c1a873b]::DynamicConfig<rustc_query_system[7fd09d8d21d1b510]::query::caches::DefaultCache<rustc_span[65f71dc0888967d4]::def_id::DefId, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[6f15f6c85c1a873b]::plumbing::QueryCtxt, false>
  35:     0x7f026fca03de - rustc_query_impl[6f15f6c85c1a873b]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f026f9864cf - rustc_hir_analysis[9c2d6d0d7a0bf722]::coherence::coherent_trait
  37:     0x7f026f9863b1 - rustc_query_impl[6f15f6c85c1a873b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f15f6c85c1a873b]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 0usize]>>
  38:     0x7f027016171f - rustc_query_system[7fd09d8d21d1b510]::query::plumbing::try_execute_query::<rustc_query_impl[6f15f6c85c1a873b]::DynamicConfig<rustc_query_system[7fd09d8d21d1b510]::query::caches::DefaultCache<rustc_span[65f71dc0888967d4]::def_id::DefId, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[6f15f6c85c1a873b]::plumbing::QueryCtxt, false>
  39:     0x7f027016148f - rustc_query_impl[6f15f6c85c1a873b]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7f026fe49bad - rustc_hir_analysis[9c2d6d0d7a0bf722]::check_crate
  41:     0x7f02700f3369 - rustc_interface[6675b02aac4159d5]::passes::analysis
  42:     0x7f02700f2f9d - rustc_query_impl[6f15f6c85c1a873b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f15f6c85c1a873b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7f02707ac764 - rustc_query_system[7fd09d8d21d1b510]::query::plumbing::try_execute_query::<rustc_query_impl[6f15f6c85c1a873b]::DynamicConfig<rustc_query_system[7fd09d8d21d1b510]::query::caches::SingleCache<rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6f15f6c85c1a873b]::plumbing::QueryCtxt, false>
  44:     0x7f02707ac555 - rustc_query_impl[6f15f6c85c1a873b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f0270837992 - rustc_interface[6675b02aac4159d5]::interface::run_compiler::<core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>, rustc_driver_impl[5c34c1e050da57aa]::run_compiler::{closure#0}>::{closure#0}
  46:     0x7f02707bb486 - std[3786b4fe60d6306f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6675b02aac4159d5]::util::run_in_thread_with_globals<rustc_interface[6675b02aac4159d5]::util::run_in_thread_pool_with_globals<rustc_interface[6675b02aac4159d5]::interface::run_compiler<core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>, rustc_driver_impl[5c34c1e050da57aa]::run_compiler::{closure#0}>::{closure#0}, core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>::{closure#0}, core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>
  47:     0x7f02707bb2b3 - <<std[3786b4fe60d6306f]::thread::Builder>::spawn_unchecked_<rustc_interface[6675b02aac4159d5]::util::run_in_thread_with_globals<rustc_interface[6675b02aac4159d5]::util::run_in_thread_pool_with_globals<rustc_interface[6675b02aac4159d5]::interface::run_compiler<core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>, rustc_driver_impl[5c34c1e050da57aa]::run_compiler::{closure#0}>::{closure#0}, core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>::{closure#0}, core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>::{closure#1} as core[d43ed1021aff63f4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f027178d945 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h060b15507a6e395e
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/alloc/src/boxed.rs:2015:9
  49:     0x7f027178d945 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6e5319cc8a1e4225
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/alloc/src/boxed.rs:2015:9
  50:     0x7f027178d945 - std::sys::unix::thread::Thread::new::thread_start::h8fbbd825c116e901
                               at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/sys/unix/thread.rs:108:17
  51:     0x7f026b6749eb - <unknown>
  52:     0x7f026b6f87cc - <unknown>
  53:                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: rustc 1.77.0-nightly (f4d794ea0 2023-12-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(with_negative_coherence) -Z dump-mir-dir=dir

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `core::marker::Copy`
#1 [coherent_trait] coherence checking all impls of trait `core::marker::Copy`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

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

Activity

added
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.
C-bugCategory: This is a bug.
on Dec 28, 2023
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Dec 28, 2023
compiler-errors

compiler-errors commented on Dec 28, 2023

@compiler-errors
Member
removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Dec 29, 2023
added a commit that references this issue on Dec 29, 2023
removed their assignment
on Dec 29, 2023
Apetree100122

Apetree100122 commented on Dec 31, 2023

@Apetree100122

19: 0x7f026fb8443a - <rustc_infer[c0adb274575b21bc]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[c1725dac3fe0073f]::fold::TypeFolder<rustc_middle[f757abec48a5eb78]::ty::context::TyCtxt>>::fold_const
20: 0x7f026e7cd0e1 - <rustc_middle[f757abec48a5eb78]::ty::Clause as rustc_type_ir[c1725dac3fe0073f]::fold::TypeFoldable<rustc_middle[f757abec48a5eb78]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[c0adb274575b21bc]::infer::canonical::canonicalizer::Canonicalizer>
21: 0x7f026e7ef894 - <<rustc_infer[c0adb274575b21bc]::infer::InferCtxt>::canonicalize_query_with_mode<(rustc_middle[f757abec48a5eb78]::ty::Ty, rustc_middle[f757abec48a5eb78]::ty::Ty)>::{closure#0} as core[d43ed1021aff63f4]::ops::function::FnOnce<(rustc_middle[f757abec48a5eb78]::ty::context::TyCtxt, rustc_middle[f757abec48a5eb78]::ty::ParamEnv, &mut rustc_middle[f757abec48a5eb78]::infer::canonical::OriginalQueryValues)>>::call_once
22: 0x7f026f94ab03 - <rustc_middle[f757abec48a5eb78]::infer::canonical::CanonicalParamEnvCache>::get_or_insert
23: 0x7f026e7f9ab8 - <rustc_infer[c0adb274575b21bc]::infer::InferCtxt>::canonicalize_query_with_mode::<(rustc_middle[f757abec48a5eb78]::ty::Ty, rustc_middle[f757abec48a5eb78]::ty::Ty)>
24: 0x7f026f8a989a - <rustc_infer[c0adb274575b21bc]::infer::InferCtxt>::super_combine_tys::<rustc_infer[c0adb274575b21bc]::infer::relate::equate::Equate>
25: 0x7f026f89c2e6 - <rustc_infer[c0adb274575b21bc]::infer::relate::equate::Equate as rustc_middle[f757abec48a5eb78]::ty::relate::TypeRelation>::tys
26: 0x7f026fe743a2 - <rustc_infer[c0adb274575b21bc]::infer::at::At>::eq::<rustc_middle[f757abec48a5eb78]::ty::sty::TraitRef>
27: 0x7f026fe73edf - rustc_trait_selection[a1ce0c536377f08f]::traits::coherence::equate_impl_headers
28: 0x7f026f051c90 - rustc_trait_selection[a1ce0c536377f08f]::traits::coherence::impl_intersection_has_negative_obligation
29: 0x7f026fe75ff5 - rustc_trait_selection[a1ce0c536377f08f]::traits::coherence::overlap
30: 0x7f027022605e - <rustc_middle[f757abec48a5eb78]::traits::specialization_graph::Children as rustc_trait_selection[a1ce0c536377f08f]::traits::specialize::specialization_graph::ChildrenExt>::insert
31: 0x7f0270225625 - <rustc_middle[f757abec48a5eb78]::traits::specialization_graph::Graph as rustc_trait_selection[a1ce0c536377f08f]::traits::specialize::specialization_graph::GraphExt>::insert
32: 0x7f02702291cc - rustc_trait_selection[a1ce0c536377f08f]::traits::specialize::specialization_graph_provider
33: 0x7f0270228bec - rustc_query_impl[6f15f6c85c1a873b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f15f6c85c1a873b]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 8usize]>>
34: 0x7f026f85e914 - rustc_query_system[7fd09d8d21d1b510]::query::plumbing::try_execute_query::<rustc_query_impl[6f15f6c85c1a873b]::DynamicConfig<rustc_query_system[7fd09d8d21d1b510]::query::caches::DefaultCache<rustc_span[65f71dc0888967d4]::def_id::DefId, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[6f15f6c85c1a873b]::plumbing::QueryCtxt, false>
35: 0x7f026fca03de - rustc_query_impl[6f15f6c85c1a873b]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
36: 0x7f026f9864cf - rustc_hir_analysis[9c2d6d0d7a0bf722]::coherence::coherent_trait
37: 0x7f026f9863b1 - rustc_query_impl[6f15f6c85c1a873b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f15f6c85c1a873b]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 0usize]>>
38: 0x7f027016171f - rustc_query_system[7fd09d8d21d1b510]::query::plumbing::try_execute_query::<rustc_query_impl[6f15f6c85c1a873b]::DynamicConfig<rustc_query_system[7fd09d8d21d1b510]::query::caches::DefaultCache<rustc_span[65f71dc0888967d4]::def_id::DefId, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[6f15f6c85c1a873b]::plumbing::QueryCtxt, false>
39: 0x7f027016148f - rustc_query_impl[6f15f6c85c1a873b]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
40: 0x7f026fe49bad - rustc_hir_analysis[9c2d6d0d7a0bf722]::check_crate
41: 0x7f02700f3369 - rustc_interface[6675b02aac4159d5]::passes::analysis
42: 0x7f02700f2f9d - rustc_query_impl[6f15f6c85c1a873b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f15f6c85c1a873b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 1usize]>>
43: 0x7f02707ac764 - rustc_query_system[7fd09d8d21d1b510]::query::plumbing::try_execute_query::<rustc_query_impl[6f15f6c85c1a873b]::DynamicConfig<rustc_query_system[7fd09d8d21d1b510]::query::caches::SingleCache<rustc_middle[f757abec48a5eb78]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6f15f6c85c1a873b]::plumbing::QueryCtxt, false>
44: 0x7f02707ac555 - rustc_query_impl[6f15f6c85c1a873b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
45: 0x7f0270837992 - rustc_interface[6675b02aac4159d5]::interface::run_compiler::<core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>, rustc_driver_impl[5c34c1e050da57aa]::run_compiler::{closure#0}>::{closure#0}
46: 0x7f02707bb486 - std[3786b4fe60d6306f]::sys_common::backtrace::_rust_begin_short_backtrace::<rustc_interface[6675b02aac4159d5]::util::run_in_thread_with_globals<rustc_interface[6675b02aac4159d5]::util::run_in_thread_pool_with_globals<rustc_interface[6675b02aac4159d5]::interface::run_compiler<core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>, rustc_driver_impl[5c34c1e050da57aa]::run_compiler::{closure#0}>::{closure#0}, core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>::{closure#0}, core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>:
:{closure#0}::{closure#0}, core[d43ed1021aff63f4]::result::Result<(), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>
47: 0x7f02707bb2b3 - <<std[3786b4fe60d6306f]::thread::Builder>::spawn_unchecked
<rustc_interface
[6675b02aac4159d5]::util::run_in_thread_with_globals<rustc_interface
[6675b02aac4159d5]::util::run_in_thread_pool_with_globals<rustc_interface
[6675b02aac4159d5]::interface::run_compiler<core[
d43ed1021aff63f4]::result::Result<(
), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>, rustc_driver_impl[5c34c1e050da57aa]::run_compiler::
{closure#0}>::{closure#0}, core[d43ed1021aff63f4]::result::Result<(
), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>::
{closure#0}, core[
d43ed1021aff63f4]::result::Result<(
), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>:
:{closure#0}::{closure#0}, core[d43ed1021aff63f4]::result::Result<(
), rustc_span[65f71dc0888967d4]::ErrorGuaranteed>>::{
closure#1} as core[d43ed1021aff63f4]::ops::function::FnOnce<(
)>>::call_once::{shim:vtable#0 48: 0x7f027178d945 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::h060b15507a6e395e at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/alloc/src/boxed.rs:2015:9 49: 0x7f027178d945 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::h6e5319cc8a1e4225 at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/alloc/src/boxed.rs:2015:9
50: 0x7f027178d945 - std::sys::unix::thread::Thread::new::thread_start::h8fbbd825c116e901 at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/sys/unix/thread.rs:108:17 51: 0x7f026b6749eb - 52: 0x7f026b6f87cc - 53: 0x0 -
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: rustc 1.77.0-nightly (f4d794e 2023-12-28) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z crate-attr=feature(with_negative_coherence) -Z dump-mir-dir=dir
query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait core::marker::Copy
#1 [coherent_trait] coherence checking all impls of trait core::marker::Copy
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0428, E0601, E0770.
For more information about an error, try rustc --explain E0428.

Apetree100122

Apetree100122 commented on Dec 31, 2023

@Apetree100122

error[E0428]: the name
S is defined multiple time
s>/tmp/icemaker_global_tempdir.dEdA4AEPEHqR/ru
stc_te
strunner_tmpdir_reporting.Tcz7KehpgNJH/mvce.r
s:5:1
|2 |
struct
S<const N: [f32; N]>(); | ------------------------------ previou
s definition of the type
S here...
5 |
struct
S([f32; N]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
S redefined here|
= note:
S mu
st be defined only once in the type name
space of this module
error[E0770]: the type of con
st parameter
s must not depend on other generic parameter
s -->/tmp/icemaker_global_tempdir.dEdA4AEPEHqR/ru
stc_te
strunner_tmpdir_reporting.Tc
z7KehpgNJH/mvce.r
s:2:2
5
|2 |
struct
S<const N: [f32; N]>(
); | ^ the type must not depend on the parameter N|
= note: con
st parameter
s may not be u
sed in the type of con
st parameter
s
error[E0601]: main function not found in crate mvce --> /tmp/icemaker_global_tempdir.dEdA4AEPEHqR/ru
stc_testrunner_tmpdir_reporting.Tc
z7KehpgNJH/mvce.r
s:
5:36|
5 | struct
S([f32; N]);compiler/ru
stc_infer/
src/infer/canonical/canonicalizer.r
s | ^ con
sider adding a main function to /tmp/icemaker_global_tempdir.dEdA4AEPEHqR/ru stc_te strunner_tmpdir_reporting.Tc z7KehpgNJH/mvce.r s
thread 'ru
stc' panicked at compiler/ru
stc_infer/
src/infer/canonical/canonicali
zer.r
s:483:43:
called Option::unwrap() on a None value
stack backtrace: 0: 0x7f0271780756 - std::backtrace_r
s::backtrace::libunwind::trace::h3a8e
5867b01d1b80 at /rus
tc/f4d794ea0b845413344621d89f6c94
506274848
5/library
/std/
src/backtrace/
src/backtrace/libunwind.r
s:104
:5 1: 0x7f0271780756 - std::backtrace_r
s::backtrace::trace_un
synchroni
zed::he397ef0e4
5adff5d at /ru
stc/f4d794ea0b84
5413344621d89f6c94
506274848
5/library/
std/
src/backtrace/
src/backtrace/mod.r
s:66:
5 2: 0x7f02717807
56 - std::
sys_common::backtrace::_print_fmt::h2
5cea7a1fa724fb
5 at /ru
stc/f4d794ea0b84l
5413344621d89f6c94506274848
5/library/
std/
src/
sys_common/backtrace.rs:68:
5 3: 0x7f0271780756

  • <std::
  • sys_common::backtrace::_print::DisplayBacktrace a
  • s core::fmt::Display>::fmt::hda7
  • 577428151df9d at /ru
    stc/f4d794ea0b84
    5413344621d89f6c94
    506274848
    5/library/
    std/
    src/
    sys_common/backtrace.r
    s:44:22 4: 0x7f02717d3080 - core::fmt::rt::Argument::fmt::hb2ec9e184bf02ba0 at /rustc/f4d794ea0b84
    5413344621d89f6c94
    506274848
    5/library/core
    /src/fmt/rt.r
    s:142:9
    5: 0x7f02717d3080 - core::fmt::write::h346
    5386ebc0a8978
    at /ru
    stc/f4d794ea0b84
    5413344621d89f6c94
    506274848
    5/library/core/
    src/fmt/mod.r
    s:1120:17 6: 0x7f027177449f -
    std::io::Write::write_fmt::hd97c
    5a97
    5dde240c at /ru
    stc/f4d794ea0b84
    5413344621d89f6c94
    506274848
    5/library/
    std/
    src/io/mod.rs:1810:1
    5 7: 0x7f0271780
    534 -
    std:
    :sys_common::backtrace::_print::h40f73d3c1d
    514bff at /ru
    stc/f4d794ea0b84
    5413344621d89f6c94
    506274848
    5/library/std/src/sys_common/backtrace.rs:47:
    5 8: 0x7f0271780
    534 -
    std::
    sys_common::backtrace::print::h
    52313c48a0b47ef2 at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7f02717832c7 - std::panicking::default_hook::{{closure}}::haa180c42e4a369b8 10: 0x7f0271783029 - std::panicking::default_hook::h2608c79ece8d0d38 at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/panicking.rs:292:9 11: 0x7f026e554c5c - std[3786b4fe60d6306f]::panicking::update_hook::<alloc[3092222d4273bb6b]::boxed::Box<rustc_driver_impl[5c34c1e050da57aa]::install_ice_hook::{closure#0}>>::{closure#0} 12: 0x7f0271783a16 - <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call::hb87a29f68be8c251 at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/alloc/src/boxed.rs:2029:9 13: 0x7f0271783a16 - std::panicking::rust_panic_with_hook::h184b82fc904f3d9c at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/panicking.rs:783:1314: 0x7f0271783729 - std::panicking::begin_panic_handler::{{closure}}::h67db85fa17afc73b at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/panicking.rs:649:13 15: 0x7f0271780c56 - std::sys_common::backtrace::__rust_end_short_backtrace::h8eaebecb966c644a at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/sys_common/backtrace.rs:171:18 16: 0x7f02717834c0 - rust_begin_unwind at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/std/src/panicking.rs:645:517: 0x7f02717cf785 - core::panicking::panic_fmt::hd644558ff883b3e1 at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/core/src/panicking.rs:72:14 18: 0x7f02717cf843 - core::panicking::panic::h2d0706ee0b925e5e at /rustc/f4d794ea0b845413344621d89f6c945062748485/library/core/src/panicking.rs:144:519: 0x7f026fb8443a - <rustc_infer[c0adb274575b21bc]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[c1725dac3fe0073f]::fold::TypeFolder<rustc_middle[f757abec48a5eb78]::ty::context::TyCtxt>>::fold_const 20: 0x7f026e7cd0e1 - <rustc_middle[f757abec48a5eb78]::ty::Clause as rustc_type_ir[c1725dac3fe0073f]::fold::TypeFoldable<rustc_middle[f757abec48a5eb78]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[c0adb274575b21bc]::infer::canonical::canonicalizer::Canonicalizer>
aliemjay

aliemjay commented on Jan 1, 2024

@aliemjay
Member

This seems to be triggered only by invalid code with an unstable feature gate.

MCVE:

#![feature(with_negative_coherence)]
trait Trait {}
impl<const N: u8> Trait for [(); N] {}
impl<const N: i8> Trait for [(); N] {}
added
S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.
on Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-coherenceArea: CoherenceC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @matthiaskrgr@compiler-errors@saethlin@aliemjay@rustbot

      Issue actions

        ICE: `with_negative_coherence`: `None` in `compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:483:43` · Issue #119381 · rust-lang/rust