Skip to content

Commit 4608079

Browse files
authored
Rollup merge of rust-lang#122480 - oli-obk:const-eval-span-no-opt, r=RalfJung
Avoid various uses of `Option<Span>` in favor of using `DUMMY_SP` in the few cases that used `None` based on rust-lang#122471 `DUMMY_SP` is already the sentinel value we have that says "no span". We don't need to wrap these `Span`s in a separate `Option`.
2 parents 3cdcdaf + adda9da commit 4608079

File tree

34 files changed

+70
-75
lines changed

34 files changed

+70
-75
lines changed

compiler/rustc_codegen_cranelift/src/constant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub(crate) fn eval_mir_constant<'tcx>(
7474
let cv = fx.monomorphize(constant.const_);
7575
// This cannot fail because we checked all required_consts in advance.
7676
let val = cv
77-
.eval(fx.tcx, ty::ParamEnv::reveal_all(), Some(constant.span))
77+
.eval(fx.tcx, ty::ParamEnv::reveal_all(), constant.span)
7878
.expect("erroneous constant missed by mono item collection");
7979
(val, cv.ty())
8080
}

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,10 @@ fn codegen_regular_intrinsic_call<'tcx>(
728728
| sym::variant_count => {
729729
intrinsic_args!(fx, args => (); intrinsic);
730730

731-
let const_val =
732-
fx.tcx.const_eval_instance(ParamEnv::reveal_all(), instance, None).unwrap();
731+
let const_val = fx
732+
.tcx
733+
.const_eval_instance(ParamEnv::reveal_all(), instance, source_info.span)
734+
.unwrap();
733735
let val = crate::constant::codegen_const_value(fx, const_val, ret.layout().ty);
734736
ret.write_cvalue(fx, val);
735737
}

compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
131131

132132
let idx = generic_args[2]
133133
.expect_const()
134-
.eval(fx.tcx, ty::ParamEnv::reveal_all(), Some(span))
134+
.eval(fx.tcx, ty::ParamEnv::reveal_all(), span)
135135
.unwrap()
136136
.unwrap_branch();
137137

compiler/rustc_codegen_llvm/src/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
11291129
if name == sym::simd_shuffle_generic {
11301130
let idx = fn_args[2]
11311131
.expect_const()
1132-
.eval(tcx, ty::ParamEnv::reveal_all(), Some(span))
1132+
.eval(tcx, ty::ParamEnv::reveal_all(), span)
11331133
.unwrap()
11341134
.unwrap_branch();
11351135
let n = idx.len() as u64;

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use rustc_hir::{CoroutineDesugaring, CoroutineKind, CoroutineSource, Mutability}
1919
use rustc_middle::ty::layout::{IntegerExt, TyAndLayout};
2020
use rustc_middle::ty::{self, ExistentialProjection, ParamEnv, Ty, TyCtxt};
2121
use rustc_middle::ty::{GenericArgKind, GenericArgsRef};
22+
use rustc_span::DUMMY_SP;
2223
use rustc_target::abi::Integer;
2324
use smallvec::SmallVec;
2425

@@ -704,7 +705,7 @@ fn push_const_param<'tcx>(tcx: TyCtxt<'tcx>, ct: ty::Const<'tcx>, output: &mut S
704705
// avoiding collisions and will make the emitted type names shorter.
705706
let hash_short = tcx.with_stable_hashing_context(|mut hcx| {
706707
let mut hasher = StableHasher::new();
707-
let ct = ct.eval(tcx, ty::ParamEnv::reveal_all(), None).unwrap();
708+
let ct = ct.eval(tcx, ty::ParamEnv::reveal_all(), DUMMY_SP).unwrap();
708709
hcx.while_hashing_spans(false, |hcx| ct.hash_stable(hcx, &mut hasher));
709710
hasher.finish::<Hash64>()
710711
});

compiler/rustc_codegen_ssa/src/mir/constant.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
2424
// `MirUsedCollector` visited all required_consts before codegen began, so if we got here
2525
// there can be no more constants that fail to evaluate.
2626
self.monomorphize(constant.const_)
27-
.eval(self.cx.tcx(), ty::ParamEnv::reveal_all(), Some(constant.span))
27+
.eval(self.cx.tcx(), ty::ParamEnv::reveal_all(), constant.span)
2828
.expect("erroneous constant missed by mono item collection")
2929
}
3030

