@@ -123,7 +123,7 @@ impl Qualifs<'mir, 'tcx> {
123
123
has_mut_interior. get ( ) . contains ( local) || self . indirectly_mutable ( ccx, local, location)
124
124
}
125
125
126
- fn in_return_place ( & mut self , ccx : & ' mir ConstCx < ' mir , ' tcx > ) -> ConstQualifs {
126
+ fn in_return_place ( & mut self , ccx : & ' mir ConstCx < ' mir , ' tcx > , error_occured : bool ) -> ConstQualifs {
127
127
// Find the `Return` terminator if one exists.
128
128
//
129
129
// If no `Return` terminator exists, this MIR is divergent. Just return the conservative
@@ -139,7 +139,7 @@ impl Qualifs<'mir, 'tcx> {
139
139
. map ( |( bb, _) | bb) ;
140
140
141
141
let return_block = match return_block {
142
- None => return qualifs:: in_any_value_of_ty ( ccx, ccx. body . return_ty ( ) ) ,
142
+ None => return qualifs:: in_any_value_of_ty ( ccx, ccx. body . return_ty ( ) , error_occured ) ,
143
143
Some ( bb) => bb,
144
144
} ;
145
145
@@ -170,6 +170,7 @@ impl Qualifs<'mir, 'tcx> {
170
170
needs_drop : self . needs_drop ( ccx, RETURN_PLACE , return_loc) ,
171
171
has_mut_interior : self . has_mut_interior ( ccx, RETURN_PLACE , return_loc) ,
172
172
custom_eq,
173
+ error_occured,
173
174
}
174
175
}
175
176
}
@@ -276,7 +277,7 @@ impl Validator<'mir, 'tcx> {
276
277
}
277
278
278
279
pub fn qualifs_in_return_place ( & mut self ) -> ConstQualifs {
279
- self . qualifs . in_return_place ( self . ccx )
280
+ self . qualifs . in_return_place ( self . ccx , self . error_emitted )
280
281
}
281
282
282
283
/// Emits an error if an expression cannot be evaluated in the current context.
0 commit comments