diff options
| -rw-r--r-- | compiler/rustc_borrowck/src/type_check/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/visit.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop_lint.rs | 2 |
4 files changed, 5 insertions, 13 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index ed9ede029a8..5efb716429f 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -1819,7 +1819,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { _ => None, }, ConstantKind::Unevaluated(uv, _) => Some(uv), - _ => None, + ConstantKind::Val(..) => None, }; if let Some(uv) = maybe_uneval { diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 7c9b1e492d9..738b62e3cb8 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -2062,7 +2062,7 @@ pub enum ConstantKind<'tcx> { /// This constant came from the type system Ty(ty::Const<'tcx>), - /// An unevaluated constant that cannot go back into the type system. + /// An unevaluated mir constant which is not part of the type system. Unevaluated(ty::Unevaluated<'tcx, Option<Promoted>>, Ty<'tcx>), /// This constant cannot go back into the type system, as it represents diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 3b1e02a9e9d..d9b24566bf1 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -1077,20 +1077,12 @@ macro_rules! visit_place_fns { location, ); - if new_local == local { - None - } else { - Some(PlaceElem::Index(new_local)) - } + if new_local == local { None } else { Some(PlaceElem::Index(new_local)) } } PlaceElem::Field(field, ty) => { let mut new_ty = ty; self.visit_ty(&mut new_ty, TyContext::Location(location)); - if ty != new_ty { - Some(PlaceElem::Field(field, new_ty)) - } else { - None - } + if ty != new_ty { Some(PlaceElem::Field(field, new_ty)) } else { None } } PlaceElem::Deref | PlaceElem::ConstantIndex { .. } diff --git a/compiler/rustc_mir_transform/src/const_prop_lint.rs b/compiler/rustc_mir_transform/src/const_prop_lint.rs index cd94af2d3c6..072abe86008 100644 --- a/compiler/rustc_mir_transform/src/const_prop_lint.rs +++ b/compiler/rustc_mir_transform/src/const_prop_lint.rs @@ -299,7 +299,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { let err = ConstEvalErr::new(&self.ecx, error, Some(c.span)); if let Some(lint_root) = self.lint_root(source_info) { let lint_only = match c.literal { - ConstantKind::Ty(_) => c.literal.needs_subst(), + ConstantKind::Ty(ct) => ct.needs_subst(), ConstantKind::Unevaluated( ty::Unevaluated { def: _, substs: _, promoted: Some(_) }, _, |
