Skip to content

Commit 118aba3

Browse files
authored
Rollup merge of #83040 - lcnr:unused-ct-substs, r=oli-obk
extract `ConstKind::Unevaluated` into a struct r? `@oli-obk`
2 parents 3a113f1 + 2885ca3 commit 118aba3

File tree

50 files changed

+198
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+198
-165
lines changed

compiler/rustc_codegen_cranelift/src/constant.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ pub(crate) fn check_constants(fx: &mut FunctionCx<'_, '_, '_>) -> bool {
4545
};
4646
match const_.val {
4747
ConstKind::Value(_) => {}
48-
ConstKind::Unevaluated(def, ref substs, promoted) => {
48+
ConstKind::Unevaluated(unevaluated) => {
4949
if let Err(err) =
50-
fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), def, substs, promoted, None)
50+
fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None)
5151
{
5252
all_constants_ok = false;
5353
match err {
@@ -122,14 +122,14 @@ pub(crate) fn codegen_constant<'tcx>(
122122
};
123123
let const_val = match const_.val {
124124
ConstKind::Value(const_val) => const_val,
125-
ConstKind::Unevaluated(def, ref substs, promoted) if fx.tcx.is_static(def.did) => {
125+
ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) if fx.tcx.is_static(def.did) => {
126126
assert!(substs.is_empty());
127127
assert!(promoted.is_none());
128128

129129
return codegen_static_ref(fx, def.did, fx.layout_of(const_.ty)).to_cvalue(fx);
130130
}
131-
ConstKind::Unevaluated(def, ref substs, promoted) => {
132-
match fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), def, substs, promoted, None) {
131+
ConstKind::Unevaluated(unevaluated) => {
132+
match fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None) {
133133
Ok(const_val) => const_val,
134134
Err(_) => {
135135
span_bug!(constant.span, "erroneous constant not captured by required_consts");

compiler/rustc_codegen_ssa/src/mir/constant.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ 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(def, substs, promoted) => self
33+
ty::ConstKind::Unevaluated(ct) => self
3434
.cx
3535
.tcx()
36-
.const_eval_resolve(ty::ParamEnv::reveal_all(), def, substs, promoted, None)
36+
.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

compiler/rustc_infer/src/infer/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use rustc_hir::def_id::{DefId, LocalDefId};
1818
use rustc_middle::infer::canonical::{Canonical, CanonicalVarValues};
1919
use rustc_middle::infer::unify_key::{ConstVarValue, ConstVariableValue};
2020
use rustc_middle::infer::unify_key::{ConstVariableOrigin, ConstVariableOriginKind, ToType};
21-
use rustc_middle::mir;
2221
use rustc_middle::mir::interpret::EvalToConstValueResult;
2322
use rustc_middle::traits::select;
2423
use rustc_middle::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
@@ -1499,9 +1498,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14991498
pub fn const_eval_resolve(
15001499
&self,
15011500
param_env: ty::ParamEnv<'tcx>,
1502-
def: ty::WithOptConstParam<DefId>,
1503-
substs: SubstsRef<'tcx>,
1504-
promoted: Option<mir::Promoted>,
1501+
ty::Unevaluated { def, substs, promoted }: ty::Unevaluated<'tcx>,
15051502
span: Option<Span>,
15061503
) -> EvalToConstValueResult<'tcx> {
15071504
let mut original_values = OriginalQueryValues::default();
@@ -1510,7 +1507,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
15101507
let (param_env, substs) = canonical.value;
15111508
// The return value is the evaluated value which doesn't contain any reference to inference
15121509
// variables, thus we don't need to substitute back the original values.
1513-
self.tcx.const_eval_resolve(param_env, def, substs, promoted, span)
1510+
self.tcx.const_eval_resolve(param_env, ty::Unevaluated { def, substs, promoted }, span)
15141511
}
15151512

15161513
/// If `typ` is a type variable of some kind, resolve it one level

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

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{ErrorHandled, EvalToConstValueResult, GlobalId};
22

33
use crate::mir;
4-
use crate::ty::subst::{InternalSubsts, SubstsRef};
4+
use crate::ty::subst::InternalSubsts;
55
use crate::ty::{self, TyCtxt};
66
use rustc_hir::def_id::DefId;
77
use rustc_span::Span;
@@ -35,14 +35,12 @@ impl<'tcx> TyCtxt<'tcx> {
3535
pub fn const_eval_resolve(
3636
self,
3737
param_env: ty::ParamEnv<'tcx>,
38-
def: ty::WithOptConstParam<DefId>,
39-
substs: SubstsRef<'tcx>,
40-
promoted: Option<mir::Promoted>,
38+
ct: ty::Unevaluated<'tcx>,
4139
span: Option<Span>,
4240
) -> EvalToConstValueResult<'tcx> {
43-
match ty::Instance::resolve_opt_const_arg(self, param_env, def, substs) {
41+
match ty::Instance::resolve_opt_const_arg(self, param_env, ct.def, ct.substs) {
4442
Ok(Some(instance)) => {
45-
let cid = GlobalId { instance, promoted };
43+
let cid = GlobalId { instance, promoted: ct.promoted };
4644
self.const_eval_global_id(param_env, cid, span)
4745
}
4846
Ok(None) => Err(ErrorHandled::TooGeneric),

compiler/rustc_middle/src/ty/consts.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,18 @@ impl<'tcx> Const<'tcx> {
9898
let name = tcx.hir().name(hir_id);
9999
ty::ConstKind::Param(ty::ParamConst::new(index, name))
100100
}
101-
_ => ty::ConstKind::Unevaluated(
102-
def.to_global(),
103-
InternalSubsts::identity_for_item(tcx, def.did.to_def_id()),
104-
None,
105-
),
101+
_ => ty::ConstKind::Unevaluated(ty::Unevaluated {
102+
def: def.to_global(),
103+
substs: InternalSubsts::identity_for_item(tcx, def.did.to_def_id()),
104+
promoted: None,
105+
}),
106106
};
107107

108108
tcx.mk_const(ty::Const { val, ty })
109109
}
110110

111-
#[inline]
112111
/// Interns the given value as a constant.
112+
#[inline]
113113
pub fn from_value(tcx: TyCtxt<'tcx>, val: ConstValue<'tcx>, ty: Ty<'tcx>) -> &'tcx Self {
114114
tcx.mk_const(Self { val: ConstKind::Value(val), ty })
115115
}

compiler/rustc_middle/src/ty/consts/kind.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ use rustc_macros::HashStable;
1212
use rustc_target::abi::Size;
1313

1414
use super::ScalarInt;
15+
/// An unevaluated, potentially generic, constant.
16+
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable)]
17+
#[derive(Hash, HashStable)]
18+
pub struct Unevaluated<'tcx> {
19+
pub def: ty::WithOptConstParam<DefId>,
20+
pub substs: SubstsRef<'tcx>,
21+
pub promoted: Option<Promoted>,
22+
}
1523

1624
/// Represents a constant in Rust.
17-
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable, Hash)]
18-
#[derive(HashStable)]
25+
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable)]
26+
#[derive(Hash, HashStable)]
1927
pub enum ConstKind<'tcx> {
2028
/// A const generic parameter.
2129
Param(ty::ParamConst),
@@ -31,7 +39,7 @@ pub enum ConstKind<'tcx> {
3139

