]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/mir/mod.rs
Remove inline attributes that hadn't been profiled, unexport Cache since it no longer...
[rust.git] / src / librustc / mir / mod.rs
index 9f71840576382fccbd0334af45b24bd90274e1ad..cc25ad0e22529e3a57d5afa7f97c5b4198c8e7d4 100644 (file)
@@ -38,7 +38,8 @@
 use syntax_pos::{Span, DUMMY_SP};
 
 pub use crate::mir::interpret::AssertMessage;
-pub use crate::mir::cache::BodyCache;
+pub use crate::mir::cache::{BodyCache, ReadOnlyBodyCache};
+pub use crate::read_only;
 
 pub mod cache;
 pub mod interpret;
@@ -107,7 +108,7 @@ pub struct Body<'tcx> {
     pub yield_ty: Option<Ty<'tcx>>,
 
     /// Generator drop glue.
-    pub generator_drop: Option<Box<Body<'tcx>>>,
+    pub generator_drop: Option<Box<BodyCache<'tcx>>>,
 
     /// The layout of a generator. Produced by the state transformation.
     pub generator_layout: Option<GeneratorLayout<'tcx>>,
@@ -2600,7 +2601,7 @@ pub fn successor_within_block(&self) -> Location {
     pub fn is_predecessor_of<'tcx>(
         &self,
         other: Location,
-        mut body_cache: BodyCache<&'_ Body<'tcx>>
+        body: ReadOnlyBodyCache<'_, 'tcx>
     ) -> bool {
         // If we are in the same block as the other location and are an earlier statement
         // then we are a predecessor of `other`.
@@ -2609,13 +2610,13 @@ pub fn is_predecessor_of<'tcx>(
         }
 
         // If we're in another block, then we want to check that block is a predecessor of `other`.
-        let mut queue: Vec<BasicBlock> = body_cache.predecessors_for(other.block).to_vec();
+        let mut queue: Vec<BasicBlock> = body.predecessors_for(other.block).to_vec();
         let mut visited = FxHashSet::default();
 
         while let Some(block) = queue.pop() {
             // If we haven't visited this block before, then make sure we visit it's predecessors.
             if visited.insert(block) {
-                queue.extend(body_cache.predecessors_for(block).iter().cloned());
+                queue.extend(body.predecessors_for(block).iter().cloned());
             } else {
                 continue;
             }