Some(Cause::DropVar(local, location)) => match &mir.local_decls[local].name {
Some(local_name) => {
let mut should_note_order = false;
- if let Some((WriteKind::StorageDeadOrDrop(_), place)) = kind_place {
+ if let Some((WriteKind::StorageDeadOrDrop, place)) = kind_place {
if let Place::Local(borrowed_local) = place {
let dropped_local_scope = mir.local_decls[local].visibility_scope;
let borrowed_local_scope =
mir.local_decls[*borrowed_local].visibility_scope;
- if mir.is_sub_scope(borrowed_local_scope, dropped_local_scope) {
+ if mir.is_sub_scope(borrowed_local_scope, dropped_local_scope)
+ && local != *borrowed_local
+ {
should_note_order = true;
}
}
| |
| `v` dropped here while still borrowed
| borrow later used here, when `v` is dropped
- |
- = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to previous error
| |
| `d1` dropped here while still borrowed
| borrow later used here, when `d1` is dropped
- |
- = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to 2 previous errors
| borrow later used here, when `foo` is dropped
|
= note: consider using a `let` binding to create a longer lived value
- = note: values in a scope are dropped in the opposite order they are defined
error: aborting due to previous error
| |
| `factorial` dropped here while still borrowed
| borrow later used here, when `factorial` is dropped
- |
- = note: values in a scope are dropped in the opposite order they are defined
error[E0506]: cannot assign to `factorial` because it is borrowed
--> $DIR/unboxed-closures-failed-recursive-fn-1.rs:30:5