1
Fork 0
This commit is contained in:
Ralf Jung 2018-10-24 21:59:42 +02:00
parent c5abbd4be3
commit f2f0f1a0a8
2 changed files with 15 additions and 6 deletions

View 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.)

View 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 @@ impl MirPass for AddRetag {
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));
}