1
Fork 0

Rollup merge of #111602 - tmiasko:erroneous-constant-used, r=oli-obk

Suppress "erroneous constant used" for constants tainted by errors

When constant evaluation fails because its MIR is tainted by errors,
suppress note indicating that erroneous constant was used, since those
errors have to be fixed regardless of the constant being used or not.

Fixes #110891.
This commit is contained in:
Nilstrieb 2023-05-16 11:39:39 +02:00 committed by GitHub
commit 3e34be004e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 76 additions and 248 deletions

View file

@ -801,7 +801,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
span: tcx.def_span(unevaluated.def),
unevaluated: unevaluated,
});
Err(ErrorHandled::Reported(reported))
Err(ErrorHandled::Reported(reported.into()))
}
Err(err) => Err(err),
}

View file

@ -79,7 +79,7 @@ pub fn is_const_evaluatable<'tcx>(
"Missing value for constant, but no error reported?",
)))
}
Err(ErrorHandled::Reported(e)) => Err(NotConstEvaluatable::Error(e)),
Err(ErrorHandled::Reported(e)) => Err(NotConstEvaluatable::Error(e.into())),
Ok(_) => Ok(()),
}
}
@ -147,7 +147,7 @@ pub fn is_const_evaluatable<'tcx>(
Err(err)
}
Err(ErrorHandled::Reported(e)) => Err(NotConstEvaluatable::Error(e)),
Err(ErrorHandled::Reported(e)) => Err(NotConstEvaluatable::Error(e.into())),
Ok(_) => Ok(()),
}
}

View file

@ -615,7 +615,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
(Err(ErrorHandled::Reported(reported)), _)
| (_, Err(ErrorHandled::Reported(reported))) => ProcessResult::Error(
CodeSelectionError(SelectionError::NotConstEvaluatable(
NotConstEvaluatable::Error(reported),
NotConstEvaluatable::Error(reported.into()),
)),
),
(Err(ErrorHandled::TooGeneric), _) | (_, Err(ErrorHandled::TooGeneric)) => {