1
Fork 0

Remove CallKind::Deref hack from UseSpans

It's not really necessary
This commit is contained in:
Michael Goulet 2025-01-06 03:45:02 +00:00
parent cd65cd27db
commit 339902908e
4 changed files with 6 additions and 15 deletions

View file

@ -661,9 +661,6 @@ impl UseSpans<'_> {
UseSpans::ClosureUse { args_span: span, .. } UseSpans::ClosureUse { args_span: span, .. }
| UseSpans::PatUse(span) | UseSpans::PatUse(span)
| UseSpans::OtherUse(span) => span, | UseSpans::OtherUse(span) => span,
UseSpans::FnSelfUse { fn_call_span, kind: CallKind::DerefCoercion { .. }, .. } => {
fn_call_span
}
UseSpans::FnSelfUse { var_span, .. } => var_span, UseSpans::FnSelfUse { var_span, .. } => var_span,
} }
} }
@ -674,9 +671,6 @@ impl UseSpans<'_> {
UseSpans::ClosureUse { path_span: span, .. } UseSpans::ClosureUse { path_span: span, .. }
| UseSpans::PatUse(span) | UseSpans::PatUse(span)
| UseSpans::OtherUse(span) => span, | UseSpans::OtherUse(span) => span,
UseSpans::FnSelfUse { fn_call_span, kind: CallKind::DerefCoercion { .. }, .. } => {
fn_call_span
}
UseSpans::FnSelfUse { var_span, .. } => var_span, UseSpans::FnSelfUse { var_span, .. } => var_span,
} }
} }
@ -687,9 +681,6 @@ impl UseSpans<'_> {
UseSpans::ClosureUse { capture_kind_span: span, .. } UseSpans::ClosureUse { capture_kind_span: span, .. }
| UseSpans::PatUse(span) | UseSpans::PatUse(span)
| UseSpans::OtherUse(span) => span, | UseSpans::OtherUse(span) => span,
UseSpans::FnSelfUse { fn_call_span, kind: CallKind::DerefCoercion { .. }, .. } => {
fn_call_span
}
UseSpans::FnSelfUse { var_span, .. } => var_span, UseSpans::FnSelfUse { var_span, .. } => var_span,
} }
} }

View file

@ -4,7 +4,7 @@ error[E0382]: borrow of partially moved value: `val`
LL | let _val = val.first; LL | let _val = val.first;
| --------- value partially moved here | --------- value partially moved here
LL | val.inner; LL | val.inner;
| ^^^^^^^^^ value borrowed here after partial move | ^^^ value borrowed here after partial move
| |
= note: partial move occurs because `val.first` has type `NotCopy`, which does not implement the `Copy` trait = note: partial move occurs because `val.first` has type `NotCopy`, which does not implement the `Copy` trait
= note: borrow occurs due to deref coercion to `NotCopy` = note: borrow occurs due to deref coercion to `NotCopy`
@ -20,7 +20,7 @@ error[E0382]: borrow of partially moved value: `val`
LL | let _val = val.first; LL | let _val = val.first;
| --------- value partially moved here | --------- value partially moved here
LL | val.inner_method(); LL | val.inner_method();
| ^^^^^^^^^^^^^^^^^^ value borrowed here after partial move | ^^^ value borrowed here after partial move
| |
= note: partial move occurs because `val.first` has type `NotCopy`, which does not implement the `Copy` trait = note: partial move occurs because `val.first` has type `NotCopy`, which does not implement the `Copy` trait
= note: borrow occurs due to deref coercion to `NotCopy` = note: borrow occurs due to deref coercion to `NotCopy`

View file

@ -1,5 +1,5 @@
error[E0382]: borrow of moved value: `arc_v` error[E0382]: borrow of moved value: `arc_v`
--> $DIR/no-capture-arc.rs:14:16 --> $DIR/no-capture-arc.rs:14:18
| |
LL | let arc_v = Arc::new(v); LL | let arc_v = Arc::new(v);
| ----- move occurs because `arc_v` has type `Arc<Vec<i32>>`, which does not implement the `Copy` trait | ----- move occurs because `arc_v` has type `Arc<Vec<i32>>`, which does not implement the `Copy` trait
@ -10,7 +10,7 @@ LL | assert_eq!((*arc_v)[3], 4);
| ----- variable moved due to use in closure | ----- variable moved due to use in closure
... ...
LL | assert_eq!((*arc_v)[2], 3); LL | assert_eq!((*arc_v)[2], 3);
| ^^^^^^^^ value borrowed here after move | ^^^^^ value borrowed here after move
| |
= note: borrow occurs due to deref coercion to `Vec<i32>` = note: borrow occurs due to deref coercion to `Vec<i32>`

View file

@ -1,5 +1,5 @@
error[E0382]: borrow of moved value: `arc_v` error[E0382]: borrow of moved value: `arc_v`
--> $DIR/no-reuse-move-arc.rs:12:16 --> $DIR/no-reuse-move-arc.rs:12:18
| |
LL | let arc_v = Arc::new(v); LL | let arc_v = Arc::new(v);
| ----- move occurs because `arc_v` has type `Arc<Vec<i32>>`, which does not implement the `Copy` trait | ----- move occurs because `arc_v` has type `Arc<Vec<i32>>`, which does not implement the `Copy` trait
@ -10,7 +10,7 @@ LL | assert_eq!((*arc_v)[3], 4);
| ----- variable moved due to use in closure | ----- variable moved due to use in closure
... ...
LL | assert_eq!((*arc_v)[2], 3); LL | assert_eq!((*arc_v)[2], 3);
| ^^^^^^^^ value borrowed here after move | ^^^^^ value borrowed here after move
| |
= note: borrow occurs due to deref coercion to `Vec<i32>` = note: borrow occurs due to deref coercion to `Vec<i32>`