From eeca87b8c7316c017f50b4e22b47164926ef24fe Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 14 Mar 2024 09:10:28 +0000 Subject: [PATCH] Avoid various uses of `Option` in favor of using `DUMMY_SP` in the few cases that used `None` --- src/constant.rs | 2 +- src/intrinsics/mod.rs | 6 ++++-- src/intrinsics/simd.rs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/constant.rs b/src/constant.rs index 39fa277fedc..fc9b0f6ef02 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -74,7 +74,7 @@ pub(crate) fn eval_mir_constant<'tcx>( let cv = fx.monomorphize(constant.const_); // This cannot fail because we checked all required_consts in advance. let val = cv - .eval(fx.tcx, ty::ParamEnv::reveal_all(), Some(constant.span)) + .eval(fx.tcx, ty::ParamEnv::reveal_all(), constant.span) .expect("erroneous constant missed by mono item collection"); (val, cv.ty()) } diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 8b86a116df1..c802d9bbefb 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -728,8 +728,10 @@ fn codegen_regular_intrinsic_call<'tcx>( | sym::variant_count => { intrinsic_args!(fx, args => (); intrinsic); - let const_val = - fx.tcx.const_eval_instance(ParamEnv::reveal_all(), instance, None).unwrap(); + let const_val = fx + .tcx + .const_eval_instance(ParamEnv::reveal_all(), instance, source_info.span) + .unwrap(); let val = crate::constant::codegen_const_value(fx, const_val, ret.layout().ty); ret.write_cvalue(fx, val); } diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs index 79da970a58e..4d55a95aa9d 100644 --- a/src/intrinsics/simd.rs +++ b/src/intrinsics/simd.rs @@ -131,7 +131,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( let idx = generic_args[2] .expect_const() - .eval(fx.tcx, ty::ParamEnv::reveal_all(), Some(span)) + .eval(fx.tcx, ty::ParamEnv::reveal_all(), span) .unwrap() .unwrap_branch();