about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2020-06-11 18:10:13 -0400
committerAaron Hill <aa1ronham@gmail.com>2020-06-11 18:10:13 -0400
commit5902b2f6e5922068d01af2b7438044dbaee5ace6 (patch)
tree3e8d94f50806d6ab4f9265fd12dbd33e78a21e98
parent2c11c35f8982a9a5fd654f0499cc72b70208d62f (diff)
downloadrust-5902b2f6e5922068d01af2b7438044dbaee5ace6.tar.gz
rust-5902b2f6e5922068d01af2b7438044dbaee5ace6.zip
Use `fn_span` to point to the actual method call
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/mod.rs6
-rw-r--r--src/test/ui/codemap_tests/tab_3.stderr2
-rw-r--r--src/test/ui/issues/issue-34721.stderr4
-rw-r--r--src/test/ui/moves/move-fn-self-receiver.stderr16
-rw-r--r--src/test/ui/moves/moves-based-on-type-access-to-field.stderr2
-rw-r--r--src/test/ui/moves/moves-based-on-type-exprs.stderr4
-rw-r--r--src/test/ui/unsized-locals/borrow-after-move.stderr2
-rw-r--r--src/test/ui/unsized-locals/double-move.stderr2
-rw-r--r--src/test/ui/use/use-after-move-self-based-on-type.stderr2
-rw-r--r--src/test/ui/use/use-after-move-self.stderr2
-rw-r--r--src/test/ui/walk-struct-literal-with.stderr2
11 files changed, 22 insertions, 22 deletions
diff --git a/src/librustc_mir/borrow_check/diagnostics/mod.rs b/src/librustc_mir/borrow_check/diagnostics/mod.rs
index 2e49b2b58e8..ca8c77bcd69 100644
--- a/src/librustc_mir/borrow_check/diagnostics/mod.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/mod.rs
@@ -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];
 
diff --git a/src/test/ui/codemap_tests/tab_3.stderr b/src/test/ui/codemap_tests/tab_3.stderr
index b8abee670ef..614e69e89f6 100644
--- a/src/test/ui/codemap_tests/tab_3.stderr
+++ b/src/test/ui/codemap_tests/tab_3.stderr
@@ -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
diff --git a/src/test/ui/issues/issue-34721.stderr b/src/test/ui/issues/issue-34721.stderr
index 2ce0786e831..b4cc1a0aa7e 100644
--- a/src/test/ui/issues/issue-34721.stderr
+++ b/src/test/ui/issues/issue-34721.stderr
@@ -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
diff --git a/src/test/ui/moves/move-fn-self-receiver.stderr b/src/test/ui/moves/move-fn-self-receiver.stderr
index def4f324483..4333e8a23e8 100644
--- a/src/test/ui/moves/move-fn-self-receiver.stderr
+++ b/src/test/ui/moves/move-fn-self-receiver.stderr
@@ -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
    |
diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr
index f76b7a6f68f..142feb280d1 100644
--- a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr
+++ b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr
@@ -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
    |
diff --git a/src/test/ui/moves/moves-based-on-type-exprs.stderr b/src/test/ui/moves/moves-based-on-type-exprs.stderr
index f55854ccf09..ff98aab50c9 100644
--- a/src/test/ui/moves/moves-based-on-type-exprs.stderr
+++ b/src/test/ui/moves/moves-based-on-type-exprs.stderr
@@ -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
    |
diff --git a/src/test/ui/unsized-locals/borrow-after-move.stderr b/src/test/ui/unsized-locals/borrow-after-move.stderr
index d3f59db0436..906b543e421 100644
--- a/src/test/ui/unsized-locals/borrow-after-move.stderr
+++ b/src/test/ui/unsized-locals/borrow-after-move.stderr
@@ -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
diff --git a/src/test/ui/unsized-locals/double-move.stderr b/src/test/ui/unsized-locals/double-move.stderr
index 01a08ba9944..49b2031c6b9 100644
--- a/src/test/ui/unsized-locals/double-move.stderr
+++ b/src/test/ui/unsized-locals/double-move.stderr
@@ -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
    |
diff --git a/src/test/ui/use/use-after-move-self-based-on-type.stderr b/src/test/ui/use/use-after-move-self-based-on-type.stderr
index 0b3ee040d35..b9440f4de07 100644
--- a/src/test/ui/use/use-after-move-self-based-on-type.stderr
+++ b/src/test/ui/use/use-after-move-self-based-on-type.stderr
@@ -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
    |
diff --git a/src/test/ui/use/use-after-move-self.stderr b/src/test/ui/use/use-after-move-self.stderr
index e156a3f699b..3da53b024db 100644
--- a/src/test/ui/use/use-after-move-self.stderr
+++ b/src/test/ui/use/use-after-move-self.stderr
@@ -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
    |
diff --git a/src/test/ui/walk-struct-literal-with.stderr b/src/test/ui/walk-struct-literal-with.stderr
index 2534c29c18d..ece63a2b819 100644
--- a/src/test/ui/walk-struct-literal-with.stderr
+++ b/src/test/ui/walk-struct-literal-with.stderr
@@ -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
    |