1
Fork 0

Avoid various uses of Option<Span> in favor of using DUMMY_SP in the few cases that used None

This commit is contained in:
Oli Scherer 2024-03-14 09:10:28 +00:00
parent a42873e85b
commit adda9da604
34 changed files with 70 additions and 75 deletions

View file

@ -968,7 +968,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
ty: Ty<'tcx>,
) -> Option<ty::Const<'tcx>> {
use rustc_middle::mir::interpret::ErrorHandled;
match self.infcx.try_const_eval_resolve(param_env, unevaluated, ty, None) {
match self.infcx.try_const_eval_resolve(param_env, unevaluated, ty, DUMMY_SP) {
Ok(ct) => Some(ct),
Err(ErrorHandled::Reported(e, _)) => {
Some(ty::Const::new_error(self.tcx(), e.into(), ty))

View file

@ -786,7 +786,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
match selcx.infcx.const_eval_resolve(
obligation.param_env,
unevaluated,
Some(obligation.cause.span),
obligation.cause.span,
) {
Ok(Some(valtree)) => Ok(ty::Const::new_value(selcx.tcx(),valtree, c.ty())),
Ok(None) => {

View file

@ -68,7 +68,7 @@ pub fn is_const_evaluatable<'tcx>(
tcx.dcx().span_bug(span, "evaluating `ConstKind::Expr` is not currently supported");
}
ty::ConstKind::Unevaluated(uv) => {
let concrete = infcx.const_eval_resolve(param_env, uv, Some(span));
let concrete = infcx.const_eval_resolve(param_env, uv, span);
match concrete {
Err(ErrorHandled::TooGeneric(_)) => {
Err(NotConstEvaluatable::Error(infcx.dcx().span_delayed_bug(
@ -99,7 +99,7 @@ pub fn is_const_evaluatable<'tcx>(
// and hopefully soon change this to an error.
//
// See #74595 for more details about this.
let concrete = infcx.const_eval_resolve(param_env, uv, Some(span));
let concrete = infcx.const_eval_resolve(param_env, uv, span);
match concrete {
// If we're evaluating a generic foreign constant, under a nightly compiler while
// the current crate does not enable `feature(generic_const_exprs)`, abort

View file

@ -600,7 +600,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
obligation.param_env,
unevaluated,
c.ty(),
Some(obligation.cause.span),
obligation.cause.span,
) {
Ok(val) => Ok(val),
Err(e) => {

View file

@ -949,7 +949,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation.param_env,
unevaluated,
c.ty(),
Some(obligation.cause.span),
obligation.cause.span,
) {
Ok(val) => Ok(val),
Err(e) => Err(e),