Repository navigation
ICE: Add != BinOp::Eq | BinOp::Ne | BinOp::Le | BinOp::Lt | BinOp::Ge | BinOp::Gt | BinOp::Offset #137187
Description
Activity
- addedC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Feb 17, 2025 - addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Feb 17, 2025 smaller
use std::ops::Add; trait A where *const Self: Add, { const fn b(c: *const Self) -> <*const Self as Add>::Output { c + c } }
I feel like I should cc @scottmcm
I don't think I've changed anything about this?
*const Self: Addis just something that doesn't exist, so it's making weird MIR I guess.Is the MIR building code lowering that
+toBinOp::addinstead of toAdd::add?Reacted by Jubileeduplicate of #134587?
Reacted by scottmcm and nora- removedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Mar 3, 2025 @matthiaskrgr can you please not reopen an issue I closed as a duplicate without any justification for why it's not a duplicate?? It's definitely possible I was wrong, but please post a comment on why you think that!
Would be great to lead by example and give an explanation of why you think its a dupe?
When I compare this one with #134587 (comment) , I notice the following things
- the code is different
- the ice message is different
thread 'rustc' panicked at compiler/rustc_const_eval/src/check_consts/check.rs:714:21: assertion `left matches right` failed left: Add right: BinOp::Eq | BinOp::Ne | BinOp::Le | BinOp::Lt | BinOp::Ge | BinOp::Gt | BinOp::Offset stack backtrace:vs
error: internal compiler error: broken MIR in DefId(0:5 ~ c[a1e0]::TimesTwo::t2_ptr) (_0 = Add(move _2, move _3)): bad assignment (Alias(Projection, AliasTy { args: [*const Self/#0, *const Self/#0], def_id: DefId(2:3586 ~ core[7509]::ops::arith::Add::Output), .. }) = *const Self/#0): NoSolution --> c.rs:8:8 | 8 | slf + slf | ^^^^^^^^^ | note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:934:21 - disabled backtrace --> c.rs:8:8 | 8 | slf + slf | ^^^^^^^^^- the backtrace is different
stack backtrace: 0: rust_begin_unwind 1: core::panicking::panic_fmt 2: core::panicking::assert_failed_inner 3: core::panicking::assert_matches_failed::<&rustc_middle::mir::syntax::BinOp> 4: <rustc_const_eval::check_consts::check::Checker as rustc_middle::mir::visit::Visitor>::visit_basic_block_data 5: <rustc_const_eval::check_consts::check::Checker>::check_body 6: rustc_mir_transform::mir_const_qualif [... omitted 1 frame ...] 7: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 4]>>> 8: rustc_mir_transform::mir_promoted [... omitted 2 frames ...] 9: rustc_interface::passes::run_required_analyses 10: rustc_interface::passes::analysis [... omitted 1 frame ...] 11: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0} 12: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1} note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. 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: please attach the file at `/tmp/im/rustc-ice-2025-03-04T19_37_42-2198288.txt` to your bug reportvs
note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:934:21 0: <rustc_errors::DiagCtxtInner>::emit_diagnostic 1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic 2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee 3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String> 4: <rustc_borrowck::type_check::TypeChecker>::typeck_mir 5: rustc_borrowck::type_check::type_check 6: rustc_borrowck::nll::compute_regions 7: rustc_borrowck::do_mir_borrowck 8: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>> 9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 10: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace 11: rustc_interface::passes::run_required_analyses 12: rustc_interface::passes::analysis 13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>> 14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 15: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 16: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0} 17: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1} 18: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 19: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 20: std::sys::pal::unix::thread::Thread::new::thread_start 21: <unknown> 22: <unknown> --> c.rs:8:8 | 8 | slf + slf | ^^^^^^^^^ 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 nightlynightly-2024-02-09 note: please attach the file at `/tmp/im/rustc-ice-2025-03-04T19_38_25-2198660.txt` to your bug reportand the bisection points to a different commit
nightly-2024-02-09
vs
nightly-2020-10-17I would think that all or at least most of these would have to match for it to be a duplicate.
- addedS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.
on Mar 9, 2025
auto-reduced (treereduce-rust):
original:
Version information
Possibly related line of code:
rust/compiler/rustc_const_eval/src/check_consts/check.rs
Lines 708 to 720 in ce36a96
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2 -Clink-dead-code=true -Zvalidate-mir --edition=2024Program output