about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-07-05 17:38:46 -0400
committerRalf Jung <post@ralfj.de>2022-07-09 07:27:29 -0400
commitac265cdc19fe99b5909410893dd1583d6cb895fe (patch)
treee3808875f4616db2cd84b500083f3a279cb10a43 /compiler/rustc_middle/src
parent052651dd134c6016108c5fc50bfe4196012a6a8f (diff)
downloadrust-ac265cdc19fe99b5909410893dd1583d6cb895fe.tar.gz
rust-ac265cdc19fe99b5909410893dd1583d6cb895fe.zip
review feedback
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/mir/interpret/value.rs6
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs4
-rw-r--r--compiler/rustc_middle/src/mir/pretty.rs4
-rw-r--r--compiler/rustc_middle/src/thir.rs6
4 files changed, 7 insertions, 13 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/value.rs b/compiler/rustc_middle/src/mir/interpret/value.rs
index 59242b785c6..e38e4fc54c5 100644
--- a/compiler/rustc_middle/src/mir/interpret/value.rs
+++ b/compiler/rustc_middle/src/mir/interpret/value.rs
@@ -35,7 +35,7 @@ pub enum ConstValue<'tcx> {
     Scalar(Scalar),
 
     /// Only used for ZSTs.
-    ZST,
+    Zst,
 
     /// Used only for `&[u8]` and `&str`
     Slice { data: ConstAllocation<'tcx>, start: usize, end: usize },
@@ -58,7 +58,7 @@ impl<'a, 'tcx> Lift<'tcx> for ConstValue<'a> {
     fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<ConstValue<'tcx>> {
         Some(match self {
             ConstValue::Scalar(s) => ConstValue::Scalar(s),
-            ConstValue::ZST => ConstValue::ZST,
+            ConstValue::Zst => ConstValue::Zst,
             ConstValue::Slice { data, start, end } => {
                 ConstValue::Slice { data: tcx.lift(data)?, start, end }
             }
@@ -73,7 +73,7 @@ impl<'tcx> ConstValue<'tcx> {
     #[inline]
     pub fn try_to_scalar(&self) -> Option<Scalar<AllocId>> {
         match *self {
-            ConstValue::ByRef { .. } | ConstValue::Slice { .. } | ConstValue::ZST => None,
+            ConstValue::ByRef { .. } | ConstValue::Slice { .. } | ConstValue::Zst => None,
             ConstValue::Scalar(val) => Some(val),
         }
     }
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index 532b7f2bf0c..066cb4d2057 100644
--- a/compiler/rustc_middle/src/mir/mod.rs
+++ b/compiler/rustc_middle/src/mir/mod.rs
@@ -1711,7 +1711,7 @@ impl<'tcx> Operand<'tcx> {
         Operand::Constant(Box::new(Constant {
             span,
             user_ty: None,
-            literal: ConstantKind::Val(ConstValue::ZST, ty),
+            literal: ConstantKind::Val(ConstValue::Zst, ty),
         }))
     }
 
@@ -2196,7 +2196,7 @@ impl<'tcx> ConstantKind<'tcx> {
 
     #[inline]
     pub fn zero_sized(ty: Ty<'tcx>) -> Self {
-        let cv = ConstValue::ZST;
+        let cv = ConstValue::Zst;
         Self::Val(cv, ty)
     }
 
diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs
index 453e33efdd2..07a3c8cf7bb 100644
--- a/compiler/rustc_middle/src/mir/pretty.rs
+++ b/compiler/rustc_middle/src/mir/pretty.rs
@@ -449,7 +449,7 @@ impl<'tcx> Visitor<'tcx> for ExtraComments<'tcx> {
             }
 
             let fmt_val = |val: &ConstValue<'tcx>| match val {
-                ConstValue::ZST => format!("ZST"),
+                ConstValue::Zst => format!("ZST"),
                 ConstValue::Scalar(s) => format!("Scalar({:?})", s),
                 ConstValue::Slice { .. } => format!("Slice(..)"),
                 ConstValue::ByRef { .. } => format!("ByRef(..)"),
@@ -680,7 +680,7 @@ pub fn write_allocations<'tcx>(
             ConstValue::Scalar(interpret::Scalar::Int { .. }) => {
                 Either::Left(Either::Right(std::iter::empty()))
             }
-            ConstValue::ZST => Either::Left(Either::Right(std::iter::empty())),
+            ConstValue::Zst => Either::Left(Either::Right(std::iter::empty())),
             ConstValue::ByRef { alloc, .. } | ConstValue::Slice { data: alloc, .. } => {
                 Either::Right(alloc_ids_from_alloc(alloc))
             }
diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs
index 1938c56768d..3fe6394ad7e 100644
--- a/compiler/rustc_middle/src/thir.rs
+++ b/compiler/rustc_middle/src/thir.rs
@@ -458,12 +458,6 @@ pub enum ExprKind<'tcx> {
     },
 }
 
-impl<'tcx> ExprKind<'tcx> {
-    pub fn zero_sized_literal(user_ty: Option<Canonical<'tcx, UserType<'tcx>>>) -> Self {
-        ExprKind::ZstLiteral { user_ty }
-    }
-}
-
 /// Represents the association of a field identifier and an expression.
 ///
 /// This is used in struct constructors.