Bug
assert_assignable in compiler/rustc_codegen_cranelift/src/value_and_place.rs:935 handles ty::Closure, ty::Coroutine, and ty::CoroutineWitness with component-wise type comparison (iterating over args types), but ty::CoroutineClosure falls through to the _ => arm which does a strict assert_eq!.
When two CoroutineClosure types with the same def_id but different region substitutions are compared (normal during codegen when regions are erased at different stages), the assert_eq! panics because the types are structurally equivalent but not == due to region differences.
Code at fault
// value_and_place.rs:935-983
(&ty::Closure(def_id_a, args_a), &ty::Closure(def_id_b, args_b))
if def_id_a == def_id_b => { /* component-wise comparison */ }
(&ty::Coroutine(def_id_a, args_a), &ty::Coroutine(def_id_b, args_b))
if def_id_a == def_id_b => { /* component-wise comparison */ }
(&ty::CoroutineWitness(def_id_a, args_a), &ty::CoroutineWitness(def_id_b, args_b))
if def_id_a == def_id_b => { /* component-wise comparison */ }
// MISSING: CoroutineClosure
_ => {
assert_eq!(from_ty, to_ty, "Can't write value with incompatible type...");
}
Fix
Add a (&ty::CoroutineClosure(def_id_a, args_a), &ty::CoroutineClosure(def_id_b, args_b)) arm with the same component-wise comparison logic used by Closure and Coroutine.
Impact
ICE in cranelift debug builds when async closures have differing region substitutions between source and destination types. P-medium because it only affects cranelift backend (not LLVM) and only in debug assertion mode.
Pattern
Same CoroutineClosure-missing-from-match pattern as #477, #478, #479, #483, #484.
Bug
assert_assignableincompiler/rustc_codegen_cranelift/src/value_and_place.rs:935handlesty::Closure,ty::Coroutine, andty::CoroutineWitnesswith component-wise type comparison (iterating over args types), butty::CoroutineClosurefalls through to the_ =>arm which does a strictassert_eq!.When two
CoroutineClosuretypes with the samedef_idbut different region substitutions are compared (normal during codegen when regions are erased at different stages), theassert_eq!panics because the types are structurally equivalent but not==due to region differences.Code at fault
Fix
Add a
(&ty::CoroutineClosure(def_id_a, args_a), &ty::CoroutineClosure(def_id_b, args_b))arm with the same component-wise comparison logic used by Closure and Coroutine.Impact
ICE in cranelift debug builds when async closures have differing region substitutions between source and destination types. P-medium because it only affects cranelift backend (not LLVM) and only in debug assertion mode.
Pattern
Same CoroutineClosure-missing-from-match pattern as #477, #478, #479, #483, #484.