Skip to content

Commit f2f0f1a

Browse files
committed
fix nits
1 parent c5abbd4 commit f2f0f1a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/librustc/mir/mod.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1755,12 +1755,16 @@ pub enum StatementKind<'tcx> {
17551755
},
17561756

17571757
/// Retag references in the given place, ensuring they got fresh tags. This is
1758-
/// part of the Stacked Borrows model. `fn_entry` indicates whether this
1759-
/// is the initial retag that happens in the function prolog. These statements are
1760-
/// currently only interpreted by miri and only generated when "-Z mir-emit-retag" is passed.
1758+
/// part of the Stacked Borrows model. These statements are currently only interpreted
1759+
/// by miri and only generated when "-Z mir-emit-retag" is passed.
17611760
/// See <https://internals.rust-lang.org/t/stacked-borrows-an-aliasing-model-for-rust/8153/>
17621761
/// for more details.
1763-
Retag { fn_entry: bool, place: Place<'tcx> },
1762+
Retag {
1763+
/// `fn_entry` indicates whether this is the initial retag that happens in the
1764+
/// function prolog.
1765+
fn_entry: bool,
1766+
place: Place<'tcx>,
1767+
},
17641768

17651769
/// Mark one terminating point of a region scope (i.e. static region).
17661770
/// (The starting point(s) arise implicitly from borrows.)

src/librustc_mir/transform/add_retag.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ fn is_local<'tcx>(
4242
// (a local storing the array index, the current value of
4343
// the projection base), so we stop tracking here.
4444
false,
45-
_ => is_local(&proj.base),
45+
ProjectionElem::Field { .. } |
46+
ProjectionElem::ConstantIndex { .. } |
47+
ProjectionElem::Subslice { .. } |
48+
ProjectionElem::Downcast { .. } =>
49+
// These just offset by a constant, entirely independent of everything else.
50+
is_local(&proj.base),
4651
}
4752
}
4853
}
@@ -121,7 +126,7 @@ impl MirPass for AddRetag {
121126
Some(Terminator { kind: TerminatorKind::Call { ref destination, .. },
122127
source_info }) => {
123128
// Remember the return destination for later
124-
if let &Some(ref destination) = destination {
129+
if let Some(ref destination) = destination {
125130
if needs_retag(&destination.0) {
126131
returns.push((source_info, destination.0.clone(), destination.1));
127132
}

0 commit comments

Comments
 (0)