about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-01-25 16:54:45 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-03-13 18:19:59 +0000
commit63ce733fe272e6ead8f9536754f002c93883651a (patch)
treebf846dc215b1afa7734710666ed8fdd3b6fcbdc4
parent9e3f091f2b48933694ef3fecaf586f7d7dde523d (diff)
downloadrust-63ce733fe272e6ead8f9536754f002c93883651a.tar.gz
rust-63ce733fe272e6ead8f9536754f002c93883651a.zip
Rename method.
-rw-r--r--compiler/rustc_mir_transform/src/remove_zsts.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_mir_transform/src/remove_zsts.rs b/compiler/rustc_mir_transform/src/remove_zsts.rs
index 454976a1fd0..140298f166f 100644
--- a/compiler/rustc_mir_transform/src/remove_zsts.rs
+++ b/compiler/rustc_mir_transform/src/remove_zsts.rs
@@ -1,4 +1,4 @@
-//! Removes assignments to ZST places.
+//! Removes operations on ZST places, and convert ZST operands to constants.
 
 use crate::MirPass;
 use rustc_middle::mir::interpret::ConstValue;
@@ -53,7 +53,7 @@ fn maybe_zst(ty: Ty<'_>) -> bool {
 }
 
 impl<'tcx> Replacer<'_, 'tcx> {
-    fn is_zst(&self, ty: Ty<'tcx>) -> bool {
+    fn known_to_be_zst(&self, ty: Ty<'tcx>) -> bool {
         if !maybe_zst(ty) {
             return false;
         }
@@ -64,7 +64,7 @@ impl<'tcx> Replacer<'_, 'tcx> {
     }
 
     fn make_zst(&self, ty: Ty<'tcx>) -> Constant<'tcx> {
-        debug_assert!(self.is_zst(ty));
+        debug_assert!(self.known_to_be_zst(ty));
         Constant {
             span: rustc_span::DUMMY_SP,
             user_ty: None,
@@ -83,12 +83,12 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
             VarDebugInfoContents::Const(_) => {}
             VarDebugInfoContents::Place(place) => {
                 let place_ty = place.ty(self.local_decls, self.tcx).ty;
-                if self.is_zst(place_ty) {
+                if self.known_to_be_zst(place_ty) {
                     var_debug_info.value = VarDebugInfoContents::Const(self.make_zst(place_ty))
                 }
             }
             VarDebugInfoContents::Composite { ty, fragments: _ } => {
-                if self.is_zst(ty) {
+                if self.known_to_be_zst(ty) {
                     var_debug_info.value = VarDebugInfoContents::Const(self.make_zst(ty))
                 }
             }
@@ -100,7 +100,7 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
             return;
         }
         let op_ty = operand.ty(self.local_decls, self.tcx);
-        if self.is_zst(op_ty)
+        if self.known_to_be_zst(op_ty)
             && self.tcx.consider_optimizing(|| {
                 format!("RemoveZsts - Operand: {:?} Location: {:?}", operand, loc)
             })
@@ -114,7 +114,7 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
             statement.kind
         {
             let place_ty = place.ty(self.local_decls, self.tcx).ty;
-            if self.is_zst(place_ty)
+            if self.known_to_be_zst(place_ty)
                 && self.tcx.consider_optimizing(|| {
                     format!(
                         "RemoveZsts - Place: {:?} SourceInfo: {:?}",