Remove DesugaringKind::Replace.
This commit is contained in:
parent
d300bffa4f
commit
844c1cc5fe
26 changed files with 78 additions and 82 deletions
|
@ -1635,34 +1635,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
})
|
||||
}
|
||||
|
||||
/// Reports StorageDeadOrDrop of `place` conflicts with `borrow`.
|
||||
///
|
||||
/// Depending on the origin of the StorageDeadOrDrop, this may be
|
||||
/// reported as either a drop or an illegal mutation of a borrowed value.
|
||||
/// The latter is preferred when the this is a drop triggered by a
|
||||
/// reassignment, as it's more user friendly to report a problem with the
|
||||
/// explicit assignment than the implicit drop.
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
pub(crate) fn report_storage_dead_or_drop_of_borrowed(
|
||||
&mut self,
|
||||
location: Location,
|
||||
place_span: (Place<'tcx>, Span),
|
||||
borrow: &BorrowData<'tcx>,
|
||||
) {
|
||||
// It's sufficient to check the last desugaring as Replace is the last
|
||||
// one to be applied.
|
||||
if let Some(DesugaringKind::Replace) = place_span.1.desugaring_kind() {
|
||||
self.report_illegal_mutation_of_borrowed(location, place_span, borrow)
|
||||
} else {
|
||||
self.report_borrowed_value_does_not_live_long_enough(
|
||||
location,
|
||||
borrow,
|
||||
place_span,
|
||||
Some(WriteKind::StorageDeadOrDrop),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// This means that some data referenced by `borrow` needs to live
|
||||
/// past the point where the StorageDeadOrDrop of `place` occurs.
|
||||
/// This is usually interpreted as meaning that `place` has too
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue