fix the check for which expressions read never type

...wrt `type_ascribe`/unsafe binders -- the check was infinitely
recursive before.
This commit is contained in:
Waffle Lapkin 2025-12-02 13:06:15 +01:00
parent 784b283b29
commit c5f15bd607
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -251,7 +251,7 @@ impl<'tcx> TyCtxt<'tcx> {
// Place-preserving expressions only constitute reads if their
// parent expression constitutes a read.
ExprKind::Type(..) | ExprKind::UnsafeBinderCast(..) => {
self.expr_guaranteed_to_constitute_read_for_never(expr)
self.expr_guaranteed_to_constitute_read_for_never(parent_expr)
}
ExprKind::Assign(lhs, _, _) => {

View file

@ -3,7 +3,7 @@
// This checks that a nested type ascription doesn't cause a crash when the
// compiler checks if it constitutes a read of the never type.
//
//@ known-bug: #149542
//@ check-pass
#![feature(never_type)]
#![feature(type_ascription)]