Use `fn_span` to point to the actual method call
This commit is contained in:
parent
2c11c35f89
commit
5902b2f6e5
|
@ -795,8 +795,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
debug!("move_spans: target_temp = {:?}", target_temp);
|
||||
|
||||
if let Some(Terminator {
|
||||
kind: TerminatorKind::Call { func, args, .. },
|
||||
source_info: term_source_info,
|
||||
kind: TerminatorKind::Call { func, args, fn_span, .. },
|
||||
..
|
||||
}) = &self.body[location.block].terminator
|
||||
{
|
||||
let mut method_did = None;
|
||||
|
@ -819,7 +819,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
if let [Operand::Move(self_place), ..] = **args {
|
||||
if self_place.as_local() == Some(target_temp) {
|
||||
let is_fn_once = tcx.parent(method_did) == tcx.lang_items().fn_once_trait();
|
||||
let fn_call_span = term_source_info.span;
|
||||
let fn_call_span = *fn_span;
|
||||
|
||||
let self_arg = tcx.fn_arg_names(method_did)[0];
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `some_vec`
|
|||
LL | let some_vec = vec!["hi"];
|
||||
| -------- move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait
|
||||
LL | some_vec.into_iter();
|
||||
| -------------------- `some_vec` moved due to this method call
|
||||
| ----------- `some_vec` moved due to this method call
|
||||
LL | {
|
||||
LL | println!("{:?}", some_vec);
|
||||
| ^^^^^^^^ value borrowed here after move
|
||||
|
|
|
@ -5,10 +5,10 @@ LL | pub fn baz<T: Foo>(x: T) -> T {
|
|||
| - move occurs because `x` has type `T`, which does not implement the `Copy` trait
|
||||
LL | if 0 == 1 {
|
||||
LL | bar::bar(x.zero())
|
||||
| -------- `x` moved due to this method call
|
||||
| ------ `x` moved due to this method call
|
||||
LL | } else {
|
||||
LL | x.zero()
|
||||
| -------- `x` moved due to this method call
|
||||
| ------ `x` moved due to this method call
|
||||
LL | };
|
||||
LL | x.zero()
|
||||
| ^ value used here after move
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0382]: use of moved value: `val.0`
|
|||
--> $DIR/move-fn-self-receiver.rs:30:5
|
||||
|
|
||||
LL | val.0.into_iter().next();
|
||||
| ----------------- `val.0` moved due to this method call
|
||||
| ----------- `val.0` moved due to this method call
|
||||
LL | val.0;
|
||||
| ^^^^^ value used here after move
|
||||
|
|
||||
|
@ -19,7 +19,7 @@ error[E0382]: use of moved value: `foo`
|
|||
LL | let foo = Foo;
|
||||
| --- move occurs because `foo` has type `Foo`, which does not implement the `Copy` trait
|
||||
LL | foo.use_self();
|
||||
| -------------- `foo` moved due to this method call
|
||||
| ---------- `foo` moved due to this method call
|
||||
LL | foo;
|
||||
| ^^^ value used here after move
|
||||
|
|
||||
|
@ -35,7 +35,7 @@ error[E0382]: use of moved value: `second_foo`
|
|||
LL | let second_foo = Foo;
|
||||
| ---------- move occurs because `second_foo` has type `Foo`, which does not implement the `Copy` trait
|
||||
LL | second_foo.use_self();
|
||||
| --------------------- `second_foo` moved due to this method call
|
||||
| ---------- `second_foo` moved due to this method call
|
||||
LL | second_foo;
|
||||
| ^^^^^^^^^^ value used here after move
|
||||
|
||||
|
@ -45,7 +45,7 @@ error[E0382]: use of moved value: `boxed_foo`
|
|||
LL | let boxed_foo = Box::new(Foo);
|
||||
| --------- move occurs because `boxed_foo` has type `std::boxed::Box<Foo>`, which does not implement the `Copy` trait
|
||||
LL | boxed_foo.use_box_self();
|
||||
| ------------------------ `boxed_foo` moved due to this method call
|
||||
| -------------- `boxed_foo` moved due to this method call
|
||||
LL | boxed_foo;
|
||||
| ^^^^^^^^^ value used here after move
|
||||
|
|
||||
|
@ -61,7 +61,7 @@ error[E0382]: use of moved value: `pin_box_foo`
|
|||
LL | let pin_box_foo = Box::pin(Foo);
|
||||
| ----------- move occurs because `pin_box_foo` has type `std::pin::Pin<std::boxed::Box<Foo>>`, which does not implement the `Copy` trait
|
||||
LL | pin_box_foo.use_pin_box_self();
|
||||
| ------------------------------ `pin_box_foo` moved due to this method call
|
||||
| ------------------ `pin_box_foo` moved due to this method call
|
||||
LL | pin_box_foo;
|
||||
| ^^^^^^^^^^^ value used here after move
|
||||
|
|
||||
|
@ -87,7 +87,7 @@ error[E0382]: use of moved value: `rc_foo`
|
|||
LL | let rc_foo = Rc::new(Foo);
|
||||
| ------ move occurs because `rc_foo` has type `std::rc::Rc<Foo>`, which does not implement the `Copy` trait
|
||||
LL | rc_foo.use_rc_self();
|
||||
| -------------------- `rc_foo` moved due to this method call
|
||||
| ------------- `rc_foo` moved due to this method call
|
||||
LL | rc_foo;
|
||||
| ^^^^^^ value used here after move
|
||||
|
|
||||
|
@ -132,7 +132,7 @@ error[E0382]: use of moved value: `explicit_into_iter`
|
|||
LL | let explicit_into_iter = vec![true];
|
||||
| ------------------ move occurs because `explicit_into_iter` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
|
||||
LL | for _val in explicit_into_iter.into_iter() {}
|
||||
| ------------------------------ `explicit_into_iter` moved due to this method call
|
||||
| ----------- `explicit_into_iter` moved due to this method call
|
||||
LL | explicit_into_iter;
|
||||
| ^^^^^^^^^^^^^^^^^^ value used here after move
|
||||
|
||||
|
@ -142,7 +142,7 @@ error[E0382]: use of moved value: `container`
|
|||
LL | let container = Container(vec![]);
|
||||
| --------- move occurs because `container` has type `Container`, which does not implement the `Copy` trait
|
||||
LL | for _val in container.custom_into_iter() {}
|
||||
| ---------------------------- `container` moved due to this method call
|
||||
| ------------------ `container` moved due to this method call
|
||||
LL | container;
|
||||
| ^^^^^^^^^ value used here after move
|
||||
|
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `x`
|
|||
LL | let x = vec!["hi".to_string()];
|
||||
| - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
|
||||
LL | consume(x.into_iter().next().unwrap());
|
||||
| ------------- `x` moved due to this method call
|
||||
| ----------- `x` moved due to this method call
|
||||
LL | touch(&x[0]);
|
||||
| ^ value borrowed here after move
|
||||
|
|
||||
|
|
|
@ -104,7 +104,7 @@ error[E0382]: borrow of moved value: `x`
|
|||
LL | let x = vec!["hi".to_string()];
|
||||
| - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
|
||||
LL | let _y = x.into_iter().next().unwrap();
|
||||
| ------------- `x` moved due to this method call
|
||||
| ----------- `x` moved due to this method call
|
||||
LL | touch(&x);
|
||||
| ^^ value borrowed here after move
|
||||
|
|
||||
|
@ -120,7 +120,7 @@ error[E0382]: borrow of moved value: `x`
|
|||
LL | let x = vec!["hi".to_string()];
|
||||
| - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
|
||||
LL | let _y = [x.into_iter().next().unwrap(); 1];
|
||||
| ------------- `x` moved due to this method call
|
||||
| ----------- `x` moved due to this method call
|
||||
LL | touch(&x);
|
||||
| ^^ value borrowed here after move
|
||||
|
|
||||
|
|
|
@ -37,7 +37,7 @@ error[E0382]: borrow of moved value: `y`
|
|||
LL | let y = *x;
|
||||
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
|
||||
LL | y.foo();
|
||||
| ------- `y` moved due to this method call
|
||||
| ----- `y` moved due to this method call
|
||||
...
|
||||
LL | println!("{}", &y);
|
||||
| ^^ value borrowed here after move
|
||||
|
|
|
@ -34,7 +34,7 @@ error[E0382]: use of moved value: `y`
|
|||
LL | let y = *x;
|
||||
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
|
||||
LL | y.foo();
|
||||
| ------- `y` moved due to this method call
|
||||
| ----- `y` moved due to this method call
|
||||
LL | y.foo();
|
||||
| ^ value used here after move
|
||||
|
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0382]: use of moved value: `self`
|
|||
LL | pub fn foo(self) -> isize {
|
||||
| ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait
|
||||
LL | self.bar();
|
||||
| ---------- `self` moved due to this method call
|
||||
| ----- `self` moved due to this method call
|
||||
LL | return self.x;
|
||||
| ^^^^^^ value used here after move
|
||||
|
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0382]: use of moved value: `self`
|
|||
LL | pub fn foo(self) -> isize {
|
||||
| ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait
|
||||
LL | self.bar();
|
||||
| ---------- `self` moved due to this method call
|
||||
| ----- `self` moved due to this method call
|
||||
LL | return *self.x;
|
||||
| ^^^^^^^ value used here after move
|
||||
|
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `start`
|
|||
LL | let start = Mine{test:"Foo".to_string(), other_val:0};
|
||||
| ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
|
||||
LL | let end = Mine{other_val:1, ..start.make_string_bar()};
|
||||
| ----------------------- `start` moved due to this method call
|
||||
| ----------------- `start` moved due to this method call
|
||||
LL | println!("{}", start.test);
|
||||
| ^^^^^^^^^^ value borrowed here after move
|
||||
|
|
||||
|
|
Loading…
Reference in New Issue