about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorb-naber <bn263@gmx.de>2022-07-04 20:07:14 +0200
committerb-naber <bn263@gmx.de>2022-09-13 17:44:52 +0200
commit372c4fd67fc41f0a06b1e6d804e8345db508761a (patch)
tree117fbc01e5d4a20ca4d22b5a5e75d11f93a32ddc /compiler/rustc_middle
parent0726265442e7c3b0925286e831b24afe508e5cc8 (diff)
downloadrust-372c4fd67fc41f0a06b1e6d804e8345db508761a.tar.gz
rust-372c4fd67fc41f0a06b1e6d804e8345db508761a.zip
remove visit_const from mir visitors
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/mir/pretty.rs5
-rw-r--r--compiler/rustc_middle/src/mir/visit.rs25
2 files changed, 13 insertions, 17 deletions
diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs
index 3c559e2fe20..0b42137d4e3 100644
--- a/compiler/rustc_middle/src/mir/pretty.rs
+++ b/compiler/rustc_middle/src/mir/pretty.rs
@@ -706,13 +706,12 @@ pub fn write_allocations<'tcx>(
     struct CollectAllocIds(BTreeSet<AllocId>);
 
     impl<'tcx> Visitor<'tcx> for CollectAllocIds {
-        fn visit_constant(&mut self, c: &Constant<'tcx>, loc: Location) {
+        fn visit_constant(&mut self, c: &Constant<'tcx>, _: Location) {
             match c.literal {
-                ConstantKind::Ty(c) => self.visit_const(c, loc),
+                ConstantKind::Ty(_) | ConstantKind::Unevaluated(..) => {}
                 ConstantKind::Val(val, _) => {
                     self.0.extend(alloc_ids_from_const_val(val));
                 }
-                ConstantKind::Unevaluated(..) => {}
             }
         }
     }
diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs
index 6dde8c8b65d..3b1e02a9e9d 100644
--- a/compiler/rustc_middle/src/mir/visit.rs
+++ b/compiler/rustc_middle/src/mir/visit.rs
@@ -237,14 +237,6 @@ macro_rules! make_mir_visitor {
                 self.super_region(region);
             }
 
-            fn visit_const(
-                &mut self,
-                constant: $(& $mutability)? ty::Const<'tcx>,
-                _: Location,
-            ) {
-                self.super_const(constant);
-            }
-
             fn visit_substs(
                 &mut self,
                 substs: & $($mutability)? SubstsRef<'tcx>,
@@ -877,7 +869,7 @@ macro_rules! make_mir_visitor {
                 self.visit_span($(& $mutability)? *span);
                 drop(user_ty); // no visit method for this
                 match literal {
-                    ConstantKind::Ty(ct) => self.visit_const($(& $mutability)? *ct, location),
+                    ConstantKind::Ty(_) => {}
                     ConstantKind::Val(_, ty) => self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)),
                     ConstantKind::Unevaluated(_, ty) => self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)),
                 }
@@ -917,9 +909,6 @@ macro_rules! make_mir_visitor {
             fn super_region(&mut self, _region: $(& $mutability)? ty::Region<'tcx>) {
             }
 
-            fn super_const(&mut self, _const: $(& $mutability)? ty::Const<'tcx>) {
-            }
-
             fn super_substs(&mut self, _substs: & $($mutability)? SubstsRef<'tcx>) {
             }
 
@@ -1088,12 +1077,20 @@ 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 { .. }