Closed
Description
Code
#![feature(unsafe_binders)]
#![allow(incomplete_features)]
use std::unsafe_binder::unwrap_binder;
fn id<T>(x: unsafe<> T) -> T {
unwrap_binder!(x)
}
fn main() {}
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 `T: Copy` is not satisfied
--> abc.rs:5:13
|
5 | fn id<T>(x: unsafe<> T) -> T {
| ^^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
help: consider restricting type parameter `T` with trait `Copy`
|
5 | fn id<T: std::marker::Copy>(x: unsafe<> T) -> T {
| +++++++++++++++++++
error[E0133]: unsafe binder cast is unsafe and requires unsafe block or unsafe fn
--> abc.rs:6:5
|
6 | unwrap_binder!(x)
| ^^^^^^^^^^^^^^^^^ unsafe binder cast
|
= note: this error originates in the macro `unwrap_binder` (in Nightly builds, run with -Z macro-backtrace for more info)
error: internal compiler error: compiler/rustc_mir_transform/src/elaborate_drop.rs:1281:18: open drop from non-ADT `Binder { value: T/#0, bound_vars: [] }`
--> abc.rs:7:1
|
7 | }
| ^
thread 'rustc' panicked at compiler/rustc_mir_transform/src/elaborate_drop.rs:1281:18:
Box<dyn Any>
Backtrace
thread 'rustc' panicked at compiler/rustc_mir_transform/src/elaborate_drop.rs:1281:18:
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_errors::DiagCtxtHandle>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
4: 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::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}, !>
6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
7: <rustc_mir_transform::elaborate_drop::DropCtxt<rustc_mir_transform::elaborate_drops::ElaborateDropsCtxt>>::elaborate_drop
8: <rustc_mir_transform::elaborate_drops::ElaborateDrops as rustc_mir_transform::pass_manager::MirPass>::run_pass
9: rustc_mir_transform::pass_manager::run_passes_inner
10: rustc_mir_transform::run_analysis_to_runtime_passes
11: rustc_mir_transform::mir_drops_elaborated_and_const_checked
[... omitted 1 frame ...]
12: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
13: rustc_interface::passes::run_required_analyses
14: rustc_interface::passes::analysis
[... omitted 1 frame ...]
15: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
16: 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-22T13_24_03-44785.txt` to your bug report
query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `id`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0133, E0277.
For more information about an error, try `rustc --explain E0133`.
Bisects to
searched nightlies: from nightly-2024-05-01 to nightly-2025-05-22
regressed nightly: nightly-2025-02-02
searched commit range: 854f225...8239a37
regressed commit: 8239a37
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 -- abc.rs
********************************************************************************
Regression in 8239a37f9c0951a037cfc51763ea52a20e71e6bd
********************************************************************************
Attempting to search unrolled perf builds
Found commits ["be995312", "150da37e", "20325765", "9264389d", "d38d22f1", "590d9bf4"]
installing be995312299b441ca428237a2b2ba69b769d517e
rust-std-nightly-x86_64-unknown-linux-gnu: 30.31 MB / 30.31 MB [=======================================================================] 100.00 % 13.40 MB/s testing...
RESULT: be995312299b441ca428237a2b2ba69b769d517e, ===> Script found ICE
Regression in https://github.com/rust-lang-ci/rust/commit/be995312299b441ca428237a2b2ba69b769d517e
The PR introducing the regression in this rollup is #130514: Implement MIR lowering for unsafe binders
Notes
-
ICE location:
rustc_mir_transform/src/elaborate_drop.rs Line-1281
rust/compiler/rustc_mir_transform/src/elaborate_drop.rs
Lines 1258 to 1283 in bf64d66
-
ICE:
open drop from non-ADT
#140930 has identical ICE location and currently open, but it requires different feature & bisection results
@rustbot label +F-unsafe_binders