diff options
| author | Ralf Jung <post@ralfj.de> | 2018-11-27 11:53:18 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-12-03 13:02:02 +0100 |
| commit | d2c19e0bcc2c11e83187dcfc48f9fa110ecf2318 (patch) | |
| tree | f4709b5cf001638fb9101018abb02dccc22ed07f /src/librustc/mir | |
| parent | 7139e1c3ab0f6b912955f27a0f7df13c582ce5ec (diff) | |
| download | rust-d2c19e0bcc2c11e83187dcfc48f9fa110ecf2318.tar.gz rust-d2c19e0bcc2c11e83187dcfc48f9fa110ecf2318.zip | |
Retag needs to know whether this is a 2-phase-reborrow
Diffstat (limited to 'src/librustc/mir')
| -rw-r--r-- | src/librustc/mir/mod.rs | 14 | ||||
| -rw-r--r-- | src/librustc/mir/visit.rs | 7 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 368f83eb611..8c4a40c00c3 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1778,6 +1778,10 @@ pub enum StatementKind<'tcx> { /// `fn_entry` indicates whether this is the initial retag that happens in the /// function prolog. fn_entry: bool, + /// `two_phase` indicates whether this is just the reservation action of + /// a two-phase borrow. + two_phase: bool, + /// The place to retag place: Place<'tcx>, }, @@ -1841,8 +1845,12 @@ impl<'tcx> Debug for Statement<'tcx> { match self.kind { Assign(ref place, ref rv) => write!(fmt, "{:?} = {:?}", place, rv), FakeRead(ref cause, ref place) => write!(fmt, "FakeRead({:?}, {:?})", cause, place), - Retag { fn_entry, ref place } => - write!(fmt, "Retag({}{:?})", if fn_entry { "[fn entry] " } else { "" }, place), + Retag { fn_entry, two_phase, ref place } => + write!(fmt, "Retag({}{}{:?})", + if fn_entry { "[fn entry] " } else { "" }, + if two_phase { "[2phase] " } else { "" }, + place, + ), EscapeToRaw(ref place) => write!(fmt, "EscapeToRaw({:?})", place), StorageLive(ref place) => write!(fmt, "StorageLive({:?})", place), StorageDead(ref place) => write!(fmt, "StorageDead({:?})", place), @@ -3019,7 +3027,7 @@ EnumTypeFoldableImpl! { (StatementKind::StorageLive)(a), (StatementKind::StorageDead)(a), (StatementKind::InlineAsm) { asm, outputs, inputs }, - (StatementKind::Retag) { fn_entry, place }, + (StatementKind::Retag) { fn_entry, two_phase, place }, (StatementKind::EscapeToRaw)(place), (StatementKind::AscribeUserType)(a, v, b), (StatementKind::Nop), diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index 0c9b06a8d8c..d40d85a1937 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -154,9 +154,10 @@ macro_rules! make_mir_visitor { fn visit_retag(&mut self, fn_entry: & $($mutability)* bool, + two_phase: & $($mutability)* bool, place: & $($mutability)* Place<'tcx>, location: Location) { - self.super_retag(fn_entry, place, location); + self.super_retag(fn_entry, two_phase, place, location); } fn visit_place(&mut self, @@ -417,8 +418,9 @@ macro_rules! make_mir_visitor { } } StatementKind::Retag { ref $($mutability)* fn_entry, + ref $($mutability)* two_phase, ref $($mutability)* place } => { - self.visit_retag(fn_entry, place, location); + self.visit_retag(fn_entry, two_phase, place, location); } StatementKind::AscribeUserType( ref $($mutability)* place, @@ -724,6 +726,7 @@ macro_rules! make_mir_visitor { fn super_retag(&mut self, _fn_entry: & $($mutability)* bool, + _two_phase: & $($mutability)* bool, place: & $($mutability)* Place<'tcx>, location: Location) { self.visit_place( |
