Open
Description
Code
(one file: "ice-mwe.rs")
use std::ops::Add;
pub trait TimesTwo
where *const Self: Add<*const Self>,
{
extern "C" fn t2_ptr(slf: *const Self)
-> <*const Self as Add<*const Self>>::Output {
slf + slf
}
}
fn main(){}
Meta
rustc --version --verbose
:
rustc 1.85.0-nightly (9e136a30a 2024-12-19)
binary: rustc
commit-hash: 9e136a30a965bf4e63f03095c57df7257bf96fd6
commit-date: 2024-12-19
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.6
Error output
(exact command used: rustc path/to/ice-mwe.rs
)
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: broken MIR in DefId(0:5 ~ ice_mwe[fdb9]::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:3495 ~ core[57d6]::ops::arith::Add::Output), .. }) = *const Self/#0): NoSolution
--> src/ice-mwe.rs:8:8
|
8 | slf + slf
| ^^^^^^^^^
|
note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:1157:21 - disabled backtrace
--> src/ice-mwe.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 nightly
note: please attach the file at `/home/niac/tmp/mwe/rustc-ice-2024-12-20T22_57_23-3180020.txt` to your bug report
query stack during panic:
end of query stack
Backtrace
(exact command used: RUST_BACKTRACE=1 rustc path/to/ice-mwe.rs
)
(also downloadable as rustc-ice-2024-12-20T22_54_18-3179078.txt)
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: broken MIR in DefId(0:5 ~ ice_mwe[fdb9]::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:3495 ~ core[57d6]::ops::arith::Add::Output), .. }) = *const Self/#0): NoSolution
--> src/ice-mwe.rs:8:8
|
8 | slf + slf
| ^^^^^^^^^
|
note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:1157: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: start_thread
22: clone3
--> src/ice-mwe.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 nightly
note: please attach the file at `/home/niac/tmp/mwe/rustc-ice-2024-12-20T22_54_18-3179078.txt` to your bug report
query stack during panic:
end of query stack
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.