Description
Code
#![feature(unsafe_binders)]
#![feature(transmutability)]
#![feature(type_alias_impl_trait)]
#![allow(incomplete_features)]
trait OpaqueTrait {}
type OpaqueType = unsafe<> impl OpaqueTrait;
trait AnotherTrait {}
impl<T: std::mem::TransmuteFrom<()>> AnotherTrait for T {}
impl AnotherTrait for OpaqueType {}
pub fn main() {}
mutant from tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.rs
Meta
rustc --version --verbose
:
rustc 1.89.0-nightly (bf64d66bd 2025-05-21)
binary: rustc
commit-hash: bf64d66bd58719fac2585eae5e546e5e1d9947f5
commit-date: 2025-05-21
host: aarch64-apple-darwin
release: 1.89.0-nightly
LLVM version: 20.1.5
Error output
command: rustc
error[E0277]: the trait bound `OpaqueType::{opaque#0}: Copy` is not satisfied
--> abcd.rs:7:19
|
7 | type OpaqueType = unsafe<> impl OpaqueTrait;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `OpaqueType::{opaque#0}`
error: internal compiler error: compiler/rustc_ty_utils/src/layout.rs:720:13: layout_of: unexpected type `_`
thread 'rustc' panicked at compiler/rustc_ty_utils/src/layout.rs:720:13:
Box<dyn Any>
Backtrace
thread 'rustc' panicked at compiler/rustc_ty_utils/src/layout.rs:720:13:
Box<dyn Any>
stack backtrace:
0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
5: rustc_middle::util::bug::bug_fmt
6: rustc_ty_utils::layout::layout_of
[... omitted 2 frames ...]
7: <rustc_middle::ty::layout::LayoutCx as rustc_middle::ty::layout::LayoutOf>::spanned_layout_of
8: rustc_ty_utils::layout::layout_of
[... omitted 2 frames ...]
9: rustc_transmute::layout::rustc::layout_of
10: <rustc_transmute::layout::tree::Tree<rustc_transmute::layout::rustc::Def, rustc_transmute::layout::rustc::Ref>>::from_ty
11: <rustc_transmute::rustc::TransmuteTypeEnv>::is_transmutable
12: <rustc_trait_selection::solve::delegate::SolverDelegate as rustc_next_trait_solver::delegate::SolverDelegate>::is_transmutable
13: <rustc_type_ir::predicate::TraitPredicate<rustc_middle::ty::context::TyCtxt> as rustc_next_trait_solver::solve::assembly::GoalKind<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>>::consider_builtin_transmute_candidate
14: <rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>>::assemble_and_evaluate_candidates::<rustc_type_ir::predicate::TraitPredicate<rustc_middle::ty::context::TyCtxt>>
15: <rustc_type_ir::search_graph::SearchGraph<rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<rustc_trait_selection::solve::delegate::SolverDelegate>, rustc_middle::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2}
16: <rustc_type_ir::search_graph::SearchGraph<rustc_next_trait_solver::solve::search_graph::SearchGraphDelegate<rustc_trait_selection::solve::delegate::SolverDelegate>, rustc_middle::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>
17: <rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>>::evaluate_goal_raw
18: <rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>>::evaluate_goal
19: <rustc_next_trait_solver::solve::eval_ctxt::EvalCtxt<rustc_trait_selection::solve::delegate::SolverDelegate, rustc_middle::ty::context::TyCtxt>>::enter_root::<core::result::Result<(rustc_next_trait_solver::solve::HasChanged, rustc_type_ir::solve::Certainty), rustc_type_ir::solve::NoSolution>, <rustc_trait_selection::solve::delegate::SolverDelegate as rustc_next_trait_solver::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal::{closure#0}>
20: <rustc_trait_selection::solve::fulfill::FulfillmentCtxt<rustc_infer::traits::engine::ScrubbedTraitError> as rustc_infer::traits::engine::TraitEngine<rustc_infer::traits::engine::ScrubbedTraitError>>::select_where_possible
21: <rustc_trait_selection::solve::fulfill::FulfillmentCtxt<rustc_infer::traits::engine::ScrubbedTraitError> as rustc_infer::traits::engine::TraitEngine<rustc_infer::traits::engine::ScrubbedTraitError>>::select_all_or_error
22: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
23: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
24: <rustc_infer::infer::InferCtxt>::probe::<(), <rustc_trait_selection::traits::coherence::AmbiguityCausesVisitor as rustc_trait_selection::solve::inspect::analyse::ProofTreeVisitor>::visit_goal::{closure#2}>
25: <rustc_trait_selection::traits::coherence::AmbiguityCausesVisitor as rustc_trait_selection::solve::inspect::analyse::ProofTreeVisitor>::visit_goal
26: rustc_trait_selection::traits::coherence::overlap
27: rustc_trait_selection::traits::coherence::overlapping_impls
28: <rustc_middle::traits::specialization_graph::Children as rustc_trait_selection::traits::specialize::specialization_graph::ChildrenExt>::insert
29: <rustc_middle::traits::specialization_graph::Graph as rustc_trait_selection::traits::specialize::specialization_graph::GraphExt>::insert
30: rustc_trait_selection::traits::specialize::specialization_graph_provider
[... omitted 1 frame ...]
31: rustc_hir_analysis::coherence::coherent_trait
[... omitted 1 frame ...]
32: rustc_middle::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 1]>>, ()>
33: rustc_hir_analysis::check::wfcheck::check_item
34: rustc_hir_analysis::check::wfcheck::check_well_formed
[... omitted 1 frame ...]
35: <rustc_middle::hir::ModuleItems>::par_opaques::<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#4}>::{closure#0}
36: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
[... omitted 1 frame ...]
37: rustc_hir_analysis::check_crate
38: rustc_interface::passes::run_required_analyses
39: rustc_interface::passes::analysis
[... omitted 1 frame ...]
40: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
41: 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.
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 `/Users/jisukbyun/workspace/250203 scratch/rustc-ice-2025-05-22T15_39_19-77784.txt` to your bug report
query stack during panic:
panicked at /rustc/bf64d66bd58719fac2585eae5e546e5e1d9947f5/compiler/rustc_type_ir/src/ty_kind.rs:864:17:
thread panicked while processing panic. aborting.
[1] 77784 abort rustc abcd.rs
Bisects to
searched nightlies: from nightly-2024-05-01 to nightly-2025-05-22
regressed nightly: nightly-2024-12-25
searched commit range: bdc6b3d...409998c
regressed commit: f334342
bisected with cargo-bisect-rustc v0.6.9
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
cargo bisect-rustc --end=2025-05-22 --regress ice --preserve --script rustc -- abcd.rs
Notes
-
ICE location:
compiler/rustc_ty_utils/src/layout.rs Line-720
rust/compiler/rustc_ty_utils/src/layout.rs
Lines 713 to 722 in bf64d66
-
Closed ICE Issue-139152 has identical ICE location.
-
Second panic (while printing query stack I guess) occured at:
compiler/rustc_type_ir/src/ty_kind.rs Line-864
rust/compiler/rustc_type_ir/src/ty_kind.rs
Lines 857 to 869 in bf64d66
-
I'm not sure whether all three features are needed to trigger the ICE.
@rustbot label +F-unsafe_binders +F-transmutability +F-type_alias_impl_trait