about summary refs log tree commit diff
path: root/compiler/rustc_passes
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2022-07-31 16:29:31 +0400
committerMaybe Waffle <waffle.lapkin@gmail.com>2022-07-31 16:29:31 +0400
commit963e402f4384806a4cfb9020208287972e5534d2 (patch)
treefc97f2476fb9901811c19ac6c5c04432c7264bb6 /compiler/rustc_passes
parente11b4b8e02495e9753df983de7bcec9ef2b8ae31 (diff)
downloadrust-963e402f4384806a4cfb9020208287972e5534d2.tar.gz
rust-963e402f4384806a4cfb9020208287972e5534d2.zip
Don't track parent body stability (it wasn't used anyway)
Diffstat (limited to 'compiler/rustc_passes')
-rw-r--r--compiler/rustc_passes/src/stability.rs21
1 files changed, 3 insertions, 18 deletions
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs
index 2a3da4ec30e..be920601ee4 100644
--- a/compiler/rustc_passes/src/stability.rs
+++ b/compiler/rustc_passes/src/stability.rs
@@ -2,8 +2,7 @@
 //! propagating default levels lexically from parent to children ast nodes.
 
 use rustc_attr::{
-    self as attr, ConstStability, DefaultBodyStability, Stability, StabilityLevel, Unstable,
-    UnstableReason,
+    self as attr, ConstStability, Stability, StabilityLevel, Unstable, UnstableReason,
 };
 use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
 use rustc_errors::{struct_span_err, Applicability};
@@ -91,7 +90,6 @@ struct Annotator<'a, 'tcx> {
     index: &'a mut Index,
     parent_stab: Option<Stability>,
     parent_const_stab: Option<ConstStability>,
-    parent_body_stab: Option<DefaultBodyStability>,
     parent_depr: Option<DeprecationEntry>,
     in_trait_impl: bool,
 }
@@ -159,7 +157,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
                 depr.map(|(d, _)| DeprecationEntry::local(d, def_id)),
                 None,
                 None,
-                None,
                 visit_children,
             );
             return;
@@ -213,14 +210,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
             }
         }
 
-        let body_stab = body_stab.map(|(body_stab, _span)| {
+        if let Some((body_stab, _span)) = body_stab {
             // FIXME: check that this item can have body stability
 
             self.index.default_body_stab_map.insert(def_id, body_stab);
             debug!(?self.index.default_body_stab_map);
-
-            body_stab
-        });
+        }
 
         let stab = stab.map(|(stab, span)| {
             // Error if prohibited, or can't inherit anything from a container.
@@ -299,7 +294,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
             depr.map(|(d, _)| DeprecationEntry::local(d, def_id)),
             stab,
             if inherit_const_stability.yes() { const_stab } else { None },
-            body_stab,
             visit_children,
         );
     }
@@ -309,14 +303,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
         depr: Option<DeprecationEntry>,
         stab: Option<Stability>,
         const_stab: Option<ConstStability>,
-        body_stab: Option<DefaultBodyStability>,
         f: impl FnOnce(&mut Self),
     ) {
         // These will be `Some` if this item changes the corresponding stability attribute.
         let mut replaced_parent_depr = None;
         let mut replaced_parent_stab = None;
         let mut replaced_parent_const_stab = None;
-        let mut replaced_parent_body_stab = None;
 
         if let Some(depr) = depr {
             replaced_parent_depr = Some(replace(&mut self.parent_depr, Some(depr)));
@@ -328,9 +320,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
             replaced_parent_const_stab =
                 Some(replace(&mut self.parent_const_stab, Some(const_stab)));
         }
-        if let Some(body_stab) = body_stab {
-            replaced_parent_body_stab = Some(self.parent_body_stab.replace(body_stab));
-        }
 
         f(self);
 
@@ -343,9 +332,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
         if let Some(orig_parent_const_stab) = replaced_parent_const_stab {
             self.parent_const_stab = orig_parent_const_stab;
         }
-        if let Some(orig_parent_body_stab) = replaced_parent_body_stab {
-            self.parent_body_stab = orig_parent_body_stab;
-        }
     }
 }
 
@@ -646,7 +632,6 @@ fn stability_index(tcx: TyCtxt<'_>, (): ()) -> Index {
             index: &mut index,
             parent_stab: None,
             parent_const_stab: None,
-            parent_body_stab: None,
             parent_depr: None,
             in_trait_impl: false,
         };