[ICE]: `unimplemented` in `is_trivially_not_async_drop` (w. feature unsafe_binders)
Open
Nobody has claimed this yet.
C-bug
F-unsafe_binders
I-ICE
needs-triage
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
#![feature(unsafe_binders)]
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
#[derive(Copy, Clone)]
struct Adt<'a>(&'a ());
use std::{cell::RefCell, ops::Coroutine, sync::Arc};
pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> {
#[coroutine]
|| {
yield;
t
}
}
fn make_non_send_coroutine2() -> (unsafe<'a> Adt<'a>, Box<dyn Send>) {
make_gen2(Arc::new(RefCell::new(0)))
}
fn test2() {
let send_gen = #[coroutine]
|| {
let _non_send_gen = make_non_send_coroutine2();
yield;
};
}
fn main() {}
A mutant of tests/ui/coroutine/issue-68112.rs, manually reduced.
Meta
rustc --version --verbose:
rustc 1.99.0-nightly (8ab9fdff5 2026-07-30)
binary: rustc
commit-hash: 8ab9fdff5a91b9f2b5ed57fb0275452d9a0d0280
commit-date: 2026-07-30
host: x86_64-apple-darwin
release: 1.99.0-nightly
LLVM version: 22.1.8
Error output
warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> asdf1234.rs:1:12
|
1 | #![feature(unsafe_binders)]
| ^^^^^^^^^^^^^^
|
= note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
--> asdf1234.rs:17:5
|
9 | pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> {
| -------------------------- the found opaque type
...
16 | fn make_non_send_coroutine2() -> (unsafe<'a> Adt<'a>, Box<dyn Send>) {
| ----------------------------------- expected `(unsafe<'a> Adt<'a>, Box<(dyn Send + 'static)>)` because of return type
17 | make_gen2(Arc::new(RefCell::new(0)))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(unsafe<'a> Adt<'a>, Box<dyn Send>)`, found opaque type
|
= note: expected tuple `(unsafe<'a> Adt<'a>, Box<(dyn Send + 'static)>)`
found opaque type `impl Coroutine<Return = Arc<RefCell<{integer}>>>`
thread 'rustc' (9809511) panicked at /rustc-dev/8ab9fdff5a91b9f2b5ed57fb0275452d9a0d0280/compiler/rustc_middle/src/ty/util.rs:1306:36:
not implemented
Backtrace
thread 'rustc' (9809511) panicked at /rustc-dev/8ab9fdff5a91b9f2b5ed57fb0275452d9a0d0280/compiler/rustc_middle/src/ty/util.rs:1306:36:
not implemented
stack backtrace:
0: 0x11842ebe4 - <<std[f2c2cedbd8f6b153]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[784a811b45041e7]::fmt::Display>::fmt
1: 0x114e978a7 - core[784a811b45041e7]::fmt::write
2: 0x118445a5b - <std[f2c2cedbd8f6b153]::sys::stdio::unix::Stderr as core[784a811b45041e7]::io::write::Write>::write_fmt
3: 0x1183fa960 - std[f2c2cedbd8f6b153]::panicking::default_hook::{closure#0}
4: 0x11841f267 - std[f2c2cedbd8f6b153]::panicking::default_hook
5: 0x115ca51e1 - std[f2c2cedbd8f6b153]::panicking::update_hook::<alloc[7e0cdee874db494e]::boxed::Box<rustc_driver_impl[24407bf9feb5cca2]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x11841f877 - std[f2c2cedbd8f6b153]::panicking::panic_with_hook
7: 0x1183faa42 - std[f2c2cedbd8f6b153]::panicking::panic_handler::{closure#0}
8: 0x1183f1489 - std[f2c2cedbd8f6b153]::sys::backtrace::__rust_end_short_backtrace::<std[f2c2cedbd8f6b153]::panicking::panic_handler::{closure#0}, !>
9: 0x1183fbfc4 - __rustc[6d8fcb733e91df4b]::rust_begin_unwind
10: 0x118509a9b - core[784a811b45041e7]::panicking::panic_fmt
11: 0x118509a6e - core[784a811b45041e7]::panicking::panic
12: 0x116b41b74 - <rustc_middle[af96f57ab0f7186f]::ty::Ty>::is_trivially_not_async_drop
13: 0x116b41b52 - <rustc_middle[af96f57ab0f7186f]::ty::Ty>::is_trivially_not_async_drop
14: 0x116b4122b - <rustc_middle[af96f57ab0f7186f]::ty::Ty>::is_async_drop
15: 0x116d06209 - <rustc_mir_build[9bce8ebed9edaeb6]::builder::Builder>::is_async_drop_impl
16: 0x116d070b1 - <rustc_mir_build[9bce8ebed9edaeb6]::builder::Builder>::pop_scope
17: 0x116ce06d4 - <rustc_mir_build[9bce8ebed9edaeb6]::builder::Builder>::ast_block_stmts
18: 0x116ce0dcf - <rustc_mir_build[9bce8ebed9edaeb6]::builder::Builder>::ast_block
19: 0x116ced757 - <rustc_mir_build[9bce8ebed9edaeb6]::builder::Builder>::expr_into_dest
20: 0x116cc664c - <rustc_mir_build[9bce8ebed9edaeb6]::builder::Builder>::expr_into_dest::{closure#0}
21: 0x116ced13a - <rustc_mir_build[9bce8ebed9edaeb6]::builder::Builder>::expr_into_dest
22: 0x116d3965c - rustc_mir_build[9bce8ebed9edaeb6]::builder::build_mir_inner_impl
23: 0x116f0155d - rustc_mir_transform[8b8727d42f95eaa2]::mir_built
24: 0x117550a25 - rustc_query_impl[2186e76c44399dcc]::execution::try_execute_query::<rustc_data_structures[865c5849d7a29d1f]::vec_cache::VecCache<rustc_span[16b4ad8c2c3c9fc3]::def_id::LocalDefId, rustc_middle[af96f57ab0f7186f]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[af96f57ab0f7186f]::dep_graph::graph::DepNodeIndex>, false>
25: 0x1177ee6e9 - rustc_query_impl[2186e76c44399dcc]::query_impl::mir_built::execute_query_non_incr::__rust_end_short_backtrace
26: 0x116cd43e0 - <rustc_mir_build[9bce8ebed9edaeb6]::check_unsafety::UnsafetyVisitor>::visit_inner_body
27: 0x116dba8eb - <rustc_mir_build[9bce8ebed9edaeb6]::check_unsafety::UnsafetyVisitor as rustc_middle[af96f57ab0f7186f]::thir::visit::Visitor>::visit_expr
28: 0x116dbb001 - <rustc_mir_build[9bce8ebed9edaeb6]::check_unsafety::UnsafetyVisitor as rustc_middle[af96f57ab0f7186f]::thir::visit::Visitor>::visit_expr
29: 0x116c98383 - rustc_middle[af96f57ab0f7186f]::thir::visit::walk_block::<rustc_mir_build[9bce8ebed9edaeb6]::check_unsafety::UnsafetyVisitor>
30: 0x116dba8f6 - <rustc_mir_build[9bce8ebed9edaeb6]::check_unsafety::UnsafetyVisitor as rustc_middle[af96f57ab0f7186f]::thir::visit::Visitor>::visit_expr
31: 0x116dbb001 - <rustc_mir_build[9bce8ebed9edaeb6]::check_unsafety::UnsafetyVisitor as rustc_middle[af96f57ab0f7186f]::thir::visit::Visitor>::visit_expr
32: 0x116d34337 - rustc_mir_build[9bce8ebed9edaeb6]::check_unsafety::check_unsafety
33: 0x11753ebe0 - rustc_query_impl[2186e76c44399dcc]::execution::try_execute_query::<rustc_data_structures[865c5849d7a29d1f]::vec_cache::VecCache<rustc_span[16b4ad8c2c3c9fc3]::def_id::LocalDefId, rustc_middle[af96f57ab0f7186f]::query::erase::ErasedData<[u8; 0usize]>, rustc_middle[af96f57ab0f7186f]::dep_graph::graph::DepNodeIndex>, false>
34: 0x1177b65cb - rustc_query_impl[2186e76c44399dcc]::query_impl::check_unsafety::execute_query_non_incr::__rust_end_short_backtrace
35: 0x1166c1972 - <rustc_middle[af96f57ab0f7186f]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[425151dc7a4e057d]::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
36: 0x1166ed950 - rustc_interface[425151dc7a4e057d]::passes::analysis
37: 0x11757eef7 - rustc_query_impl[2186e76c44399dcc]::execution::try_execute_query::<rustc_middle[af96f57ab0f7186f]::query::caches::SingleCache<rustc_middle[af96f57ab0f7186f]::query::erase::ErasedData<[u8; 0usize]>>, false>
38: 0x1177ec3d2 - rustc_query_impl[2186e76c44399dcc]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
39: 0x115c50180 - rustc_interface[425151dc7a4e057d]::passes::create_and_enter_global_ctxt::<core[784a811b45041e7]::option::Option<rustc_interface[425151dc7a4e057d]::queries::Linker>, rustc_driver_impl[24407bf9feb5cca2]::run_compiler::{closure#0}::{closure#1}>
40: 0x115ca3b6f - rustc_interface[425151dc7a4e057d]::interface::run_compiler::<(), rustc_driver_impl[24407bf9feb5cca2]::run_compiler::{closure#0}>::{closure#2}
41: 0x115c9889c - std[f2c2cedbd8f6b153]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[425151dc7a4e057d]::util::run_in_thread_with_globals<rustc_interface[425151dc7a4e057d]::util::run_in_thread_pool_with_globals<rustc_interface[425151dc7a4e057d]::interface::run_compiler<(), rustc_driver_impl[24407bf9feb5cca2]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
42: 0x115caa42b - <std[f2c2cedbd8f6b153]::thread::lifecycle::spawn_unchecked<rustc_interface[425151dc7a4e057d]::util::run_in_thread_with_globals<rustc_interface[425151dc7a4e057d]::util::run_in_thread_pool_with_globals<rustc_interface[425151dc7a4e057d]::interface::run_compiler<(), rustc_driver_impl[24407bf9feb5cca2]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[784a811b45041e7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
43: 0x11842b79d - <std[f2c2cedbd8f6b153]::sys::thread::unix::Thread>::new::thread_start
44: 0x7ff81b77ee05 - __pthread_start
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 `/Volumes/T7/workspace/tmp/rustc-ice-2026-07-31T09_35_18-13878.txt` to your bug report
note: rustc 1.99.0-nightly (8ab9fdff5 2026-07-30) running on x86_64-apple-darwin
query stack during panic:
#0 [mir_built] building MIR for `test2::{closure#0}`
#1 [check_unsafety] unsafety-checking `test2`
... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0308`.
Notes
- ICE location:
compiler/rustc_middle/src/ty/util.rs Line-1306
https://github.com/rust-lang/rust/blob/8ab9fdff5a91b9f2b5ed57fb0275452d9a0d0280/compiler/rustc_middle/src/ty/util.rs#L1302-L1310
@rustbot label +F-unsafe_binders
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with compiler/rustc_middle/src/ty/util.rs around line 1306 and the MIR/unsafety query stack shown in the report; run the minimized example on the reported nightly to reproduce the ICE. Done means the example produces a normal compiler diagnostic without panicking, with a regression test based on tests/ui/coroutine/issue-68112.rs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100