@@ -56,11 +56,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
5656
other => span_bug!(constant.span, "{other:#?}"),
5757
};
5858
let uv = self.monomorphize(uv);
59-
self.cx.tcx().const_eval_resolve_for_typeck(
60-
ty::ParamEnv::reveal_all(),
61-
uv,
62-
Some(constant.span),
63-
)
59+
self.cx.tcx().const_eval_resolve_for_typeck(ty::ParamEnv::reveal_all(), uv, constant.span)
6460
}
6561

6662
/// process constant containing SIMD shuffle indices

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
130130
| sym::variant_count => {
131131
let value = bx
132132
.tcx()
133-
.const_eval_instance(ty::ParamEnv::reveal_all(), instance, None)
133+
.const_eval_instance(ty::ParamEnv::reveal_all(), instance, span)
134134
.unwrap();
135135
OperandRef::from_const(bx, value, ret_ty).immediate_or_packed_pair(bx)
136136
}

compiler/rustc_const_eval/src/interpret/eval_context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
826826
for &const_ in &body.required_consts {
827827
let c = self
828828
.instantiate_from_current_frame_and_normalize_erasing_regions(const_.const_)?;
829-
c.eval(*self.tcx, self.param_env, Some(const_.span)).map_err(|err| {
829+
c.eval(*self.tcx, self.param_env, const_.span).map_err(|err| {
830830
err.emit_note(*self.tcx);
831831
err
832832
})?;
@@ -1174,7 +1174,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
11741174
pub fn eval_mir_constant(
11751175
&self,
11761176
val: &mir::Const<'tcx>,
1177-
span: Option<Span>,
1177+
span: Span,
11781178
layout: Option<TyAndLayout<'tcx>>,
11791179
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
11801180
M::eval_mir_constant(self, *val, span, layout, |ecx, val, span, layout| {

compiler/rustc_const_eval/src/interpret/intrinsics.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
153153
sym::type_name => Ty::new_static_str(self.tcx.tcx),
154154
_ => bug!(),
155155
};
156-
let val = self.ctfe_query(|tcx| {
157-
tcx.const_eval_global_id(self.param_env, gid, Some(tcx.span))
158-
})?;
156+
let val =
157+
self.ctfe_query(|tcx| tcx.const_eval_global_id(self.param_env, gid, tcx.span))?;
159158
let val = self.const_val_to_op(val, ty, Some(dest.layout))?;
160159
self.copy_op(&val, dest)?;
161160
}

compiler/rustc_const_eval/src/interpret/machine.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -525,15 +525,15 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
525525
fn eval_mir_constant<F>(
526526
ecx: &InterpCx<'mir, 'tcx, Self>,
527527
val: mir::Const<'tcx>,
528-
span: Option<Span>,
528+
span: Span,
529529
layout: Option<TyAndLayout<'tcx>>,
530530
eval: F,
531531
) -> InterpResult<'tcx, OpTy<'tcx, Self::Provenance>>
532532
where
533533
F: Fn(
534534
&InterpCx<'mir, 'tcx, Self>,
535535
mir::Const<'tcx>,
536-
Option<Span>,
536+
Span,
537537
Option<TyAndLayout<'tcx>>,
538538
) -> InterpResult<'tcx, OpTy<'tcx, Self::Provenance>>,
539539
{

compiler/rustc_const_eval/src/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
741741
// * During ConstProp, with `TooGeneric` or since the `required_consts` were not all
742742
// checked yet.
743743
// * During CTFE, since promoteds in `const`/`static` initializer bodies can fail.
744-
self.eval_mir_constant(&c, Some(constant.span), layout)?
744+
self.eval_mir_constant(&c, constant.span, layout)?
745745
}
746746
};
747747
trace!("{:?}: {:?}", mir_op, op);

compiler/rustc_hir_typeck/src/pat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21782178
len: ty::Const<'tcx>,
21792179
min_len: u64,
21802180
) -> (Option<Ty<'tcx>>, Ty<'tcx>) {
2181-
let len = match len.eval(self.tcx, self.param_env, None) {
2181+
let len = match len.eval(self.tcx, self.param_env, span) {
21822182
Ok(val) => val
21832183
.try_to_scalar()
21842184
.and_then(|scalar| scalar.try_to_int().ok())

compiler/rustc_infer/src/infer/mod.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ impl<'tcx> InferCtxt<'tcx> {
14751475
param_env: ty::ParamEnv<'tcx>,
14761476
unevaluated: ty::UnevaluatedConst<'tcx>,
14771477
ty: Ty<'tcx>,
1478-
span: Option<Span>,
1478+
span: Span,
14791479
) -> Result<ty::Const<'tcx>, ErrorHandled> {
14801480
match self.const_eval_resolve(param_env, unevaluated, span) {
14811481
Ok(Some(val)) => Ok(ty::Const::new_value(self.tcx, val, ty)),
@@ -1509,7 +1509,7 @@ impl<'tcx> InferCtxt<'tcx> {
15091509
&self,
15101510
mut param_env: ty::ParamEnv<'tcx>,
15111511
unevaluated: ty::UnevaluatedConst<'tcx>,
1512-
span: Option<Span>,
1512+
span: Span,
15131513
) -> EvalToValTreeResult<'tcx> {
15141514
let mut args = self.resolve_vars_if_possible(unevaluated.args);
15151515
debug!(?args);
@@ -1521,12 +1521,9 @@ impl<'tcx> InferCtxt<'tcx> {
15211521
if let Some(ct) = tcx.thir_abstract_const(unevaluated.def)? {
15221522
let ct = tcx.expand_abstract_consts(ct.instantiate(tcx, args));
15231523
if let Err(e) = ct.error_reported() {
1524-
return Err(ErrorHandled::Reported(
1525-
e.into(),
1526-
span.unwrap_or(rustc_span::DUMMY_SP),
1527-
));
1524+
return Err(ErrorHandled::Reported(e.into(), span));
15281525
} else if ct.has_non_region_infer() || ct.has_non_region_param() {
1529-
return Err(ErrorHandled::TooGeneric(span.unwrap_or(rustc_span::DUMMY_SP)));
1526+
return Err(ErrorHandled::TooGeneric(span));
15301527
} else {
15311528
args = replace_param_and_infer_args_with_placeholder(tcx, args);
15321529
}

compiler/rustc_middle/src/mir/consts.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fmt::{self, Debug, Display, Formatter};
22

33
use rustc_hir::def_id::DefId;
44
use rustc_session::RemapFileNameExt;
5-
use rustc_span::Span;
5+
use rustc_span::{Span, DUMMY_SP};
66
use rustc_target::abi::{HasDataLayout, Size};
77

88
use crate::mir::interpret::{alloc_range, AllocId, ConstAllocation, ErrorHandled, Scalar};
@@ -273,7 +273,7 @@ impl<'tcx> Const<'tcx> {
273273
self,
274274
tcx: TyCtxt<'tcx>,
275275
param_env: ty::ParamEnv<'tcx>,
276-
span: Option<Span>,
276+
span: Span,
277277
) -> Result<ConstValue<'tcx>, ErrorHandled> {
278278
match self {
279279
Const::Ty(c) => {
@@ -293,7 +293,7 @@ impl<'tcx> Const<'tcx> {
293293
/// Normalizes the constant to a value or an error if possible.
294294
#[inline]
295295
pub fn normalize(self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Self {
296-
match self.eval(tcx, param_env, None) {
296+
match self.eval(tcx, param_env, DUMMY_SP) {
297297
Ok(val) => Self::Val(val, self.ty()),
298298
Err(ErrorHandled::Reported(guar, _span)) => {
299299
Self::Ty(ty::Const::new_error(tcx, guar.into(), self.ty()))
@@ -313,10 +313,10 @@ impl<'tcx> Const<'tcx> {
313313
// Avoid the `valtree_to_const_val` query. Can only be done on primitive types that
314314
// are valtree leaves, and *not* on references. (References should return the
315315
// pointer here, which valtrees don't represent.)
316-
let val = c.eval(tcx, param_env, None).ok()?;
316+
let val = c.eval(tcx, param_env, DUMMY_SP).ok()?;
317317
Some(val.unwrap_leaf().into())
318318
}
319-
_ => self.eval(tcx, param_env, None).ok()?.try_to_scalar(),
319+
_ => self.eval(tcx, param_env, DUMMY_SP).ok()?.try_to_scalar(),
320320
}
321321
}
322322

compiler/rustc_middle/src/mir/interpret/queries.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'tcx> TyCtxt<'tcx> {
2424
let instance = ty::Instance::new(def_id, args);
2525
let cid = GlobalId { instance, promoted: None };
2626
let param_env = self.param_env(def_id).with_reveal_all_normalized(self);
27-
self.const_eval_global_id(param_env, cid, None)
27+
self.const_eval_global_id(param_env, cid, DUMMY_SP)
2828
}
2929
/// Resolves and evaluates a constant.
3030
///
@@ -40,7 +40,7 @@ impl<'tcx> TyCtxt<'tcx> {
4040
self,
4141
param_env: ty::ParamEnv<'tcx>,
4242
ct: mir::UnevaluatedConst<'tcx>,
43-
span: Option<Span>,
43+
span: Span,
4444
) -> EvalToConstValueResult<'tcx> {
4545
// Cannot resolve `Unevaluated` constants that contain inference
4646
// variables. We reject those here since `resolve`
@@ -73,7 +73,7 @@ impl<'tcx> TyCtxt<'tcx> {
7373
self,
7474
param_env: ty::ParamEnv<'tcx>,
7575
ct: ty::UnevaluatedConst<'tcx>,
76-
span: Option<Span>,
76+
span: Span,
7777
) -> EvalToValTreeResult<'tcx> {
7878
// Cannot resolve `Unevaluated` constants that contain inference
7979
// variables. We reject those here since `resolve`
@@ -130,7 +130,7 @@ impl<'tcx> TyCtxt<'tcx> {
130130
self,
131131
param_env: ty::ParamEnv<'tcx>,
132132
instance: ty::Instance<'tcx>,
133-
span: Option<Span>,
133+
span: Span,
134134
) -> EvalToConstValueResult<'tcx> {
135135
self.const_eval_global_id(param_env, GlobalId { instance, promoted: None }, span)
136136
}
@@ -141,12 +141,12 @@ impl<'tcx> TyCtxt<'tcx> {
141141
self,
142142
param_env: ty::ParamEnv<'tcx>,
143143
cid: GlobalId<'tcx>,
144-
span: Option<Span>,
144+
span: Span,
145145
) -> EvalToConstValueResult<'tcx> {
146146
// Const-eval shouldn't depend on lifetimes at all, so we can erase them, which should
147147
// improve caching of queries.
148148
let inputs = self.erase_regions(param_env.with_reveal_all_normalized(self).and(cid));
149-
if let Some(span) = span {
149+
if !span.is_dummy() {
150150
// The query doesn't know where it is being invoked, so we need to fix the span.
151151
self.at(span).eval_to_const_value_raw(inputs).map_err(|e| e.with_span(span))
152152
} else {
@@ -160,13 +160,13 @@ impl<'tcx> TyCtxt<'tcx> {
160160
self,
161161
param_env: ty::ParamEnv<'tcx>,
162162
cid: GlobalId<'tcx>,
163-
span: Option<Span>,
163+
span: Span,
164164
) -> EvalToValTreeResult<'tcx> {
165165
// Const-eval shouldn't depend on lifetimes at all, so we can erase them, which should
166166
// improve caching of queries.
167167
let inputs = self.erase_regions(param_env.with_reveal_all_normalized(self).and(cid));
168168
debug!(?inputs);
169-
if let Some(span) = span {
169+
if !span.is_dummy() {
170170
// The query doesn't know where it is being invoked, so we need to fix the span.
171171
self.at(span).eval_to_valtree(inputs).map_err(|e| e.with_span(span))
172172
} else {

compiler/rustc_middle/src/ty/consts.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ impl<'tcx> Const<'tcx> {
335335
self,
336336
tcx: TyCtxt<'tcx>,
337337
param_env: ParamEnv<'tcx>,
338-
span: Option<Span>,
338+
span: Span,
339339
) -> Result<ValTree<'tcx>, ErrorHandled> {
340340
assert!(!self.has_escaping_bound_vars(), "escaping vars in {self:?}");
341341
match self.kind() {
@@ -349,7 +349,7 @@ impl<'tcx> Const<'tcx> {
349349
else {
350350
// This can happen when we run on ill-typed code.
351351
let e = tcx.dcx().span_delayed_bug(
352-
span.unwrap_or(DUMMY_SP),
352+
span,
353353
"`ty::Const::eval` called on a non-valtree-compatible type",
354354
);
355355
return Err(e.into());
@@ -362,14 +362,14 @@ impl<'tcx> Const<'tcx> {
362362
| ConstKind::Infer(_)
363363
| ConstKind::Bound(_, _)
364364
| ConstKind::Placeholder(_)
365-
| ConstKind::Expr(_) => Err(ErrorHandled::TooGeneric(span.unwrap_or(DUMMY_SP))),
365+
| ConstKind::Expr(_) => Err(ErrorHandled::TooGeneric(span)),
366366
}
367367
}
368368

369369
/// Normalizes the constant to a value or an error if possible.
370370
#[inline]
371371
pub fn normalize(self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>) -> Self {
372-
match self.eval(tcx, param_env, None) {
372+
match self.eval(tcx, param_env, DUMMY_SP) {
373373
Ok(val) => Self::new_value(tcx, val, self.ty()),
374374
Err(ErrorHandled::Reported(r, _span)) => Self::new_error(tcx, r.into(), self.ty()),
375375
Err(ErrorHandled::TooGeneric(_span)) => self,
@@ -382,7 +382,7 @@ impl<'tcx> Const<'tcx> {
382382
tcx: TyCtxt<'tcx>,
383383
param_env: ty::ParamEnv<'tcx>,
384384
) -> Option<Scalar> {
385-
self.eval(tcx, param_env, None).ok()?.try_to_scalar()
385+
self.eval(tcx, param_env, DUMMY_SP).ok()?.try_to_scalar()
386386
}
387387

388388
#[inline]

compiler/rustc_mir_build/src/thir/pattern/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,12 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
524524
// Prefer valtrees over opaque constants.
525525
let const_value = self
526526
.tcx
527-
.const_eval_global_id_for_typeck(param_env_reveal_all, cid, Some(span))
527+
.const_eval_global_id_for_typeck(param_env_reveal_all, cid, span)
528528
.map(|val| match val {
529529
Some(valtree) => mir::Const::Ty(ty::Const::new_value(self.tcx, valtree, ty)),
530530
None => mir::Const::Val(
531531
self.tcx
532-
.const_eval_global_id(param_env_reveal_all, cid, Some(span))
532+
.const_eval_global_id(param_env_reveal_all, cid, span)
533533
.expect("const_eval_global_id_for_typeck should have already failed"),
534534
ty,
535535
),
@@ -627,15 +627,14 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
627627
// First try using a valtree in order to destructure the constant into a pattern.
628628
// FIXME: replace "try to do a thing, then fall back to another thing"
629629
// but something more principled, like a trait query checking whether this can be turned into a valtree.
630-
if let Ok(Some(valtree)) =
631-
self.tcx.const_eval_resolve_for_typeck(self.param_env, ct, Some(span))
630+
if let Ok(Some(valtree)) = self.tcx.const_eval_resolve_for_typeck(self.param_env, ct, span)
632631
{
633632
let subpattern =
634633
self.const_to_pat(Const::Ty(ty::Const::new_value(self.tcx, valtree, ty)), id, span);
635634
PatKind::InlineConstant { subpattern, def: def_id }
636635
} else {
637636
// If that fails, convert it to an opaque constant pattern.
638-
match tcx.const_eval_resolve(self.param_env, uneval, Some(span)) {
637+
match tcx.const_eval_resolve(self.param_env, uneval, span) {
639638
Ok(val) => self.const_to_pat(mir::Const::Val(val, ty), id, span).kind,
640639
Err(ErrorHandled::TooGeneric(_)) => {
641640
// If we land here it means the const can't be evaluated because it's `TooGeneric`.

compiler/rustc_mir_transform/src/dataflow_const_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
394394
}
395395
Operand::Constant(box constant) => {
396396
if let Ok(constant) =
397-
self.ecx.eval_mir_constant(&constant.const_, Some(constant.span), None)
397+
self.ecx.eval_mir_constant(&constant.const_, constant.span, None)
398398
{
399399
self.assign_constant(state, place, constant, &[]);
400400
}

compiler/rustc_mir_transform/src/gvn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
367367
Repeat(..) => return None,
368368

369369
Constant { ref value, disambiguator: _ } => {
370-
self.ecx.eval_mir_constant(value, None, None).ok()?
370+
self.ecx.eval_mir_constant(value, DUMMY_SP, None).ok()?
371371
}
372372
Aggregate(kind, variant, ref fields) => {
373373
let fields = fields

compiler/rustc_mir_transform/src/jump_threading.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> {
417417
// If we expect `lhs ?= A`, we have an opportunity if we assume `constant == A`.
418418
Operand::Constant(constant) => {
419419
let constant =
420-
self.ecx.eval_mir_constant(&constant.const_, Some(constant.span), None).ok()?;
420+
self.ecx.eval_mir_constant(&constant.const_, constant.span, None).ok()?;
421421
self.process_constant(bb, lhs, constant, state);
422422
}
423423
// Transfer the conditions on the copied rhs.

0 commit comments

Comments
 (0)