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: with_negative_coherence & specialization #124515

Closed
ShE3py opened this issue Apr 29, 2024 · 1 comment
Closed

ICE: with_negative_coherence & specialization #124515

ShE3py opened this issue Apr 29, 2024 · 1 comment
Labels
A-coherence Area: Coherence A-specialization Area: Trait impl specialization C-bug Category: This is a bug. F-with_negative_coherence `#![feature(with_negative_coherence)]` 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.

Comments

@ShE3py
Copy link
Contributor

ShE3py commented Apr 29, 2024

Note: this doesn't requires nightly.

Code

#![feature(with_negative_coherence)]

impl<const N: u8> Copy for [(); N] {}

Meta

rustc --version --verbose:

rustc 1.77.2 (25ef9e3d8 2024-04-09)
binary: rustc
commit-hash: 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04
commit-date: 2024-04-09
host: x86_64-unknown-linux-gnu
release: 1.77.2
LLVM version: 17.0.6

Error output

Backtrace

thread 'rustc' panicked at compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:340:43:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7852c00b3d16 - std::backtrace_rs::backtrace::libunwind::trace::hd6ffdc229294c06f
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7852c00b3d16 - std::backtrace_rs::backtrace::trace_unsynchronized::h991f79b6e9960513
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7852c00b3d16 - std::sys_common::backtrace::_print_fmt::hf4ebe716f7ccda10
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7852c00b3d16 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h410d4c66be4e37f9
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7852c0106770 - core::fmt::rt::Argument::fmt::he0ff0e0e188c0db5
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/fmt/rt.rs:142:9
   5:     0x7852c0106770 - core::fmt::write::he40921d4802ce2ac
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/fmt/mod.rs:1120:17
   6:     0x7852c00a761f - std::io::Write::write_fmt::h5de5a4e7037c9b20
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/io/mod.rs:1846:15
   7:     0x7852c00b3af4 - std::sys_common::backtrace::_print::hd8e2e3f655086663
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7852c00b3af4 - std::sys_common::backtrace::print::h11c067a88e3bdb22
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7852c00b6887 - std::panicking::default_hook::{{closure}}::h8c832ecb03fde8ea
  10:     0x7852c00b65e9 - std::panicking::default_hook::h1633e272b4150cf3
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:292:9
  11:     0x7852bcda0dac - std[85008a29cc0b7dba]::panicking::update_hook::<alloc[a3006b27d8562c00]::boxed::Box<rustc_driver_impl[7bf504f3f6583165]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7852c00b6fd6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h4dd5cc3b5605ae1a
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/boxed.rs:2029:9
  13:     0x7852c00b6fd6 - std::panicking::rust_panic_with_hook::hb164d19c0c1e71d4
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:785:13
  14:     0x7852c00b6ce9 - std::panicking::begin_panic_handler::{{closure}}::h0369088c533c20e9
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:651:13
  15:     0x7852c00b4216 - std::sys_common::backtrace::__rust_end_short_backtrace::hc11d910daf35ac2e
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7852c00b6a74 - rust_begin_unwind
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
  17:     0x7852c0102e75 - core::panicking::panic_fmt::ha6effc2775a0749c
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
  18:     0x7852c0102f33 - core::panicking::panic::h44790a89027c670f
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:144:5
  19:     0x7852c0102bb6 - core::option::unwrap_failed::hcb3a256a9f1ca882
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/option.rs:1978:5
  20:     0x7852bb3f2e21 - <rustc_infer[a5dc95fd7312ffcc]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[ebd1d6103875bdf0]::fold::TypeFolder<rustc_middle[a985f8abd286e753]::ty::context::TyCtxt>>::fold_ty
  21:     0x7852be1887d2 - <&rustc_middle[a985f8abd286e753]::ty::list::List<rustc_middle[a985f8abd286e753]::ty::generic_args::GenericArg> as rustc_type_ir[ebd1d6103875bdf0]::fold::TypeFoldable<rustc_middle[a985f8abd286e753]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[a5dc95fd7312ffcc]::infer::canonical::canonicalizer::Canonicalizer>
  22:     0x7852bd005d47 - <rustc_middle[a985f8abd286e753]::ty::Clause as rustc_type_ir[ebd1d6103875bdf0]::fold::TypeFoldable<rustc_middle[a985f8abd286e753]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[a5dc95fd7312ffcc]::infer::canonical::canonicalizer::Canonicalizer>
  23:     0x7852bd028bf4 - <<rustc_infer[a5dc95fd7312ffcc]::infer::InferCtxt>::canonicalize_query<(rustc_middle[a985f8abd286e753]::ty::Ty, rustc_middle[a985f8abd286e753]::ty::Ty)>::{closure#0} as core[7fef78d3beba6ff5]::ops::function::FnOnce<(rustc_middle[a985f8abd286e753]::ty::context::TyCtxt, rustc_middle[a985f8abd286e753]::ty::ParamEnv, &mut rustc_middle[a985f8abd286e753]::infer::canonical::OriginalQueryValues)>>::call_once
  24:     0x7852be49f38c - <rustc_middle[a985f8abd286e753]::infer::canonical::CanonicalParamEnvCache>::get_or_insert
  25:     0x7852bd0300d8 - <rustc_infer[a5dc95fd7312ffcc]::infer::InferCtxt>::canonicalize_query::<(rustc_middle[a985f8abd286e753]::ty::Ty, rustc_middle[a985f8abd286e753]::ty::Ty)>
  26:     0x7852be48b676 - <rustc_infer[a5dc95fd7312ffcc]::infer::InferCtxt>::super_combine_consts::<rustc_infer[a5dc95fd7312ffcc]::infer::relate::equate::Equate>
  27:     0x7852be0a1527 - <rustc_infer[a5dc95fd7312ffcc]::infer::InferCtxt>::super_combine_tys::<rustc_infer[a5dc95fd7312ffcc]::infer::relate::equate::Equate>
  28:     0x7852be09e716 - <rustc_infer[a5dc95fd7312ffcc]::infer::relate::equate::Equate as rustc_middle[a985f8abd286e753]::ty::relate::TypeRelation>::tys
  29:     0x7852be38eef3 - <rustc_infer[a5dc95fd7312ffcc]::infer::at::At>::eq::<rustc_middle[a985f8abd286e753]::ty::sty::TraitRef>
  30:     0x7852be38ea2b - rustc_trait_selection[ebedcddbc396e501]::traits::coherence::equate_impl_headers
  31:     0x7852bd7e22a5 - rustc_trait_selection[ebedcddbc396e501]::traits::coherence::impl_intersection_has_negative_obligation
  32:     0x7852be3902fa - rustc_trait_selection[ebedcddbc396e501]::traits::coherence::overlap
  33:     0x7852be765561 - <rustc_middle[a985f8abd286e753]::traits::specialization_graph::Children as rustc_trait_selection[ebedcddbc396e501]::traits::specialize::specialization_graph::ChildrenExt>::insert
  34:     0x7852be764ae7 - <rustc_middle[a985f8abd286e753]::traits::specialization_graph::Graph as rustc_trait_selection[ebedcddbc396e501]::traits::specialize::specialization_graph::GraphExt>::insert
  35:     0x7852bea7cd80 - rustc_trait_selection[ebedcddbc396e501]::traits::specialize::specialization_graph_provider
  36:     0x7852bea7c85b - rustc_query_impl[616430243197e8f4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[616430243197e8f4]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a985f8abd286e753]::query::erase::Erased<[u8; 8usize]>>
  37:     0x7852be064b0d - rustc_query_system[d592f7b82322148b]::query::plumbing::try_execute_query::<rustc_query_impl[616430243197e8f4]::DynamicConfig<rustc_query_system[d592f7b82322148b]::query::caches::DefIdCache<rustc_middle[a985f8abd286e753]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[616430243197e8f4]::plumbing::QueryCtxt, false>
  38:     0x7852be5492b2 - rustc_query_impl[616430243197e8f4]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7852be549546 - rustc_hir_analysis[13775d5f02570a3]::coherence::coherent_trait
  40:     0x7852be54944b - rustc_query_impl[616430243197e8f4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[616430243197e8f4]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a985f8abd286e753]::query::erase::Erased<[u8; 1usize]>>
  41:     0x7852be1c9400 - rustc_query_system[d592f7b82322148b]::query::plumbing::try_execute_query::<rustc_query_impl[616430243197e8f4]::DynamicConfig<rustc_query_system[d592f7b82322148b]::query::caches::DefIdCache<rustc_middle[a985f8abd286e753]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[616430243197e8f4]::plumbing::QueryCtxt, false>
  42:     0x7852be2e8b0d - rustc_query_impl[616430243197e8f4]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7852be2e90c3 - rustc_hir_analysis[13775d5f02570a3]::check_crate
  44:     0x7852be9a3266 - rustc_interface[80a0b631737fb765]::passes::analysis
  45:     0x7852be9a2c5f - rustc_query_impl[616430243197e8f4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[616430243197e8f4]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a985f8abd286e753]::query::erase::Erased<[u8; 1usize]>>
  46:     0x7852be9fdf82 - rustc_query_system[d592f7b82322148b]::query::plumbing::try_execute_query::<rustc_query_impl[616430243197e8f4]::DynamicConfig<rustc_query_system[d592f7b82322148b]::query::caches::SingleCache<rustc_middle[a985f8abd286e753]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[616430243197e8f4]::plumbing::QueryCtxt, false>
  47:     0x7852be9fddc7 - rustc_query_impl[616430243197e8f4]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  48:     0x7852bece620b - rustc_interface[80a0b631737fb765]::interface::run_compiler::<core[7fef78d3beba6ff5]::result::Result<(), rustc_span[865b327b21456c24]::ErrorGuaranteed>, rustc_driver_impl[7bf504f3f6583165]::run_compiler::{closure#0}>::{closure#0}
  49:     0x7852bef33df1 - std[85008a29cc0b7dba]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[80a0b631737fb765]::util::run_in_thread_with_globals<rustc_interface[80a0b631737fb765]::interface::run_compiler<core[7fef78d3beba6ff5]::result::Result<(), rustc_span[865b327b21456c24]::ErrorGuaranteed>, rustc_driver_impl[7bf504f3f6583165]::run_compiler::{closure#0}>::{closure#0}, core[7fef78d3beba6ff5]::result::Result<(), rustc_span[865b327b21456c24]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7fef78d3beba6ff5]::result::Result<(), rustc_span[865b327b21456c24]::ErrorGuaranteed>>
  50:     0x7852bef33c4f - <<std[85008a29cc0b7dba]::thread::Builder>::spawn_unchecked_<rustc_interface[80a0b631737fb765]::util::run_in_thread_with_globals<rustc_interface[80a0b631737fb765]::interface::run_compiler<core[7fef78d3beba6ff5]::result::Result<(), rustc_span[865b327b21456c24]::ErrorGuaranteed>, rustc_driver_impl[7bf504f3f6583165]::run_compiler::{closure#0}>::{closure#0}, core[7fef78d3beba6ff5]::result::Result<(), rustc_span[865b327b21456c24]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7fef78d3beba6ff5]::result::Result<(), rustc_span[865b327b21456c24]::ErrorGuaranteed>>::{closure#1} as core[7fef78d3beba6ff5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x7852c00c0675 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6b630278c760b971
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/boxed.rs:2015:9
  52:     0x7852c00c0675 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h70462b441b6c0e1f
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/boxed.rs:2015:9
  53:     0x7852c00c0675 - std::sys::pal::unix::thread::Thread::new::thread_start::h3631815ad38387d6
                               at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys/pal/unix/thread.rs:108:17
  54:     0x7852bfe7b55a - <unknown>
  55:     0x7852bfef8a5c - <unknown>
  56:                0x0 - <unknown>

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


@rustbot label +F-with_negative_coherence +A-coherence +A-specialization

@ShE3py ShE3py 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 Apr 29, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. A-coherence Area: Coherence A-specialization Area: Trait impl specialization F-with_negative_coherence `#![feature(with_negative_coherence)]` labels Apr 29, 2024
@ShE3py
Copy link
Contributor Author

ShE3py commented Apr 29, 2024

Ah, duplicate of #119381.

@ShE3py ShE3py closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coherence Area: Coherence A-specialization Area: Trait impl specialization C-bug Category: This is a bug. F-with_negative_coherence `#![feature(with_negative_coherence)]` 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.
Projects
None yet
Development

No branches or pull requests

3 participants