1
Fork 0

rework borrowck errors so that it's harder to not set tainted

This commit is contained in:
Michael Goulet 2022-02-07 22:37:32 -08:00
parent 8b7b0a0e49
commit 29c2bb51c0
7 changed files with 119 additions and 74 deletions

View file

@ -287,8 +287,8 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
if let Some(error_reported) = tcx.typeck_opt_const_arg(def).tainted_by_errors {
return Err(ErrorHandled::Reported(error_reported));
}
if tcx.mir_borrowck_opt_const_arg(def).tainted_by_errors {
return Err(ErrorHandled::Reported(ErrorReported {}));
if let Some(error_reported) = tcx.mir_borrowck_opt_const_arg(def).tainted_by_errors {
return Err(ErrorHandled::Reported(error_reported));
}
}
if !tcx.is_mir_available(def.did) {

View file

@ -516,8 +516,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if let Some(error_reported) = self.tcx.typeck_opt_const_arg(def).tainted_by_errors {
throw_inval!(AlreadyReported(error_reported));
}
if self.tcx.mir_borrowck_opt_const_arg(def).tainted_by_errors {
throw_inval!(AlreadyReported(rustc_errors::ErrorReported {}));
if let Some(error_reported) =
self.tcx.mir_borrowck_opt_const_arg(def).tainted_by_errors
{
throw_inval!(AlreadyReported(error_reported));
}
}
}