diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 1e51ab14f25ef..cbd590052008c 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -1059,12 +1059,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); 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", ); } diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr index 2a992d26fd147..6fbbb55437eb2 100644 --- a/src/test/ui/binop/binop-consume-args.stderr +++ b/src/test/ui/binop/binop-consume-args.stderr @@ -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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Copy, B>(lhs: A, rhs: B) { diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr index ceb8beec77039..dae267da05d17 100644 --- a/src/test/ui/binop/binop-move-semantics.stderr +++ b/src/test/ui/binop/binop-move-semantics.stderr @@ -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 + 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 diff --git a/src/test/ui/moves/move-fn-self-receiver.stderr b/src/test/ui/moves/move-fn-self-receiver.stderr index dda07934e3a0c..b3f95ee192a56 100644 --- a/src/test/ui/moves/move-fn-self-receiver.stderr +++ b/src/test/ui/moves/move-fn-self-receiver.stderr @@ -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 diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index c0e615ca1a899..2a3ca14433f62 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -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