Skip to content

Commit

Permalink
Avoid various uses of Option<Span> in favor of using DUMMY_SP in …
Browse files Browse the repository at this point in the history
…the few cases that used `None`
  • Loading branch information
oli-obk committed Mar 18, 2024
1 parent 4b61629 commit eeca87b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
6 changes: 4 additions & 2 deletions src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit eeca87b

Please sign in to comment.