]> git.lizzy.rs Git - rust.git/commitdiff
Stop pointing to operators if their libcore method source is not available
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Mon, 12 Dec 2022 15:36:08 +0000 (15:36 +0000)
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 13 Dec 2022 10:06:11 +0000 (10:06 +0000)
compiler/rustc_borrowck/src/diagnostics/mod.rs
src/test/ui/binop/binop-consume-args.stderr
src/test/ui/binop/binop-move-semantics.stderr
src/test/ui/moves/move-fn-self-receiver.stderr
src/test/ui/unop-move-semantics.stderr

index 1e51ab14f25eff700b52448772ddf9819c616ab8..cbd590052008c14a46f3ab0b099ea517ef6f7ce9 100644 (file)
@@ -1059,12 +1059,7 @@ fn explain_captures(
                     );
                     if self.fn_self_span_reported.insert(fn_span) {
                         err.span_note(
-                            // Check whether the source is accessible
-                            if self.infcx.tcx.sess.source_map().is_span_accessible(self_arg.span) {
-                                self_arg.span
-                            } else {
-                                fn_call_span
-                            },
+                            self_arg.span,
                             "calling this operator moves the left-hand side",
                         );
                     }
index 2a992d26fd147b47bb37180ec6c882e95f6a51a7..6fbbb55437eb2f8b91a0d3dd17346411fbdcf7c4 100644 (file)
@@ -9,10 +9,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:6:5
-   |
-LL |     lhs + rhs;
-   |     ^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn add<A: Add<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
@@ -45,10 +42,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:12:5
-   |
-LL |     lhs - rhs;
-   |     ^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn sub<A: Sub<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
@@ -81,10 +75,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:18:5
-   |
-LL |     lhs * rhs;
-   |     ^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn mul<A: Mul<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
@@ -117,10 +108,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:24:5
-   |
-LL |     lhs / rhs;
-   |     ^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn div<A: Div<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
@@ -153,10 +141,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:30:5
-   |
-LL |     lhs % rhs;
-   |     ^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn rem<A: Rem<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
@@ -189,10 +174,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:36:5
-   |
-LL |     lhs & rhs;
-   |     ^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn bitand<A: BitAnd<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
@@ -225,10 +207,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:42:5
-   |
-LL |     lhs | rhs;
-   |     ^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn bitor<A: BitOr<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
@@ -261,10 +240,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:48:5
-   |
-LL |     lhs ^ rhs;
-   |     ^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn bitxor<A: BitXor<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
@@ -297,10 +273,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:54:5
-   |
-LL |     lhs << rhs;
-   |     ^^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn shl<A: Shl<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
@@ -333,10 +306,7 @@ LL |     drop(lhs);
    |          ^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-consume-args.rs:60:5
-   |
-LL |     lhs >> rhs;
-   |     ^^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn shr<A: Shr<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
index ceb8beec77039ef1c5c46f56446ce2745ef3ba8d..dae267da05d1758bd31791fff00a437cc3066a8a 100644 (file)
@@ -12,12 +12,7 @@ LL | |     x;
    |       `x` moved due to usage in operator
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-move-semantics.rs:6:5
-   |
-LL | /     x
-LL | |     +
-LL | |     x;
-   | |_____^
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
 help: consider further restricting this bound
    |
 LL | fn double_move<T: Add<Output=()> + Copy>(x: T) {
@@ -79,12 +74,7 @@ LL | |     *n;
    | |______- `*m` moved due to usage in operator
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/binop-move-semantics.rs:30:5
-   |
-LL | /     *m
-LL | |     +
-LL | |     *n;
-   | |______^
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
 
 error[E0507]: cannot move out of `*n` which is behind a shared reference
   --> $DIR/binop-move-semantics.rs:32:5
index dda07934e3a0ccf0e0f520046e2c3cb02dd67f92..b3f95ee192a565e85a6bc7647068168fd46e203f 100644 (file)
@@ -109,10 +109,7 @@ LL |     foo_add;
    |     ^^^^^^^ value used here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/move-fn-self-receiver.rs:58:5
-   |
-LL |     foo_add + Foo;
-   |     ^^^^^^^^^^^^^
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
 
 error[E0382]: use of moved value: `implicit_into_iter`
   --> $DIR/move-fn-self-receiver.rs:63:5
index c0e615ca1a89949097d70204e56341b5ea015960..2a3ca14433f62ffeaec52fb189a016064eda8d35 100644 (file)
@@ -10,10 +10,7 @@ LL |     x.clone();
    |     ^^^^^^^^^ value borrowed here after move
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/unop-move-semantics.rs:6:5
-   |
-LL |     !x;
-   |     ^^
+  --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
 help: consider cloning the value if the performance cost is acceptable
    |
 LL |     !x.clone();
@@ -56,10 +53,7 @@ LL |     !*m;
    |     `*m` moved due to usage in operator
    |
 note: calling this operator moves the left-hand side
-  --> $DIR/unop-move-semantics.rs:24:5
-   |
-LL |     !*m;
-   |     ^^^
+  --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
 
 error[E0507]: cannot move out of `*n` which is behind a shared reference
   --> $DIR/unop-move-semantics.rs:26:6