]> git.lizzy.rs Git - rust.git/commitdiff
fix nits
authorRalf Jung <post@ralfj.de>
Wed, 24 Oct 2018 19:59:42 +0000 (21:59 +0200)
committerRalf Jung <post@ralfj.de>
Mon, 29 Oct 2018 08:16:27 +0000 (09:16 +0100)
src/librustc/mir/mod.rs
src/librustc_mir/transform/add_retag.rs

index d299f0e3b12292522cffcf406941bc63a489663a..636fe115746fb83d36564ff7cc0cf4d5cc55a26e 100644 (file)
@@ -1755,12 +1755,16 @@ pub enum StatementKind<'tcx> {
     },
 
     /// Retag references in the given place, ensuring they got fresh tags.  This is
-    /// part of the Stacked Borrows model. `fn_entry` indicates whether this
-    /// is the initial retag that happens in the function prolog. These statements are
-    /// currently only interpreted by miri and only generated when "-Z mir-emit-retag" is passed.
+    /// part of the Stacked Borrows model. These statements are currently only interpreted
+    /// by miri and only generated when "-Z mir-emit-retag" is passed.
     /// See <https://internals.rust-lang.org/t/stacked-borrows-an-aliasing-model-for-rust/8153/>
     /// for more details.
-    Retag { fn_entry: bool, place: Place<'tcx> },
+    Retag {
+        /// `fn_entry` indicates whether this is the initial retag that happens in the
+        /// function prolog.
+        fn_entry: bool,
+        place: Place<'tcx>,
+    },
 
     /// Mark one terminating point of a region scope (i.e. static region).
     /// (The starting point(s) arise implicitly from borrows.)
index 0f16e29aae904364ae8a5d2861b3a739333c9fa2..a50011cf5a15e5c2c7a09db8de326078d9a33abe 100644 (file)
@@ -42,7 +42,12 @@ fn is_local<'tcx>(
                     // (a local storing the array index, the current value of
                     // the projection base), so we stop tracking here.
                     false,
-                _ => is_local(&proj.base),
+                ProjectionElem::Field { .. } |
+                ProjectionElem::ConstantIndex { .. } |
+                ProjectionElem::Subslice { .. } |
+                ProjectionElem::Downcast { .. } =>
+                    // These just offset by a constant, entirely independent of everything else.
+                    is_local(&proj.base),
             }
         }
     }
@@ -121,7 +126,7 @@ fn run_pass<'a, 'tcx>(&self,
                 Some(Terminator { kind: TerminatorKind::Call { ref destination, .. },
                                   source_info }) => {
                     // Remember the return destination for later
-                    if let &Some(ref destination) = destination {
+                    if let Some(ref destination) = destination {
                         if needs_retag(&destination.0) {
                             returns.push((source_info, destination.0.clone(), destination.1));
                         }