diff options
Diffstat (limited to 'compiler/rustc_trait_selection')
10 files changed, 27 insertions, 27 deletions
diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index c1faa15d43c..9dd8588cece 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -209,7 +209,7 @@ fn check_opaque_type_parameter_valid( GenericArgKind::Lifetime(lt) => { matches!(*lt, ty::ReEarlyBound(_) | ty::ReFree(_)) } - GenericArgKind::Const(ct) => matches!(ct.val(), ty::ConstKind::Param(_)), + GenericArgKind::Const(ct) => matches!(ct.kind(), ty::ConstKind::Param(_)), }; if arg_is_param { @@ -452,7 +452,7 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> { fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> { trace!("checking const {:?}", ct); // Find a const parameter - match ct.val() { + match ct.kind() { ty::ConstKind::Param(..) => { // Look it up in the substitution list. match self.map.get(&ct.into()).map(|k| k.unpack()) { diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index 4bcd3bdd1ef..c95d43b71cf 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -828,7 +828,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { } ty::PredicateKind::ConstEquate(c1, c2) => { let evaluate = |c: ty::Const<'tcx>| { - if let ty::ConstKind::Unevaluated(unevaluated) = c.val() { + if let ty::ConstKind::Unevaluated(unevaluated) = c.kind() { match select.infcx().const_eval_resolve( obligation.param_env, unevaluated, diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index c005541ae14..6cf39be2a9d 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -245,7 +245,7 @@ impl<'tcx> AbstractConst<'tcx> { tcx: TyCtxt<'tcx>, ct: ty::Const<'tcx>, ) -> Result<Option<AbstractConst<'tcx>>, ErrorGuaranteed> { - match ct.val() { + match ct.kind() { ty::ConstKind::Unevaluated(uv) => AbstractConst::new(tcx, uv.shrink()), ty::ConstKind::Error(DelaySpanBugEmitted { reported, .. }) => Err(reported), _ => Ok(None), @@ -414,7 +414,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> { for n in self.nodes.iter() { if let Node::Leaf(ct) = n { - if let ty::ConstKind::Unevaluated(ct) = ct.val() { + if let ty::ConstKind::Unevaluated(ct) = ct.kind() { // `AbstractConst`s should not contain any promoteds as they require references which // are not allowed. assert_eq!(ct.promoted, None); @@ -457,7 +457,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> { let uneval = ty::Unevaluated::new(ty::WithOptConstParam::unknown(def_id), substs); let constant = self.tcx.mk_const(ty::ConstS { - val: ty::ConstKind::Unevaluated(uneval), + kind: ty::ConstKind::Unevaluated(uneval), ty: node.ty, }); @@ -466,7 +466,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> { ExprKind::ConstParam {param, ..} => { let const_param = self.tcx.mk_const(ty::ConstS { - val: ty::ConstKind::Param(*param), + kind: ty::ConstKind::Param(*param), ty: node.ty, }); self.nodes.push(Node::Leaf(const_param)) @@ -748,7 +748,7 @@ impl<'tcx> ConstUnifyCtxt<'tcx> { return false; } - match (a_ct.val(), b_ct.val()) { + match (a_ct.kind(), b_ct.kind()) { // We can just unify errors with everything to reduce the amount of // emitted errors here. (ty::ConstKind::Error(_), _) | (_, ty::ConstKind::Error(_)) => true, diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs index 4263a6fdf18..371157a99f8 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs @@ -234,7 +234,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { // Arrays give us `[]`, `[{ty}; _]` and `[{ty}; N]` if let ty::Array(aty, len) = self_ty.kind() { flags.push((sym::_Self, Some("[]".to_string()))); - let len = len.val().try_to_value().and_then(|v| v.try_to_machine_usize(self.tcx)); + let len = len.kind().try_to_value().and_then(|v| v.try_to_machine_usize(self.tcx)); flags.push((sym::_Self, Some(format!("[{}; _]", aty)))); if let Some(n) = len { flags.push((sym::_Self, Some(format!("[{}; {}]", aty, n)))); diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index 053e871c14f..50735ef048b 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -578,7 +578,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> { // // Let's just see where this breaks :shrug: if let (ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b)) = - (c1.val(), c2.val()) + (c1.kind(), c2.kind()) { if infcx.try_unify_abstract_consts( a.shrink(), @@ -593,7 +593,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> { let stalled_on = &mut pending_obligation.stalled_on; let mut evaluate = |c: Const<'tcx>| { - if let ty::ConstKind::Unevaluated(unevaluated) = c.val() { + if let ty::ConstKind::Unevaluated(unevaluated) = c.kind() { match self.selcx.infcx().const_eval_resolve( obligation.param_env, unevaluated, diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 7341ab0ab12..565f3f509db 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -742,7 +742,7 @@ impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> { } fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> { - match ct.val() { + match ct.kind() { ty::ConstKind::Bound(debruijn, _) if debruijn.as_usize() + 1 > self.current_index.as_usize() + self.universe_indices.len() => @@ -758,7 +758,7 @@ impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> { self.mapped_consts.insert(p, bound_const); self.infcx .tcx - .mk_const(ty::ConstS { val: ty::ConstKind::Placeholder(p), ty: ct.ty() }) + .mk_const(ty::ConstS { kind: ty::ConstKind::Placeholder(p), ty: ct.ty() }) } _ if ct.has_vars_bound_at_or_above(self.current_index) => ct.super_fold_with(self), _ => ct, @@ -878,7 +878,7 @@ impl<'tcx> TypeFolder<'tcx> for PlaceholderReplacer<'_, 'tcx> { } fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> { - if let ty::ConstKind::Placeholder(p) = ct.val() { + if let ty::ConstKind::Placeholder(p) = ct.kind() { let replace_var = self.mapped_consts.get(&p); match replace_var { Some(replace_var) => { @@ -891,7 +891,7 @@ impl<'tcx> TypeFolder<'tcx> for PlaceholderReplacer<'_, 'tcx> { self.universe_indices.len() - index + self.current_index.as_usize() - 1, ); self.tcx().mk_const(ty::ConstS { - val: ty::ConstKind::Bound(db, *replace_var), + kind: ty::ConstKind::Bound(db, *replace_var), ty: ct.ty(), }) } @@ -2018,8 +2018,8 @@ fn confirm_impl_candidate<'cx, 'tcx>( let identity_substs = crate::traits::InternalSubsts::identity_for_item(tcx, assoc_ty.item.def_id); let did = ty::WithOptConstParam::unknown(assoc_ty.item.def_id); - let val = ty::ConstKind::Unevaluated(ty::Unevaluated::new(did, identity_substs)); - tcx.mk_const(ty::ConstS { ty, val }).into() + let kind = ty::ConstKind::Unevaluated(ty::Unevaluated::new(did, identity_substs)); + tcx.mk_const(ty::ConstS { ty, kind }).into() } else { ty.into() }; diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs index e9e2dca17e9..b00f8fe73a1 100644 --- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs @@ -141,7 +141,7 @@ impl<'tcx> TypeVisitor<'tcx> for MaxEscapingBoundVarVisitor { } fn visit_const(&mut self, ct: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> { - match ct.val() { + match ct.kind() { ty::ConstKind::Bound(debruijn, _) if debruijn >= self.outer_index => { self.escaping = self.escaping.max(debruijn.as_usize() - self.outer_index.as_usize()); @@ -337,7 +337,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> { Ok(match constant { mir::ConstantKind::Ty(c) => { let const_folded = c.try_fold_with(self)?; - match const_folded.val() { + match const_folded.kind() { ty::ConstKind::Value(cv) => { // FIXME With Valtrees we need to convert `cv: ValTree` // to a `ConstValue` here. diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index cbf29af1c55..5942bb79d69 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -542,7 +542,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { bound_vars.push(bound_var); tcx.mk_const(ty::ConstS { ty: tcx.type_of(param.def_id), - val: ty::ConstKind::Bound( + kind: ty::ConstKind::Bound( ty::INNERMOST, ty::BoundVar::from_usize(bound_vars.len() - 1), ), @@ -989,7 +989,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // Lifetimes aren't allowed to change during unsizing. GenericArgKind::Lifetime(_) => None, - GenericArgKind::Const(ct) => match ct.val() { + GenericArgKind::Const(ct) => match ct.kind() { ty::ConstKind::Param(p) => Some(p.index), _ => None, }, diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index a484b594418..07e7bad6cb7 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -622,7 +622,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // // Let's just see where this breaks :shrug: if let (ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b)) = - (c1.val(), c2.val()) + (c1.kind(), c2.kind()) { if self.infcx.try_unify_abstract_consts( a.shrink(), @@ -635,7 +635,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } let evaluate = |c: ty::Const<'tcx>| { - if let ty::ConstKind::Unevaluated(unevaluated) = c.val() { + if let ty::ConstKind::Unevaluated(unevaluated) = c.kind() { self.infcx .const_eval_resolve( obligation.param_env, diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 2ce2a44d3db..8d666046ad9 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -41,7 +41,7 @@ pub fn obligations<'a, 'tcx>( .into() } GenericArgKind::Const(ct) => { - match ct.val() { + match ct.kind() { ty::ConstKind::Infer(infer) => { let resolved = infcx.shallow_resolve(infer); if resolved == infer { @@ -51,7 +51,7 @@ pub fn obligations<'a, 'tcx>( infcx .tcx - .mk_const(ty::ConstS { val: ty::ConstKind::Infer(resolved), ty: ct.ty() }) + .mk_const(ty::ConstS { kind: ty::ConstKind::Infer(resolved), ty: ct.ty() }) } _ => ct, } @@ -437,7 +437,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { GenericArgKind::Lifetime(_) => continue, GenericArgKind::Const(constant) => { - match constant.val() { + match constant.kind() { ty::ConstKind::Unevaluated(uv) => { let obligations = self.nominal_obligations(uv.def.did, uv.substs); self.out.extend(obligations); @@ -460,7 +460,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { let cause = self.cause(traits::MiscObligation); let resolved_constant = self.infcx.tcx.mk_const(ty::ConstS { - val: ty::ConstKind::Infer(resolved), + kind: ty::ConstKind::Infer(resolved), ty: constant.ty(), }); self.out.push(traits::Obligation::with_depth( |
