Repository navigation
ICE: broken mir #110683
Copy link
Copy link
Closed
Labels
C-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) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.
Description
Code
#![crate_type = "lib"]
use std::ops::Sub;
trait Vector2 {
type ScalarType;
fn from_values(x: Self::ScalarType, y: Self::ScalarType) -> Vec2
where
Self: Sized;
fn x(&self) -> Self::ScalarType;
fn y(&self) -> Self::ScalarType;
}
impl<T> Sub for dyn Vector2<ScalarType = T>
where
T: Sub<Output = T>,
(dyn Vector2<ScalarType = T>): Sized,
{
type Output = dyn Vector2<ScalarType = T>;
fn sub(self, rhs: Self) -> Self::Output {
Self::from_values(self.x() - rhs.x(), self.y() - rhs.y())
}
}
struct Vec2 {
x: i32,
y: i32,
}Meta
rustc --version --verbose:
rustc 1.71.0-nightly (fec9adcdb 2023-04-21)
binary: rustc
commit-hash: fec9adcdbc21469ef105162cc8cabf81c72d06be
commit-date: 2023-04-21
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2
Error output
-
Backtrace
warning: fields `x` and `y` are never read
--> treereduce.out:28:5
|
27 | struct Vec2 {
| ---- fields in this struct
28 | x: i32,
| ^
29 | y: i32,
| ^
|
= note: `#[warn(dead_code)]` on by default
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: broken MIR in DefId(0:12 ~ treereduce[24c2]::{impl#0}::sub) (Terminator { source_info: SourceInfo { span: treereduce.out:23:9: 23:66 (#0), scope: scope[0] }, kind: _0 = <dyn Vector2<ScalarType = T> as Vector2>::from_values(move _3, move _8) -> [return: bb7, unwind: bb10] }): call dest mismatch (dyn Vector2<ScalarType = T> <- Vec2): NoSolution
--> treereduce.out:23:64
|
23 | Self::from_values(self.x() - rhs.x(), self.y() - rhs.y())
| ^
|
= note: delayed at 0: <rustc_errors::HandlerInner>::emit_diagnostic
1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
2: <rustc_borrowck::type_check::TypeChecker>::typeck_mir
3: rustc_borrowck::type_check::type_check
4: rustc_borrowck::nll::compute_regions
5: rustc_borrowck::do_mir_borrowck
6: rustc_borrowck::mir_borrowck
7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
8: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_interface::passes::analysis::{closure#2}::{closure#0}>::{closure#0}>
9: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#2}>
10: rustc_interface::passes::analysis
11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
12: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
13: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
14: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
15: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
16: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
17: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
18: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
19: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/fec9adcdbc21469ef105162cc8cabf81c72d06be/library/alloc/src/boxed.rs:1962:9
20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/fec9adcdbc21469ef105162cc8cabf81c72d06be/library/alloc/src/boxed.rs:1962:9
21: std::sys::unix::thread::Thread::new::thread_start
at /rustc/fec9adcdbc21469ef105162cc8cabf81c72d06be/library/std/src/sys/unix/thread.rs:108:17
22: <unknown>
23: <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: rustc 1.71.0-nightly (fec9adcdb 2023-04-21) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted
Metadata
Metadata
Assignees
Labels
C-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) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.
Activity
lukas-code commentedon Apr 22, 2023
reduced
matthiaskrgr commentedon Apr 22, 2023
almost exactly 3 years old 🍰 🥳 🪅
searched toolchains nightly-2020-04-17 through nightly-2023-04-22
Regression in nightly-2020-04-23
found 7 bors merge commits in the specified range
commit[0] 2020-04-21: Auto merge of #71170 - spastorino:dyn-fnonce-alignment, r=nikomatsakis
commit[1] 2020-04-22: Auto merge of #71402 - ehuss:update-cargo, r=ehuss
commit[2] 2020-04-22: Auto merge of #71410 - JohnTitor:rollup-vh6dut5, r=JohnTitor
commit[3] 2020-04-22: Auto merge of #71323 - nnethercote:bitcode-in-rlib, r=alexcrichton
commit[4] 2020-04-22: Auto merge of #71424 - Dylan-DPC:rollup-iunh61a, r=Dylan-DPC
commit[5] 2020-04-22: Auto merge of #71374 - nnethercote:alphabetize-C-and-Z-options, r=petrochenkov
commit[6] 2020-04-22: Auto merge of #71431 - Dylan-DPC:rollup-rvm6tfy, r=Dylan-DPC
probably #71170 ? cc @spastorino
compiler-errors commentedon Apr 22, 2023
I feel like i've seen this before -- probably a dupe? Or at least I think I've chatted with @JakobDegen about this.
matthiaskrgr commentedon Apr 28, 2023
Could be :D probably 90% of the ICEs I am seeing are already reported in some way or another and sometimes one might slip through
matthiaskrgr commentedon Apr 28, 2023
different stacktrace with debug assertions:
Rollup merge of rust-lang#112215 - compiler-errors:check-sized-better…
Rollup merge of rust-lang#112215 - compiler-errors:check-sized-better…