diff options
| author | bors <bors@rust-lang.org> | 2022-06-14 10:51:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-14 10:51:16 +0000 |
| commit | edab34ab2abbafc16a78daedf71dbacd2eb0b7bf (patch) | |
| tree | 2d763273c835911f568f489ccc1c4cf8bb3b7195 /compiler/rustc_middle/src/mir/mod.rs | |
| parent | da895e7938e8d6f8d221fce2876d225bf58df865 (diff) | |
| parent | 27f78051ada9d1290a62ff34d9fe014ca940d4e9 (diff) | |
| download | rust-edab34ab2abbafc16a78daedf71dbacd2eb0b7bf.tar.gz rust-edab34ab2abbafc16a78daedf71dbacd2eb0b7bf.zip | |
Auto merge of #98091 - Dylan-DPC:rollup-ueb6b5x, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #97869 (BTree: tweak internal comments) - #97935 (Rename the `ConstS::val` field as `kind`.) - #97948 (lint: add diagnostic translation migration lints) - #98042 (Fix compat_fn option method on miri) - #98069 (rustdoc: remove link on slice brackets) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle/src/mir/mod.rs')
| -rw-r--r-- | compiler/rustc_middle/src/mir/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 6823dfc6933..1511b51fa25 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -2956,7 +2956,7 @@ impl<'tcx> Constant<'tcx> { impl<'tcx> From<ty::Const<'tcx>> for ConstantKind<'tcx> { #[inline] fn from(ct: ty::Const<'tcx>) -> Self { - match ct.val() { + match ct.kind() { ty::ConstKind::Value(cv) => { // FIXME Once valtrees are introduced we need to convert those // into `ConstValue` instances here @@ -2985,7 +2985,7 @@ impl<'tcx> ConstantKind<'tcx> { pub fn try_val(&self) -> Option<ConstValue<'tcx>> { match self { - ConstantKind::Ty(c) => match c.val() { + ConstantKind::Ty(c) => match c.kind() { ty::ConstKind::Value(v) => Some(v), _ => None, }, @@ -2996,7 +2996,7 @@ impl<'tcx> ConstantKind<'tcx> { #[inline] pub fn try_to_value(self) -> Option<interpret::ConstValue<'tcx>> { match self { - ConstantKind::Ty(c) => c.val().try_to_value(), + ConstantKind::Ty(c) => c.kind().try_to_value(), ConstantKind::Val(val, _) => Some(val), } } @@ -3027,7 +3027,7 @@ impl<'tcx> ConstantKind<'tcx> { Self::Ty(c) => { // FIXME Need to use a different evaluation function that directly returns a `ConstValue` // if evaluation succeeds and does not create a ValTree first - if let Some(val) = c.val().try_eval(tcx, param_env) { + if let Some(val) = c.kind().try_eval(tcx, param_env) { match val { Ok(val) => Self::Val(val, c.ty()), Err(_) => Self::Ty(tcx.const_error(self.ty())), @@ -3161,7 +3161,7 @@ impl<'tcx> ConstantKind<'tcx> { ty::InlineConstSubsts::new(tcx, ty::InlineConstSubstsParts { parent_substs, ty }) .substs; let uneval_const = tcx.mk_const(ty::ConstS { - val: ty::ConstKind::Unevaluated(ty::Unevaluated { + kind: ty::ConstKind::Unevaluated(ty::Unevaluated { def: ty::WithOptConstParam::unknown(def_id).to_global(), substs, promoted: None, @@ -3221,7 +3221,7 @@ impl<'tcx> ConstantKind<'tcx> { let index = generics.param_def_id_to_index[&def_id]; let name = tcx.hir().name(hir_id); let ty_const = tcx.mk_const(ty::ConstS { - val: ty::ConstKind::Param(ty::ParamConst::new(index, name)), + kind: ty::ConstKind::Param(ty::ParamConst::new(index, name)), ty, }); @@ -3258,7 +3258,7 @@ impl<'tcx> ConstantKind<'tcx> { // Error was handled in `const_eval_resolve`. Here we just create a // new unevaluated const and error hard later in codegen let ty_const = tcx.mk_const(ty::ConstS { - val: ty::ConstKind::Unevaluated(ty::Unevaluated { + kind: ty::ConstKind::Unevaluated(ty::Unevaluated { def: def.to_global(), substs: InternalSubsts::identity_for_item(tcx, def.did.to_def_id()), promoted: None, |
