1
Fork 0

add tainted_by_errors to mir::Body

This commit is contained in:
Michael Goulet 2022-02-07 22:00:15 -08:00
parent 29c2bb51c0
commit a431174c23
10 changed files with 37 additions and 23 deletions

View file

@ -120,7 +120,7 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
fn in_return_place(
&mut self,
ccx: &'mir ConstCx<'mir, 'tcx>,
error_occured: Option<ErrorReported>,
tainted_by_errors: Option<ErrorReported>,
) -> ConstQualifs {
// Find the `Return` terminator if one exists.
//
@ -134,7 +134,9 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
.map(|(bb, _)| bb);
let return_block = match return_block {
None => return qualifs::in_any_value_of_ty(ccx, ccx.body.return_ty(), error_occured),
None => {
return qualifs::in_any_value_of_ty(ccx, ccx.body.return_ty(), tainted_by_errors);
}
Some(bb) => bb,
};
@ -166,7 +168,7 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
needs_non_const_drop: self.needs_non_const_drop(ccx, RETURN_PLACE, return_loc),
has_mut_interior: self.has_mut_interior(ccx, RETURN_PLACE, return_loc),
custom_eq,
error_occured,
tainted_by_errors,
}
}
}

View file

@ -17,14 +17,14 @@ use super::ConstCx;
pub fn in_any_value_of_ty<'tcx>(
cx: &ConstCx<'_, 'tcx>,
ty: Ty<'tcx>,
error_occured: Option<ErrorReported>,
tainted_by_errors: Option<ErrorReported>,
) -> ConstQualifs {
ConstQualifs {
has_mut_interior: HasMutInterior::in_any_value_of_ty(cx, ty),
needs_drop: NeedsDrop::in_any_value_of_ty(cx, ty),
needs_non_const_drop: NeedsNonConstDrop::in_any_value_of_ty(cx, ty),
custom_eq: CustomEq::in_any_value_of_ty(cx, ty),
error_occured,
tainted_by_errors,
}
}

View file

@ -974,6 +974,7 @@ pub fn promote_candidates<'tcx>(
vec![],
body.span,
body.generator_kind(),
body.tainted_by_errors,
);
let promoter = Promoter {