Skip to content

Commit a9d3cd1

Browse files
committed
Make Const::val() return a ref, to avoid copies.
The idea comes from the last commit of #90951.
1 parent 523a1b1 commit a9d3cd1

File tree

36 files changed

+64
-65
lines changed

36 files changed

+64
-65
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
384384
let tcx = self.tcx();
385385
let maybe_uneval = match constant.literal {
386386
ConstantKind::Ty(ct) => match ct.val() {
387-
ty::ConstKind::Unevaluated(uv) => Some(uv),
387+
&ty::ConstKind::Unevaluated(uv) => Some(uv),
388388
_ => None,
389389
},
390390
_ => None,
@@ -1956,7 +1956,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19561956
if let Operand::Constant(constant) = op {
19571957
let maybe_uneval = match constant.literal {
19581958
ConstantKind::Ty(ct) => match ct.val() {
1959-
ty::ConstKind::Unevaluated(uv) => Some(uv),
1959+
&ty::ConstKind::Unevaluated(uv) => Some(uv),
19601960
_ => None,
19611961
},
19621962
_ => None,

compiler/rustc_codegen_cranelift/src/constant.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub(crate) fn check_constants(fx: &mut FunctionCx<'_, '_, '_>) -> bool {
4848
};
4949
match const_.val() {
5050
ConstKind::Value(_) => {}
51-
ConstKind::Unevaluated(unevaluated) => {
51+
&ConstKind::Unevaluated(unevaluated) => {
5252
if let Err(err) =
5353
fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None)
5454
{
@@ -128,7 +128,7 @@ pub(crate) fn codegen_constant<'tcx>(
128128
ConstantKind::Val(val, ty) => return codegen_const_value(fx, val, ty),
129129
};
130130
let const_val = match const_.val() {
131-
ConstKind::Value(const_val) => const_val,
131+
&ConstKind::Value(const_val) => const_val,
132132
ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted })
133133
if fx.tcx.is_static(def.did) =>
134134
{
@@ -137,7 +137,7 @@ pub(crate) fn codegen_constant<'tcx>(
137137

138138
return codegen_static_ref(fx, def.did, fx.layout_of(const_.ty())).to_cvalue(fx);
139139
}
140-
ConstKind::Unevaluated(unevaluated) => {
140+
&ConstKind::Unevaluated(unevaluated) => {
141141
match fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None) {
142142
Ok(const_val) => const_val,
143143
Err(_) => {

compiler/rustc_codegen_ssa/src/mir/constant.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
3030
mir::ConstantKind::Val(val, _) => return Ok(val),
3131
};
3232
match ct.val() {
33-
ty::ConstKind::Unevaluated(ct) => self
33+
&ty::ConstKind::Unevaluated(ct) => self
3434
.cx
3535
.tcx()
3636
.const_eval_resolve(ty::ParamEnv::reveal_all(), ct, None)
3737
.map_err(|err| {
3838
self.cx.tcx().sess.span_err(constant.span, "erroneous constant encountered");
3939
err
4040
}),
41-
ty::ConstKind::Value(value) => Ok(value),
41+
&ty::ConstKind::Value(value) => Ok(value),
4242
err => span_bug!(
4343
constant.span,
4444
"encountered bad ConstKind after monomorphizing: {:?}",

compiler/rustc_const_eval/src/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
574574
ty::ConstKind::Infer(..) | ty::ConstKind::Placeholder(..) => {
575575
span_bug!(self.cur_span(), "const_to_op: Unexpected ConstKind {:?}", val)
576576
}
577-
ty::ConstKind::Value(val_val) => self.const_val_to_op(val_val, val.ty(), layout),
577+
&ty::ConstKind::Value(val_val) => self.const_val_to_op(val_val, val.ty(), layout),
578578
}
579579
}
580580

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
477477

478478
fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
479479
match ct.val() {
480-
ty::ConstKind::Infer(InferConst::Var(vid)) => {
480+
&ty::ConstKind::Infer(InferConst::Var(vid)) => {
481481
debug!("canonical: const var found with vid {:?}", vid);
482482
match self.infcx.probe_const_var(vid) {
483483
Ok(c) => {
@@ -502,14 +502,14 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
502502
ty::ConstKind::Infer(InferConst::Fresh(_)) => {
503503
bug!("encountered a fresh const during canonicalization")
504504
}
505-
ty::ConstKind::Bound(debruijn, _) => {
505+
&ty::ConstKind::Bound(debruijn, _) => {
506506
if debruijn >= self.binder_index {
507507
bug!("escaping bound type during canonicalization")
508508
} else {
509509
return ct;
510510
}
511511
}
512-
ty::ConstKind::Placeholder(placeholder) => {
512+
&ty::ConstKind::Placeholder(placeholder) => {
513513
return self.canonicalize_const_var(
514514
CanonicalVarInfo { kind: CanonicalVarKind::PlaceholderConst(placeholder) },
515515
ct,

compiler/rustc_infer/src/infer/canonical/query_response.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
437437
}
438438
}
439439
GenericArgKind::Const(result_value) => {
440-
if let ty::ConstKind::Bound(debrujin, b) = result_value.val() {
440+
if let &ty::ConstKind::Bound(debrujin, b) = result_value.val() {
441441
// ...in which case we would set `canonical_vars[0]` to `Some(const X)`.
442442

443443
// We only allow a `ty::INNERMOST` index in substitutions.

compiler/rustc_infer/src/infer/combine.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
141141

142142
match (a.val(), b.val()) {
143143
(
144-
ty::ConstKind::Infer(InferConst::Var(a_vid)),
145-
ty::ConstKind::Infer(InferConst::Var(b_vid)),
144+
&ty::ConstKind::Infer(InferConst::Var(a_vid)),
145+
&ty::ConstKind::Infer(InferConst::Var(b_vid)),
146146
) => {
147147
self.inner
148148
.borrow_mut()
@@ -158,11 +158,11 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
158158
bug!("tried to combine ConstKind::Infer/ConstKind::Infer(InferConst::Var)")
159159
}
160160

161-
(ty::ConstKind::Infer(InferConst::Var(vid)), _) => {
161+
(&ty::ConstKind::Infer(InferConst::Var(vid)), _) => {
162162
return self.unify_const_variable(relation.param_env(), vid, b, a_is_expected);
163163
}
164164

165-
(_, ty::ConstKind::Infer(InferConst::Var(vid))) => {
165+
(_, &ty::ConstKind::Infer(InferConst::Var(vid))) => {
166166
return self.unify_const_variable(relation.param_env(), vid, a, !a_is_expected);
167167
}
168168
(ty::ConstKind::Unevaluated(..), _) if self.tcx.lazy_normalization() => {
@@ -722,7 +722,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
722722
assert_eq!(c, c2); // we are abusing TypeRelation here; both LHS and RHS ought to be ==
723723

724724
match c.val() {
725-
ty::ConstKind::Infer(InferConst::Var(vid)) => {
725+
&ty::ConstKind::Infer(InferConst::Var(vid)) => {
726726
let mut inner = self.infcx.inner.borrow_mut();
727727
let variable_table = &mut inner.const_unification_table();
728728
let var_value = variable_table.probe_value(vid);
@@ -744,7 +744,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
744744
}
745745
}
746746
}
747-
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted })
747+
&ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted })
748748
if self.tcx().lazy_normalization() =>
749749
{
750750
assert_eq!(promoted, None);
@@ -952,7 +952,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
952952
debug!("ConstInferUnifier: c={:?}", c);
953953

954954
match c.val() {
955-
ty::ConstKind::Infer(InferConst::Var(vid)) => {
955+
&ty::ConstKind::Infer(InferConst::Var(vid)) => {
956956
// Check if the current unification would end up
957957
// unifying `target_vid` with a const which contains
958958
// an inference variable which is unioned with `target_vid`.
@@ -990,7 +990,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
990990
}
991991
}
992992
}
993-
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted })
993+
&ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted })
994994
if self.tcx().lazy_normalization() =>
995995
{
996996
assert_eq!(promoted, None);

compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
410410
}
411411
GenericArgKind::Const(ct) => {
412412
match ct.val() {
413-
ty::ConstKind::Infer(InferConst::Var(vid)) => {
413+
&ty::ConstKind::Infer(InferConst::Var(vid)) => {
414414
let origin = self
415415
.inner
416416
.borrow_mut()

compiler/rustc_infer/src/infer/freshen.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
223223

224224
fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
225225
match ct.val() {
226-
ty::ConstKind::Infer(ty::InferConst::Var(v)) => {
226+
&ty::ConstKind::Infer(ty::InferConst::Var(v)) => {
227227
let opt_ct = self
228228
.infcx
229229
.inner
@@ -239,7 +239,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
239239
ct.ty(),
240240
);
241241
}
242-
ty::ConstKind::Infer(ty::InferConst::Fresh(i)) => {
242+
&ty::ConstKind::Infer(ty::InferConst::Fresh(i)) => {
243243
if i >= self.const_freshen_count {
244244
bug!(
245245
"Encountered a freshend const with id {} \

compiler/rustc_infer/src/infer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ impl<'tcx> TyOrConstInferVar<'tcx> {
17611761
/// for constants other than `ty::ConstKind::Infer(_)` (or `InferConst::Fresh`).
17621762
pub fn maybe_from_const(ct: ty::Const<'tcx>) -> Option<Self> {
17631763
match ct.val() {
1764-
ty::ConstKind::Infer(InferConst::Var(v)) => Some(TyOrConstInferVar::Const(v)),
1764+
&ty::ConstKind::Infer(InferConst::Var(v)) => Some(TyOrConstInferVar::Const(v)),
17651765
_ => None,
17661766
}
17671767
}
@@ -1781,7 +1781,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for ShallowResolver<'a, 'tcx> {
17811781
}
17821782

17831783
fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
1784-
if let ty::ConstKind::Infer(InferConst::Var(vid)) = ct.val() {
1784+
if let &ty::ConstKind::Infer(InferConst::Var(vid)) = ct.val() {
17851785
self.infcx
17861786
.inner
17871787
.borrow_mut()

compiler/rustc_infer/src/infer/nll_relate/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ where
999999
ty::ConstKind::Infer(InferConst::Var(_)) if D::forbid_inference_vars() => {
10001000
bug!("unexpected inference variable encountered in NLL generalization: {:?}", a);
10011001
}
1002-
ty::ConstKind::Infer(InferConst::Var(vid)) => {
1002+
&ty::ConstKind::Infer(InferConst::Var(vid)) => {
10031003
let mut inner = self.infcx.inner.borrow_mut();
10041004
let variable_table = &mut inner.const_unification_table();
10051005
let var_value = variable_table.probe_value(vid);

compiler/rustc_infer/src/infer/resolve.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl<'a, 'tcx> FallibleTypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
224224
} else {
225225
let c = self.infcx.shallow_resolve(c);
226226
match c.val() {
227-
ty::ConstKind::Infer(InferConst::Var(vid)) => {
227+
&ty::ConstKind::Infer(InferConst::Var(vid)) => {
228228
return Err(FixupError::UnresolvedConst(vid));
229229
}
230230
ty::ConstKind::Infer(InferConst::Fresh(_)) => {

compiler/rustc_middle/src/infer/unify_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ where
176176
V: snapshot_vec::VecLike<unify::Delegate<ty::ConstVid<'tcx>>>,
177177
L: UndoLogs<snapshot_vec::UndoLog<unify::Delegate<ty::ConstVid<'tcx>>>>,
178178
{
179-
if let ty::ConstKind::Infer(InferConst::Var(vid)) = c.val() {
179+
if let &ty::ConstKind::Infer(InferConst::Var(vid)) = c.val() {
180180
match table.probe_value(vid).val.known() {
181181
Some(c) => c,
182182
None => c,

compiler/rustc_middle/src/mir/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ pub fn write_allocations<'tcx>(
682682

683683
impl<'tcx> Visitor<'tcx> for CollectAllocIds {
684684
fn visit_const(&mut self, c: ty::Const<'tcx>, _loc: Location) {
685-
if let ty::ConstKind::Value(val) = c.val() {
685+
if let &ty::ConstKind::Value(val) = c.val() {
686686
self.0.extend(alloc_ids_from_const(val));
687687
}
688688
}

compiler/rustc_middle/src/ty/consts.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub use valtree::*;
2121

2222
/// Use this rather than `ConstS`, whenever possible.
2323
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
24-
#[cfg_attr(not(bootstrap), rustc_pass_by_value)]
2524
pub struct Const<'tcx>(pub Interned<'tcx, ConstS<'tcx>>);
2625

2726
impl<'tcx> fmt::Debug for Const<'tcx> {
@@ -48,8 +47,8 @@ impl<'tcx> Const<'tcx> {
4847
self.0.ty
4948
}
5049

51-
pub fn val(self) -> ConstKind<'tcx> {
52-
self.0.val
50+
pub fn val(&self) -> &ConstKind<'tcx> {
51+
&self.0.val
5352
}
5453

5554
/// Literals and const generic parameters are eagerly converted to a constant, everything else

compiler/rustc_middle/src/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ impl<'tcx> CanonicalUserType<'tcx> {
870870
},
871871

872872
GenericArgKind::Const(ct) => match ct.val() {
873-
ty::ConstKind::Bound(debruijn, b) => {
873+
&ty::ConstKind::Bound(debruijn, b) => {
874874
// We only allow a `ty::INNERMOST` index in substitutions.
875875
assert_eq!(debruijn, ty::INNERMOST);
876876
cvar == b

compiler/rustc_middle/src/ty/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'tcx> Ty<'tcx> {
7676
}
7777
}
7878

79-
fn const_is_suggestable(kind: ConstKind<'_>) -> bool {
79+
fn const_is_suggestable(kind: &ConstKind<'_>) -> bool {
8080
match kind {
8181
ConstKind::Infer(..)
8282
| ConstKind::Bound(..)

compiler/rustc_middle/src/ty/flags.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,15 @@ impl FlagComputation {
289289
fn add_const(&mut self, c: ty::Const<'_>) {
290290
self.add_ty(c.ty());
291291
match c.val() {
292-
ty::ConstKind::Unevaluated(unevaluated) => self.add_unevaluated_const(unevaluated),
292+
&ty::ConstKind::Unevaluated(unevaluated) => self.add_unevaluated_const(unevaluated),
293293
ty::ConstKind::Infer(infer) => {
294294
self.add_flags(TypeFlags::STILL_FURTHER_SPECIALIZABLE);
295295
match infer {
296296
InferConst::Fresh(_) => self.add_flags(TypeFlags::HAS_CT_FRESH),
297297
InferConst::Var(_) => self.add_flags(TypeFlags::HAS_CT_INFER),
298298
}
299299
}
300-
ty::ConstKind::Bound(debruijn, _) => {
300+
&ty::ConstKind::Bound(debruijn, _) => {
301301
self.add_bound_var(debruijn);
302302
}
303303
ty::ConstKind::Param(_) => {

compiler/rustc_middle/src/ty/fold.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for BoundVarReplacer<'a, 'tcx> {
689689

690690
fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
691691
match ct.val() {
692-
ty::ConstKind::Bound(debruijn, bound_const) if debruijn == self.current_index => {
692+
&ty::ConstKind::Bound(debruijn, bound_const) if debruijn == self.current_index => {
693693
if let Some(fld_c) = self.fld_c.as_mut() {
694694
let ct = fld_c(bound_const, ct.ty());
695695
return ty::fold::shift_vars(self.tcx, ct, self.current_index.as_u32());
@@ -1083,7 +1083,7 @@ impl<'tcx> TypeFolder<'tcx> for Shifter<'tcx> {
10831083
}
10841084

10851085
fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
1086-
if let ty::ConstKind::Bound(debruijn, bound_ct) = ct.val() {
1086+
if let &ty::ConstKind::Bound(debruijn, bound_ct) = ct.val() {
10871087
if self.amount == 0 || debruijn < self.current_index {
10881088
ct
10891089
} else {
@@ -1200,7 +1200,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasEscapingVarsVisitor {
12001200
// const, as it has types/regions embedded in a lot of other
12011201
// places.
12021202
match ct.val() {
1203-
ty::ConstKind::Bound(debruijn, _) if debruijn >= self.outer_index => {
1203+
&ty::ConstKind::Bound(debruijn, _) if debruijn >= self.outer_index => {
12041204
ControlFlow::Break(FoundEscapingVars)
12051205
}
12061206
_ => ct.super_visit_with(self),

compiler/rustc_middle/src/ty/print/pretty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ pub trait PrettyPrinter<'tcx>:
11991199
}
12001200
}
12011201
}
1202-
ty::ConstKind::Infer(infer_ct) => {
1202+
&ty::ConstKind::Infer(infer_ct) => {
12031203
match infer_ct {
12041204
ty::InferConst::Var(ct_vid)
12051205
if let Some(name) = self.const_infer_name(ct_vid) =>
@@ -1208,11 +1208,11 @@ pub trait PrettyPrinter<'tcx>:
12081208
}
12091209
}
12101210
ty::ConstKind::Param(ParamConst { name, .. }) => p!(write("{}", name)),
1211-
ty::ConstKind::Value(value) => {
1211+
&ty::ConstKind::Value(value) => {
12121212
return self.pretty_print_const_value(value, ct.ty(), print_ty);
12131213
}
12141214

1215-
ty::ConstKind::Bound(debruijn, bound_var) => {
1215+
&ty::ConstKind::Bound(debruijn, bound_var) => {
12161216
self.pretty_print_bound_var(debruijn, bound_var)?
12171217
}
12181218
ty::ConstKind::Placeholder(placeholder) => p!(write("Placeholder({:?})", placeholder)),

compiler/rustc_middle/src/ty/relate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
580580

581581
(ty::ConstKind::Param(a_p), ty::ConstKind::Param(b_p)) => a_p.index == b_p.index,
582582
(ty::ConstKind::Placeholder(p1), ty::ConstKind::Placeholder(p2)) => p1 == p2,
583-
(ty::ConstKind::Value(a_val), ty::ConstKind::Value(b_val)) => {
583+
(&ty::ConstKind::Value(a_val), &ty::ConstKind::Value(b_val)) => {
584584
check_const_value_eq(relation, a_val, b_val, a, b)?
585585
}
586586

compiler/rustc_middle/src/ty/structural_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Const<'tcx> {
11591159
) -> Result<Self, F::Error> {
11601160
let ty = self.ty().try_fold_with(folder)?;
11611161
let val = self.val().try_fold_with(folder)?;
1162-
if ty != self.ty() || val != self.val() {
1162+
if ty != self.ty() || val != *self.val() {
11631163
Ok(folder.tcx().mk_const(ty::ConstS { ty, val }))
11641164
} else {
11651165
Ok(self)

compiler/rustc_middle/src/ty/subst.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
521521
}
522522

523523
fn fold_const(&mut self, c: ty::Const<'tcx>) -> ty::Const<'tcx> {
524-
if let ty::ConstKind::Param(p) = c.val() {
524+
if let &ty::ConstKind::Param(p) = c.val() {
525525
self.const_for_param(p, c)
526526
} else {
527527
c.super_fold_with(self)

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,8 @@ crate fn compare_const_vals<'tcx>(
792792

793793
if let ty::Str = ty.kind() {
794794
if let (
795-
ty::ConstKind::Value(a_val @ ConstValue::Slice { .. }),
796-
ty::ConstKind::Value(b_val @ ConstValue::Slice { .. }),
795+
&ty::ConstKind::Value(a_val @ ConstValue::Slice { .. }),
796+
&ty::ConstKind::Value(b_val @ ConstValue::Slice { .. }),
797797
) = (a.val(), b.val())
798798
{
799799
let a_bytes = get_slice_bytes(&tcx, a_val);

0 commit comments

Comments
 (0)