Skip to content

Commit 2a3b0e3

Browse files
committed
Rename method.
1 parent 114eb2d commit 2a3b0e3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/rustc_mir_transform/src/remove_zsts.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Removes assignments to ZST places.
1+
//! Removes operations on ZST places, and convert ZST operands to constants.
22
33
use crate::MirPass;
44
use rustc_middle::mir::interpret::ConstValue;
@@ -53,7 +53,7 @@ fn maybe_zst(ty: Ty<'_>) -> bool {
5353
}
5454

5555
impl<'tcx> Replacer<'_, 'tcx> {
56-
fn is_zst(&self, ty: Ty<'tcx>) -> bool {
56+
fn known_to_be_zst(&self, ty: Ty<'tcx>) -> bool {
5757
if !maybe_zst(ty) {
5858
return false;
5959
}
@@ -64,7 +64,7 @@ impl<'tcx> Replacer<'_, 'tcx> {
6464
}
6565

6666
fn make_zst(&self, ty: Ty<'tcx>) -> Constant<'tcx> {
67-
debug_assert!(self.is_zst(ty));
67+
debug_assert!(self.known_to_be_zst(ty));
6868
Constant {
6969
span: rustc_span::DUMMY_SP,
7070
user_ty: None,
@@ -83,12 +83,12 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
8383
VarDebugInfoContents::Const(_) => {}
8484
VarDebugInfoContents::Place(place) => {
8585
let place_ty = place.ty(self.local_decls, self.tcx).ty;
86-
if self.is_zst(place_ty) {
86+
if self.known_to_be_zst(place_ty) {
8787
var_debug_info.value = VarDebugInfoContents::Const(self.make_zst(place_ty))
8888
}
8989
}
9090
VarDebugInfoContents::Composite { ty, fragments: _ } => {
91-
if self.is_zst(ty) {
91+
if self.known_to_be_zst(ty) {
9292
var_debug_info.value = VarDebugInfoContents::Const(self.make_zst(ty))
9393
}
9494
}
@@ -100,7 +100,7 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
100100
return;
101101
}
102102
let op_ty = operand.ty(self.local_decls, self.tcx);
103-
if self.is_zst(op_ty)
103+
if self.known_to_be_zst(op_ty)
104104
&& self.tcx.consider_optimizing(|| {
105105
format!("RemoveZsts - Operand: {:?} Location: {:?}", operand, loc)
106106
})
@@ -114,7 +114,7 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
114114
statement.kind
115115
{
116116
let place_ty = place.ty(self.local_decls, self.tcx).ty;
117-
if self.is_zst(place_ty)
117+
if self.known_to_be_zst(place_ty)
118118
&& self.tcx.consider_optimizing(|| {
119119
format!(
120120
"RemoveZsts - Place: {:?} SourceInfo: {:?}",

0 commit comments

Comments
 (0)