diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-07-26 12:54:13 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-07-26 13:15:31 +0200 |
| commit | c636ded2c759be0dc8fdb9143e06e420ef03ace3 (patch) | |
| tree | 98c3b6eb9c6c601c4ef7db12392f881944ef109e | |
| parent | fefe81605d6111faa8dbb3635ab2c51d59de740a (diff) | |
| download | rust-c636ded2c759be0dc8fdb9143e06e420ef03ace3.tar.gz rust-c636ded2c759be0dc8fdb9143e06e420ef03ace3.zip | |
Improve the information provided when this assertion fails.
| -rw-r--r-- | src/librustc_mir/borrow_check/borrow_set.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index e9e0c5c3613..347bf61480e 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -333,14 +333,21 @@ impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> { // Consider the borrow not activated to start. When we find an activation, we'll update // this field. - let borrow_data = &mut self.idx_vec[borrow_index]; - borrow_data.activation_location = TwoPhaseActivation::NotActivated; + { + let borrow_data = &mut self.idx_vec[borrow_index]; + borrow_data.activation_location = TwoPhaseActivation::NotActivated; + } // Insert `temp` into the list of pending activations. From // now on, we'll be on the lookout for a use of it. Note that // we are guaranteed that this use will come after the // assignment. let old_value = self.pending_activations.insert(temp, borrow_index); - assert!(old_value.is_none()); + if let Some(old_index) = old_value { + span_bug!(self.mir.source_info(start_location).span, + "found already pending activation for temp: {:?} \ + at borrow_index: {:?} with associated data {:?}", + temp, old_index, self.idx_vec[old_index]); + } } } |