3240
/// Used in the HIR by using `Unevaluated` everywhere and later normalizing to one of the other
3341
/// variants when the code is monomorphic enough for that.
34-
Unevaluated(ty::WithOptConstParam<DefId>, SubstsRef<'tcx>, Option<Promoted>),
42+
Unevaluated(Unevaluated<'tcx>),
3543

3644
/// Used to hold computed value.
3745
Value(ConstValue<'tcx>),
@@ -102,7 +110,7 @@ impl<'tcx> ConstKind<'tcx> {
102110
tcx: TyCtxt<'tcx>,
103111
param_env: ParamEnv<'tcx>,
104112
) -> Option<Result<ConstValue<'tcx>, ErrorReported>> {
105-
if let ConstKind::Unevaluated(def, substs, promoted) = self {
113+
if let ConstKind::Unevaluated(Unevaluated { def, substs, promoted }) = self {
106114
use crate::mir::interpret::ErrorHandled;
107115

108116
// HACK(eddyb) this erases lifetimes even though `const_eval_resolve`
@@ -132,7 +140,8 @@ impl<'tcx> ConstKind<'tcx> {
132140
let (param_env, substs) = param_env_and_substs.into_parts();
133141
// try to resolve e.g. associated constants to their definition on an impl, and then
134142
// evaluate the const.
135-
match tcx.const_eval_resolve(param_env, def, substs, promoted, None) {
143+
match tcx.const_eval_resolve(param_env, ty::Unevaluated { def, substs, promoted }, None)
144+
{
136145
// NOTE(eddyb) `val` contains no lifetimes/types/consts,
137146
// and we use the original type, so nothing from `substs`
138147
// (which may be identity substs, see above),

compiler/rustc_middle/src/ty/flags.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,7 @@ impl FlagComputation {
270270
fn add_const(&mut self, c: &ty::Const<'_>) {
271271
self.add_ty(c.ty);
272272
match c.val {
273-
ty::ConstKind::Unevaluated(_, substs, _) => {
274-
self.add_substs(substs);
275-
self.add_flags(TypeFlags::HAS_CT_PROJECTION);
276-
}
273+
ty::ConstKind::Unevaluated(unevaluated) => self.add_unevaluated_const(unevaluated),
277274
ty::ConstKind::Infer(infer) => {
278275
self.add_flags(TypeFlags::STILL_FURTHER_SPECIALIZABLE);
279276
match infer {
@@ -297,6 +294,11 @@ impl FlagComputation {
297294
}
298295
}
299296

297+
fn add_unevaluated_const(&mut self, ct: ty::Unevaluated<'tcx>) {
298+
self.add_substs(ct.substs);
299+
self.add_flags(TypeFlags::HAS_CT_PROJECTION);
300+
}
301+
300302
fn add_existential_projection(&mut self, projection: &ty::ExistentialProjection<'_>) {
301303
self.add_substs(projection.substs);
302304
self.add_ty(projection.ty);

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub use rustc_type_ir::*;
5555

5656
pub use self::binding::BindingMode;
5757
pub use self::binding::BindingMode::*;
58-
pub use self::consts::{Const, ConstInt, ConstKind, InferConst, ScalarInt, ValTree};
58+
pub use self::consts::{Const, ConstInt, ConstKind, InferConst, ScalarInt, Unevaluated, ValTree};
5959
pub use self::context::{
6060
tls, CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations,
6161
CtxtInterners, DelaySpanBugEmitted, FreeRegionInfo, GeneratorInteriorTypeCause, GlobalCtxt,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ pub trait PrettyPrinter<'tcx>:
915915
}
916916

917917
match ct.val {
918-
ty::ConstKind::Unevaluated(def, substs, promoted) => {
918+
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) => {
919919
if let Some(promoted) = promoted {
920920
p!(print_value_path(def.did, substs));
921921
p!(write("::{:?}", promoted));

compiler/rustc_middle/src/ty/relate.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -531,24 +531,26 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
531531
check_const_value_eq(relation, a_val, b_val, a, b)?
532532
}
533533

534-
(
535-
ty::ConstKind::Unevaluated(a_def, a_substs, None),
536-
ty::ConstKind::Unevaluated(b_def, b_substs, None),
537-
) if tcx.features().const_evaluatable_checked && !relation.visit_ct_substs() => {
538-
tcx.try_unify_abstract_consts(((a_def, a_substs), (b_def, b_substs)))
534+
(ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu))
535+
if tcx.features().const_evaluatable_checked && !relation.visit_ct_substs() =>
536+
{
537+
tcx.try_unify_abstract_consts(((au.def, au.substs), (bu.def, bu.substs)))
539538
}
540539

541540
// While this is slightly incorrect, it shouldn't matter for `min_const_generics`
542541
// and is the better alternative to waiting until `const_evaluatable_checked` can
543542
// be stabilized.
544-
(
545-
ty::ConstKind::Unevaluated(a_def, a_substs, a_promoted),
546-
ty::ConstKind::Unevaluated(b_def, b_substs, b_promoted),
547-
) if a_def == b_def && a_promoted == b_promoted => {
543+
(ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu))
544+
if au.def == bu.def && au.promoted == bu.promoted =>
545+
{
548546
let substs =
549-
relation.relate_with_variance(ty::Variance::Invariant, a_substs, b_substs)?;
547+
relation.relate_with_variance(ty::Variance::Invariant, au.substs, bu.substs)?;
550548
return Ok(tcx.mk_const(ty::Const {
551-
val: ty::ConstKind::Unevaluated(a_def, substs, a_promoted),
549+
val: ty::ConstKind::Unevaluated(ty::Unevaluated {
550+
def: au.def,
551+
substs,
552+
promoted: au.promoted,
553+
}),
552554
ty: a.ty,
553555
}));
554556
}

compiler/rustc_middle/src/ty/structural_impls.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1031,8 +1031,12 @@ impl<'tcx> TypeFoldable<'tcx> for ty::ConstKind<'tcx> {
10311031
match self {
10321032
ty::ConstKind::Infer(ic) => ty::ConstKind::Infer(ic.fold_with(folder)),
10331033
ty::ConstKind::Param(p) => ty::ConstKind::Param(p.fold_with(folder)),
1034-
ty::ConstKind::Unevaluated(did, substs, promoted) => {
1035-
ty::ConstKind::Unevaluated(did, substs.fold_with(folder), promoted)
1034+
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) => {
1035+
ty::ConstKind::Unevaluated(ty::Unevaluated {
1036+
def,
1037+
substs: substs.fold_with(folder),
1038+
promoted,
1039+
})
10361040
}
10371041
ty::ConstKind::Value(_)
10381042
| ty::ConstKind::Bound(..)
@@ -1045,7 +1049,7 @@ impl<'tcx> TypeFoldable<'tcx> for ty::ConstKind<'tcx> {
10451049
match *self {
10461050
ty::ConstKind::Infer(ic) => ic.visit_with(visitor),
10471051
ty::ConstKind::Param(p) => p.visit_with(visitor),
1048-
ty::ConstKind::Unevaluated(_, substs, _) => substs.visit_with(visitor),
1052+
ty::ConstKind::Unevaluated(ct) => ct.substs.visit_with(visitor),
10491053
ty::ConstKind::Value(_)
10501054
| ty::ConstKind::Bound(..)
10511055
| ty::ConstKind::Placeholder(_)

compiler/rustc_middle/src/ty/walk.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ fn push_inner<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent: GenericArg<'tcx>)
195195
| ty::ConstKind::Value(_)
196196
| ty::ConstKind::Error(_) => {}
197197

198-
ty::ConstKind::Unevaluated(_, substs, _) => {
199-
stack.extend(substs.iter().rev());
198+
ty::ConstKind::Unevaluated(ct) => {
199+
stack.extend(ct.substs.iter().rev());
200200
}
201201
}
202202
}

compiler/rustc_mir/src/borrow_check/type_check/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,12 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
316316
let tcx = self.tcx();
317317
let maybe_uneval = match constant.literal {
318318
ConstantKind::Ty(ct) => match ct.val {
319-
ty::ConstKind::Unevaluated(def, substs, promoted) => {
320-
Some((def, substs, promoted))
321-
}
319+
ty::ConstKind::Unevaluated(uv) => Some(uv),
322320
_ => None,
323321
},
324322
_ => None,
325323
};
326-
if let Some((def, substs, promoted)) = maybe_uneval {
324+
if let Some(ty::Unevaluated { def, substs, promoted }) = maybe_uneval {
327325
if let Some(promoted) = promoted {
328326
let check_err = |verifier: &mut TypeVerifier<'a, 'b, 'tcx>,
329327
promoted: &Body<'tcx>,

compiler/rustc_mir/src/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
560560
match val.val {
561561
ty::ConstKind::Param(_) | ty::ConstKind::Bound(..) => throw_inval!(TooGeneric),
562562
ty::ConstKind::Error(_) => throw_inval!(AlreadyReported(ErrorReported)),
563-
ty::ConstKind::Unevaluated(def, substs, promoted) => {
563+
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) => {
564564
let instance = self.resolve(def, substs)?;
565565
Ok(self.eval_to_allocation(GlobalId { instance, promoted })?.into())
566566
}

compiler/rustc_mir/src/monomorphize/collector.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
646646

647647
match substituted_constant.val {
648648
ty::ConstKind::Value(val) => collect_const_value(self.tcx, val, self.output),
649-
ty::ConstKind::Unevaluated(def, substs, promoted) => {
650-
match self.tcx.const_eval_resolve(param_env, def, substs, promoted, None) {
649+
ty::ConstKind::Unevaluated(unevaluated) => {
650+
match self.tcx.const_eval_resolve(param_env, unevaluated, None) {
651651
Ok(val) => collect_const_value(self.tcx, val, self.output),
652652
Err(ErrorHandled::Reported(ErrorReported) | ErrorHandled::Linted) => {}
653653
Err(ErrorHandled::TooGeneric) => span_bug!(

compiler/rustc_mir/src/monomorphize/polymorphize.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for MarkUsedGenericParams<'a, 'tcx> {
299299
self.unused_parameters.clear(param.index);
300300
ControlFlow::CONTINUE
301301
}
302-
ty::ConstKind::Unevaluated(def, _, Some(p))
302+
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs: _, promoted: Some(p)})
303303
// Avoid considering `T` unused when constants are of the form:
304304
// `<Self as Foo<T>>::foo::promoted[p]`
305305
if self.def_id == def.did && !self.tcx.generics_of(def.did).has_self =>
@@ -310,10 +310,10 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for MarkUsedGenericParams<'a, 'tcx> {
310310
self.visit_body(&promoted[p]);
311311
ControlFlow::CONTINUE
312312
}
313-
ty::ConstKind::Unevaluated(def, unevaluated_substs, None)
313+
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted: None })
314314
if self.tcx.def_kind(def.did) == DefKind::AnonConst =>
315315
{
316-
self.visit_child_body(def.did, unevaluated_substs);
316+
self.visit_child_body(def.did, substs);
317317
ControlFlow::CONTINUE
318318
}
319319
_ => c.super_visit_with(self),

compiler/rustc_mir/src/transform/check_consts/qualifs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ where
247247

248248
// Check the qualifs of the value of `const` items.
249249
if let Some(ct) = constant.literal.const_for_ty() {
250-
if let ty::ConstKind::Unevaluated(def, _, promoted) = ct.val {
250+
if let ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs: _, promoted }) = ct.val {
251251
assert!(promoted.is_none());
252252
// Don't peek inside trait associated constants.
253253
if cx.tcx.trait_of_item(def.did).is_none() {

compiler/rustc_mir/src/transform/const_prop.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,11 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
491491
let lint_only = match c.literal {
492492
ConstantKind::Ty(ct) => match ct.val {
493493
// Promoteds must lint and not error as the user didn't ask for them
494-
ConstKind::Unevaluated(_, _, Some(_)) => true,
494+
ConstKind::Unevaluated(ty::Unevaluated {
495+
def: _,
496+
substs: _,
497+
promoted: Some(_),
498+
}) => true,
495499
// Out of backwards compatibility we cannot report hard errors in unused
496500
// generic functions using associated constants of the generic parameters.
497501
_ => c.literal.needs_subst(),

compiler/rustc_mir/src/transform/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ impl Inliner<'tcx> {
630630
caller_body.required_consts.extend(
631631
callee_body.required_consts.iter().copied().filter(|&ct| {
632632
match ct.literal.const_for_ty() {
633-
Some(ct) => matches!(ct.val, ConstKind::Unevaluated(_, _, _)),
633+
Some(ct) => matches!(ct.val, ConstKind::Unevaluated(_)),
634634
None => true,
635635
}
636636
}),

compiler/rustc_mir/src/transform/promote_consts.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1001,17 +1001,17 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
10011001
literal: tcx
10021002
.mk_const(ty::Const {
10031003
ty,
1004-
val: ty::ConstKind::Unevaluated(
1004+
val: ty::ConstKind::Unevaluated(ty::Unevaluated {
10051005
def,
1006-
InternalSubsts::for_item(tcx, def.did, |param, _| {
1006+
substs: InternalSubsts::for_item(tcx, def.did, |param, _| {
10071007
if let ty::GenericParamDefKind::Lifetime = param.kind {
10081008
tcx.lifetimes.re_erased.into()
10091009
} else {
10101010
tcx.mk_param_from_def(param)
10111011
}
10121012
}),
1013-
Some(promoted_id),
1014-
),
1013+
promoted: Some(promoted_id),
1014+
}),
10151015
})
10161016
.into(),
10171017
}))

0 commit comments

Comments
 (0)