Skip to content

Commit c5f15bd

Browse files
committed
fix the check for which expressions read never type
...wrt `type_ascribe`/unsafe binders -- the check was infinitely recursive before.
1 parent 784b283 commit c5f15bd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_middle/src/hir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl<'tcx> TyCtxt<'tcx> {
251251
// Place-preserving expressions only constitute reads if their
252252
// parent expression constitutes a read.
253253
ExprKind::Type(..) | ExprKind::UnsafeBinderCast(..) => {
254-
self.expr_guaranteed_to_constitute_read_for_never(expr)
254+
self.expr_guaranteed_to_constitute_read_for_never(parent_expr)
255255
}
256256

257257
ExprKind::Assign(lhs, _, _) => {

tests/crashes/nested_type_ascription.rs renamed to tests/ui/unreachable-code/nested_type_ascription.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This checks that a nested type ascription doesn't cause a crash when the
44
// compiler checks if it constitutes a read of the never type.
55
//
6-
//@ known-bug: #149542
6+
//@ check-pass
77

88
#![feature(never_type)]
99
#![feature(type_ascription)]

0 commit comments

Comments
 (0)