diff options
| author | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-07-22 12:20:50 +0200 |
|---|---|---|
| committer | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-07-23 09:51:31 +0200 |
| commit | ac54b7499babbb3041942e332f583f8cfadc9d3b (patch) | |
| tree | 7b7d8d6d82ab4a659564142d7bf90c65b14e15eb | |
| parent | 4fba7d33d614a78d1d641dc9b65d4a04e0d36e8a (diff) | |
| download | rust-ac54b7499babbb3041942e332f583f8cfadc9d3b.tar.gz rust-ac54b7499babbb3041942e332f583f8cfadc9d3b.zip | |
A promoted has a place and can thus be equal to itself
| -rw-r--r-- | src/librustc_mir/borrow_check/places_conflict.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index 73beb72794d..c44af003654 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -327,11 +327,21 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( Overlap::EqualOrDisjoint } } - (Place::Promoted(_), Place::Promoted(_)) | + (Place::Promoted(p1), Place::Promoted(p2)) => { + if p1.0 == p2.0 { + // the same promoted - base case, equal + debug!("place_element_conflict: DISJOINT-OR-EQ-PROMOTED"); + Overlap::EqualOrDisjoint + } else { + // different promoteds - base case, disjoint + debug!("place_element_conflict: DISJOINT-PROMOTED"); + Overlap::Disjoint + } + } (Place::Local(_), Place::Promoted(_)) | (Place::Promoted(_), Place::Local(_)) | (Place::Promoted(_), Place::Static(_)) | (Place::Static(_), Place::Promoted(_)) | (Place::Local(_), Place::Static(_)) | (Place::Static(_), Place::Local(_)) => { - debug!("place_element_conflict: DISJOINT-STATIC-LOCAL"); + debug!("place_element_conflict: DISJOINT-STATIC-LOCAL-PROMOTED"); Overlap::Disjoint } (Place::Projection(pi1), Place::Projection(pi2)) => { |
