Rollup merge of #59467 - hgallagher1993:local_branch, r=estebank
Better diagnostic for binary operation on BoxedValues Fixes #59458
This commit is contained in:
@@ -306,7 +306,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||||||
if let Some(missing_trait) = missing_trait {
|
if let Some(missing_trait) = missing_trait {
|
||||||
if op.node == hir::BinOpKind::Add &&
|
if op.node == hir::BinOpKind::Add &&
|
||||||
self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
|
self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
|
||||||
rhs_ty, &mut err, true) {
|
rhs_ty, &mut err, true, op) {
|
||||||
// This has nothing here because it means we did string
|
// This has nothing here because it means we did string
|
||||||
// concatenation (e.g., "Hello " += "World!"). This means
|
// concatenation (e.g., "Hello " += "World!"). This means
|
||||||
// we don't want the note in the else clause to be emitted
|
// we don't want the note in the else clause to be emitted
|
||||||
@@ -327,10 +327,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||||||
err.emit();
|
err.emit();
|
||||||
}
|
}
|
||||||
IsAssign::No => {
|
IsAssign::No => {
|
||||||
let mut err = struct_span_err!(self.tcx.sess, expr.span, E0369,
|
let mut err = struct_span_err!(self.tcx.sess, op.span, E0369,
|
||||||
"binary operation `{}` cannot be applied to type `{}`",
|
"binary operation `{}` cannot be applied to type `{}`",
|
||||||
op.node.as_str(),
|
op.node.as_str(),
|
||||||
lhs_ty);
|
lhs_ty);
|
||||||
|
|
||||||
|
if !lhs_expr.span.eq(&rhs_expr.span) {
|
||||||
|
err.span_label(lhs_expr.span, lhs_ty.to_string());
|
||||||
|
err.span_label(rhs_expr.span, rhs_ty.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
let mut suggested_deref = false;
|
let mut suggested_deref = false;
|
||||||
if let Ref(_, mut rty, _) = lhs_ty.sty {
|
if let Ref(_, mut rty, _) = lhs_ty.sty {
|
||||||
if {
|
if {
|
||||||
@@ -380,7 +386,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||||||
if let Some(missing_trait) = missing_trait {
|
if let Some(missing_trait) = missing_trait {
|
||||||
if op.node == hir::BinOpKind::Add &&
|
if op.node == hir::BinOpKind::Add &&
|
||||||
self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
|
self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
|
||||||
rhs_ty, &mut err, false) {
|
rhs_ty, &mut err, false, op) {
|
||||||
// This has nothing here because it means we did string
|
// This has nothing here because it means we did string
|
||||||
// concatenation (e.g., "Hello " + "World!"). This means
|
// concatenation (e.g., "Hello " + "World!"). This means
|
||||||
// we don't want the note in the else clause to be emitted
|
// we don't want the note in the else clause to be emitted
|
||||||
@@ -418,6 +424,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||||||
rhs_ty: Ty<'tcx>,
|
rhs_ty: Ty<'tcx>,
|
||||||
err: &mut errors::DiagnosticBuilder<'_>,
|
err: &mut errors::DiagnosticBuilder<'_>,
|
||||||
is_assign: bool,
|
is_assign: bool,
|
||||||
|
op: hir::BinOp,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let source_map = self.tcx.sess.source_map();
|
let source_map = self.tcx.sess.source_map();
|
||||||
let msg = "`to_owned()` can be used to create an owned `String` \
|
let msg = "`to_owned()` can be used to create an owned `String` \
|
||||||
@@ -431,7 +438,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||||||
(&Ref(_, l_ty, _), &Ref(_, r_ty, _))
|
(&Ref(_, l_ty, _), &Ref(_, r_ty, _))
|
||||||
if l_ty.sty == Str && r_ty.sty == Str => {
|
if l_ty.sty == Str && r_ty.sty == Str => {
|
||||||
if !is_assign {
|
if !is_assign {
|
||||||
err.span_label(expr.span,
|
err.span_label(op.span,
|
||||||
"`+` can't be used to concatenate two `&str` strings");
|
"`+` can't be used to concatenate two `&str` strings");
|
||||||
match source_map.span_to_snippet(lhs_expr.span) {
|
match source_map.span_to_snippet(lhs_expr.span) {
|
||||||
Ok(lstring) => err.span_suggestion(
|
Ok(lstring) => err.span_suggestion(
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
|
error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
|
||||||
--> $DIR/autoderef-full-lval.rs:15:20
|
--> $DIR/autoderef-full-lval.rs:15:24
|
||||||
|
|
|
|
||||||
LL | let z: isize = a.x + b.y;
|
LL | let z: isize = a.x + b.y;
|
||||||
| ^^^^^^^^^
|
| --- ^ --- std::boxed::Box<isize>
|
||||||
|
| |
|
||||||
|
| std::boxed::Box<isize>
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
|
= note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
|
||||||
|
|
||||||
error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
|
error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
|
||||||
--> $DIR/autoderef-full-lval.rs:21:25
|
--> $DIR/autoderef-full-lval.rs:21:33
|
||||||
|
|
|
|
||||||
LL | let answer: isize = forty.a + two.a;
|
LL | let answer: isize = forty.a + two.a;
|
||||||
| ^^^^^^^^^^^^^^^
|
| ------- ^ ----- std::boxed::Box<isize>
|
||||||
|
| |
|
||||||
|
| std::boxed::Box<isize>
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
|
= note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `%` cannot be applied to type `&&{integer}`
|
error[E0369]: binary operation `%` cannot be applied to type `&&{integer}`
|
||||||
--> $DIR/binary-op-on-double-ref.rs:4:9
|
--> $DIR/binary-op-on-double-ref.rs:4:11
|
||||||
|
|
|
|
||||||
LL | x % 2 == 0
|
LL | x % 2 == 0
|
||||||
| ^^^^^
|
| - ^ - {integer}
|
||||||
|
| |
|
||||||
|
| &&{integer}
|
||||||
|
|
|
|
||||||
= help: `%` can be used on '{integer}', you can dereference `x`: `*x`
|
= help: `%` can be used on '{integer}', you can dereference `x`: `*x`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `^` cannot be applied to type `std::string::String`
|
error[E0369]: binary operation `^` cannot be applied to type `std::string::String`
|
||||||
--> $DIR/binop-bitxor-str.rs:3:21
|
--> $DIR/binop-bitxor-str.rs:3:37
|
||||||
|
|
|
|
||||||
LL | fn main() { let x = "a".to_string() ^ "b".to_string(); }
|
LL | fn main() { let x = "a".to_string() ^ "b".to_string(); }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| --------------- ^ --------------- std::string::String
|
||||||
|
| |
|
||||||
|
| std::string::String
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::BitXor` might be missing for `std::string::String`
|
= note: an implementation of `std::ops::BitXor` might be missing for `std::string::String`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `*` cannot be applied to type `bool`
|
error[E0369]: binary operation `*` cannot be applied to type `bool`
|
||||||
--> $DIR/binop-mul-bool.rs:3:21
|
--> $DIR/binop-mul-bool.rs:3:26
|
||||||
|
|
|
|
||||||
LL | fn main() { let x = true * false; }
|
LL | fn main() { let x = true * false; }
|
||||||
| ^^^^^^^^^^^^
|
| ---- ^ ----- bool
|
||||||
|
| |
|
||||||
|
| bool
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Mul` might be missing for `bool`
|
= note: an implementation of `std::ops::Mul` might be missing for `bool`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `bool`
|
error[E0369]: binary operation `+` cannot be applied to type `bool`
|
||||||
--> $DIR/binop-typeck.rs:6:13
|
--> $DIR/binop-typeck.rs:6:15
|
||||||
|
|
|
|
||||||
LL | let z = x + y;
|
LL | let z = x + y;
|
||||||
| ^^^^^
|
| - ^ - {integer}
|
||||||
|
| |
|
||||||
|
| bool
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `bool`
|
= note: an implementation of `std::ops::Add` might be missing for `bool`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `==` cannot be applied to type `fn() {main::f}`
|
error[E0369]: binary operation `==` cannot be applied to type `fn() {main::f}`
|
||||||
--> $DIR/fn-compare-mismatch.rs:4:13
|
--> $DIR/fn-compare-mismatch.rs:4:15
|
||||||
|
|
|
|
||||||
LL | let x = f == g;
|
LL | let x = f == g;
|
||||||
| ^^^^^^
|
| - ^^ - fn() {main::g}
|
||||||
|
| |
|
||||||
|
| fn() {main::f}
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::cmp::PartialEq` might be missing for `fn() {main::f}`
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `fn() {main::f}`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `()`
|
error[E0369]: binary operation `+` cannot be applied to type `()`
|
||||||
--> $DIR/for-loop-type-error.rs:2:13
|
--> $DIR/for-loop-type-error.rs:2:16
|
||||||
|
|
|
|
||||||
LL | let x = () + ();
|
LL | let x = () + ();
|
||||||
| ^^^^^^^
|
| -- ^ -- ()
|
||||||
|
| |
|
||||||
|
| ()
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `()`
|
= note: an implementation of `std::ops::Add` might be missing for `()`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
|
error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
|
||||||
--> $DIR/issue-14915.rs:6:20
|
--> $DIR/issue-14915.rs:6:22
|
||||||
|
|
|
|
||||||
LL | println!("{}", x + 1);
|
LL | println!("{}", x + 1);
|
||||||
| ^^^^^
|
| - ^ - {integer}
|
||||||
|
| |
|
||||||
|
| std::boxed::Box<isize>
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
|
= note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ LL | 1.create_a_type_error[
|
|||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0369]: binary operation `+` cannot be applied to type `()`
|
error[E0369]: binary operation `+` cannot be applied to type `()`
|
||||||
--> $DIR/issue-24363.rs:3:9
|
--> $DIR/issue-24363.rs:3:11
|
||||||
|
|
|
|
||||||
LL | ()+()
|
LL | ()+()
|
||||||
| ^^^^^
|
| --^-- ()
|
||||||
|
| |
|
||||||
|
| ()
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `()`
|
= note: an implementation of `std::ops::Add` might be missing for `()`
|
||||||
|
|
||||||
|
|||||||
@@ -1,120 +1,150 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `A`
|
error[E0369]: binary operation `+` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:6:5
|
--> $DIR/issue-28837.rs:6:7
|
||||||
|
|
|
|
||||||
LL | a + a;
|
LL | a + a;
|
||||||
| ^^^^^
|
| - ^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `A`
|
= note: an implementation of `std::ops::Add` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `-` cannot be applied to type `A`
|
error[E0369]: binary operation `-` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:8:5
|
--> $DIR/issue-28837.rs:8:7
|
||||||
|
|
|
|
||||||
LL | a - a;
|
LL | a - a;
|
||||||
| ^^^^^
|
| - ^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Sub` might be missing for `A`
|
= note: an implementation of `std::ops::Sub` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `*` cannot be applied to type `A`
|
error[E0369]: binary operation `*` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:10:5
|
--> $DIR/issue-28837.rs:10:7
|
||||||
|
|
|
|
||||||
LL | a * a;
|
LL | a * a;
|
||||||
| ^^^^^
|
| - ^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Mul` might be missing for `A`
|
= note: an implementation of `std::ops::Mul` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `/` cannot be applied to type `A`
|
error[E0369]: binary operation `/` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:12:5
|
--> $DIR/issue-28837.rs:12:7
|
||||||
|
|
|
|
||||||
LL | a / a;
|
LL | a / a;
|
||||||
| ^^^^^
|
| - ^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Div` might be missing for `A`
|
= note: an implementation of `std::ops::Div` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `%` cannot be applied to type `A`
|
error[E0369]: binary operation `%` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:14:5
|
--> $DIR/issue-28837.rs:14:7
|
||||||
|
|
|
|
||||||
LL | a % a;
|
LL | a % a;
|
||||||
| ^^^^^
|
| - ^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Rem` might be missing for `A`
|
= note: an implementation of `std::ops::Rem` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `&` cannot be applied to type `A`
|
error[E0369]: binary operation `&` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:16:5
|
--> $DIR/issue-28837.rs:16:7
|
||||||
|
|
|
|
||||||
LL | a & a;
|
LL | a & a;
|
||||||
| ^^^^^
|
| - ^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::BitAnd` might be missing for `A`
|
= note: an implementation of `std::ops::BitAnd` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `|` cannot be applied to type `A`
|
error[E0369]: binary operation `|` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:18:5
|
--> $DIR/issue-28837.rs:18:7
|
||||||
|
|
|
|
||||||
LL | a | a;
|
LL | a | a;
|
||||||
| ^^^^^
|
| - ^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::BitOr` might be missing for `A`
|
= note: an implementation of `std::ops::BitOr` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `<<` cannot be applied to type `A`
|
error[E0369]: binary operation `<<` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:20:5
|
--> $DIR/issue-28837.rs:20:7
|
||||||
|
|
|
|
||||||
LL | a << a;
|
LL | a << a;
|
||||||
| ^^^^^^
|
| - ^^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Shl` might be missing for `A`
|
= note: an implementation of `std::ops::Shl` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `>>` cannot be applied to type `A`
|
error[E0369]: binary operation `>>` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:22:5
|
--> $DIR/issue-28837.rs:22:7
|
||||||
|
|
|
|
||||||
LL | a >> a;
|
LL | a >> a;
|
||||||
| ^^^^^^
|
| - ^^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Shr` might be missing for `A`
|
= note: an implementation of `std::ops::Shr` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `==` cannot be applied to type `A`
|
error[E0369]: binary operation `==` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:24:5
|
--> $DIR/issue-28837.rs:24:7
|
||||||
|
|
|
|
||||||
LL | a == a;
|
LL | a == a;
|
||||||
| ^^^^^^
|
| - ^^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::cmp::PartialEq` might be missing for `A`
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `!=` cannot be applied to type `A`
|
error[E0369]: binary operation `!=` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:26:5
|
--> $DIR/issue-28837.rs:26:7
|
||||||
|
|
|
|
||||||
LL | a != a;
|
LL | a != a;
|
||||||
| ^^^^^^
|
| - ^^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::cmp::PartialEq` might be missing for `A`
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `<` cannot be applied to type `A`
|
error[E0369]: binary operation `<` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:28:5
|
--> $DIR/issue-28837.rs:28:7
|
||||||
|
|
|
|
||||||
LL | a < a;
|
LL | a < a;
|
||||||
| ^^^^^
|
| - ^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::cmp::PartialOrd` might be missing for `A`
|
= note: an implementation of `std::cmp::PartialOrd` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `<=` cannot be applied to type `A`
|
error[E0369]: binary operation `<=` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:30:5
|
--> $DIR/issue-28837.rs:30:7
|
||||||
|
|
|
|
||||||
LL | a <= a;
|
LL | a <= a;
|
||||||
| ^^^^^^
|
| - ^^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::cmp::PartialOrd` might be missing for `A`
|
= note: an implementation of `std::cmp::PartialOrd` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `>` cannot be applied to type `A`
|
error[E0369]: binary operation `>` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:32:5
|
--> $DIR/issue-28837.rs:32:7
|
||||||
|
|
|
|
||||||
LL | a > a;
|
LL | a > a;
|
||||||
| ^^^^^
|
| - ^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::cmp::PartialOrd` might be missing for `A`
|
= note: an implementation of `std::cmp::PartialOrd` might be missing for `A`
|
||||||
|
|
||||||
error[E0369]: binary operation `>=` cannot be applied to type `A`
|
error[E0369]: binary operation `>=` cannot be applied to type `A`
|
||||||
--> $DIR/issue-28837.rs:34:5
|
--> $DIR/issue-28837.rs:34:7
|
||||||
|
|
|
|
||||||
LL | a >= a;
|
LL | a >= a;
|
||||||
| ^^^^^^
|
| - ^^ - A
|
||||||
|
| |
|
||||||
|
| A
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::cmp::PartialOrd` might be missing for `A`
|
= note: an implementation of `std::cmp::PartialOrd` might be missing for `A`
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `{integer}`
|
error[E0369]: binary operation `+` cannot be applied to type `{integer}`
|
||||||
--> $DIR/issue-31076.rs:13:13
|
--> $DIR/issue-31076.rs:13:15
|
||||||
|
|
|
|
||||||
LL | let x = 5 + 6;
|
LL | let x = 5 + 6;
|
||||||
| ^^^^^
|
| - ^ - {integer}
|
||||||
|
| |
|
||||||
|
| {integer}
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `{integer}`
|
= note: an implementation of `std::ops::Add` might be missing for `{integer}`
|
||||||
|
|
||||||
error[E0369]: binary operation `+` cannot be applied to type `i32`
|
error[E0369]: binary operation `+` cannot be applied to type `i32`
|
||||||
--> $DIR/issue-31076.rs:15:13
|
--> $DIR/issue-31076.rs:15:18
|
||||||
|
|
|
|
||||||
LL | let y = 5i32 + 6i32;
|
LL | let y = 5i32 + 6i32;
|
||||||
| ^^^^^^^^^^^
|
| ---- ^ ---- i32
|
||||||
|
| |
|
||||||
|
| i32
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `i32`
|
= note: an implementation of `std::ops::Add` might be missing for `i32`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `*` cannot be applied to type `&T`
|
error[E0369]: binary operation `*` cannot be applied to type `&T`
|
||||||
--> $DIR/issue-35668.rs:2:22
|
--> $DIR/issue-35668.rs:2:23
|
||||||
|
|
|
|
||||||
LL | a.iter().map(|a| a*a)
|
LL | a.iter().map(|a| a*a)
|
||||||
| ^^^
|
| -^- &T
|
||||||
|
| |
|
||||||
|
| &T
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Mul` might be missing for `&T`
|
= note: an implementation of `std::ops::Mul` might be missing for `&T`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `*` cannot be applied to type `Thing`
|
error[E0369]: binary operation `*` cannot be applied to type `Thing`
|
||||||
--> $DIR/issue-3820.rs:14:13
|
--> $DIR/issue-3820.rs:14:15
|
||||||
|
|
|
|
||||||
LL | let w = u * 3;
|
LL | let w = u * 3;
|
||||||
| ^^^^^
|
| - ^ - {integer}
|
||||||
|
| |
|
||||||
|
| Thing
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Mul` might be missing for `Thing`
|
= note: an implementation of `std::ops::Mul` might be missing for `Thing`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `()`
|
error[E0369]: binary operation `+` cannot be applied to type `()`
|
||||||
--> $DIR/issue-40610.rs:4:5
|
--> $DIR/issue-40610.rs:4:8
|
||||||
|
|
|
|
||||||
LL | () + f(&[1.0]);
|
LL | () + f(&[1.0]);
|
||||||
| ^^^^^^^^^^^^^^
|
| -- ^ --------- ()
|
||||||
|
| |
|
||||||
|
| ()
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `()`
|
= note: an implementation of `std::ops::Add` might be missing for `()`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
||||||
--> $DIR/issue-41394.rs:2:9
|
--> $DIR/issue-41394.rs:2:12
|
||||||
|
|
|
|
||||||
LL | A = "" + 1
|
LL | A = "" + 1
|
||||||
| ^^^^^^
|
| -- ^ - {integer}
|
||||||
|
| |
|
||||||
|
| &str
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `&str`
|
= note: an implementation of `std::ops::Add` might be missing for `&str`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
||||||
--> $DIR/issue-47377.rs:4:12
|
--> $DIR/issue-47377.rs:4:14
|
||||||
|
|
|
|
||||||
LL | let _a = b + ", World!";
|
LL | let _a = b + ", World!";
|
||||||
| ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
|
| - ^ ---------- &str
|
||||||
|
| | |
|
||||||
|
| | `+` can't be used to concatenate two `&str` strings
|
||||||
|
| &str
|
||||||
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
||||||
|
|
|
|
||||||
LL | let _a = b.to_owned() + ", World!";
|
LL | let _a = b.to_owned() + ", World!";
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
||||||
--> $DIR/issue-47380.rs:3:33
|
--> $DIR/issue-47380.rs:3:35
|
||||||
|
|
|
|
||||||
LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
|
LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
|
||||||
| ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
|
| - ^ ---------- &str
|
||||||
|
| | |
|
||||||
|
| | `+` can't be used to concatenate two `&str` strings
|
||||||
|
| &str
|
||||||
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
||||||
|
|
|
|
||||||
LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";
|
LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";
|
||||||
|
|||||||
@@ -38,10 +38,12 @@ LL | false == 0 < 2;
|
|||||||
found type `{integer}`
|
found type `{integer}`
|
||||||
|
|
||||||
error[E0369]: binary operation `<` cannot be applied to type `fn() {f::<_>}`
|
error[E0369]: binary operation `<` cannot be applied to type `fn() {f::<_>}`
|
||||||
--> $DIR/require-parens-for-chained-comparison.rs:13:5
|
--> $DIR/require-parens-for-chained-comparison.rs:13:6
|
||||||
|
|
|
|
||||||
LL | f<X>();
|
LL | f<X>();
|
||||||
| ^^^
|
| -^- X
|
||||||
|
| |
|
||||||
|
| fn() {f::<_>}
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() {f::<_>}`
|
= note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() {f::<_>}`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `*` cannot be applied to type `std::vec::Vec<isize>`
|
error[E0369]: binary operation `*` cannot be applied to type `std::vec::Vec<isize>`
|
||||||
--> $DIR/pattern-tyvar-2.rs:3:69
|
--> $DIR/pattern-tyvar-2.rs:3:71
|
||||||
|
|
|
|
||||||
LL | fn foo(t: Bar) -> isize { match t { Bar::T1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } }
|
LL | fn foo(t: Bar) -> isize { match t { Bar::T1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } }
|
||||||
| ^^^^^
|
| - ^ - {integer}
|
||||||
|
| |
|
||||||
|
| std::vec::Vec<isize>
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Mul` might be missing for `std::vec::Vec<isize>`
|
= note: an implementation of `std::ops::Mul` might be missing for `std::vec::Vec<isize>`
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,35 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
||||||
--> $DIR/issue-39018.rs:2:13
|
--> $DIR/issue-39018.rs:2:22
|
||||||
|
|
|
|
||||||
LL | let x = "Hello " + "World!";
|
LL | let x = "Hello " + "World!";
|
||||||
| ^^^^^^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
|
| -------- ^ -------- &str
|
||||||
|
| | |
|
||||||
|
| | `+` can't be used to concatenate two `&str` strings
|
||||||
|
| &str
|
||||||
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
||||||
|
|
|
|
||||||
LL | let x = "Hello ".to_owned() + "World!";
|
LL | let x = "Hello ".to_owned() + "World!";
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0369]: binary operation `+` cannot be applied to type `World`
|
error[E0369]: binary operation `+` cannot be applied to type `World`
|
||||||
--> $DIR/issue-39018.rs:8:13
|
--> $DIR/issue-39018.rs:8:26
|
||||||
|
|
|
|
||||||
LL | let y = World::Hello + World::Goodbye;
|
LL | let y = World::Hello + World::Goodbye;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ------------ ^ -------------- World
|
||||||
|
| |
|
||||||
|
| World
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `World`
|
= note: an implementation of `std::ops::Add` might be missing for `World`
|
||||||
|
|
||||||
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
||||||
--> $DIR/issue-39018.rs:11:13
|
--> $DIR/issue-39018.rs:11:22
|
||||||
|
|
|
|
||||||
LL | let x = "Hello " + "World!".to_owned();
|
LL | let x = "Hello " + "World!".to_owned();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `+` can't be used to concatenate a `&str` with a `String`
|
| ---------^--------------------
|
||||||
|
| | |
|
||||||
|
| | std::string::String
|
||||||
|
| &str
|
||||||
|
| `+` can't be used to concatenate a `&str` with a `String`
|
||||||
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
||||||
|
|
|
|
||||||
LL | let x = "Hello ".to_owned() + &"World!".to_owned();
|
LL | let x = "Hello ".to_owned() + &"World!".to_owned();
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
|
error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
|
||||||
--> $DIR/str-concat-on-double-ref.rs:4:13
|
--> $DIR/str-concat-on-double-ref.rs:4:15
|
||||||
|
|
|
|
||||||
LL | let c = a + b;
|
LL | let c = a + b;
|
||||||
| ^^^^^
|
| - ^ - &str
|
||||||
|
| |
|
||||||
|
| &std::string::String
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `&std::string::String`
|
= note: an implementation of `std::ops::Add` might be missing for `&std::string::String`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `*` cannot be applied to type `&T`
|
error[E0369]: binary operation `*` cannot be applied to type `&T`
|
||||||
--> $DIR/trait-resolution-in-overloaded-op.rs:8:5
|
--> $DIR/trait-resolution-in-overloaded-op.rs:8:7
|
||||||
|
|
|
|
||||||
LL | a * b
|
LL | a * b
|
||||||
| ^^^^^
|
| - ^ - f64
|
||||||
|
| |
|
||||||
|
| &T
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Mul` might be missing for `&T`
|
= note: an implementation of `std::ops::Mul` might be missing for `&T`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `T`
|
error[E0369]: binary operation `+` cannot be applied to type `T`
|
||||||
--> $DIR/missing_trait_impl.rs:5:13
|
--> $DIR/missing_trait_impl.rs:5:15
|
||||||
|
|
|
|
||||||
LL | let z = x + y;
|
LL | let z = x + y;
|
||||||
| ^^^^^
|
| - ^ - T
|
||||||
|
| |
|
||||||
|
| T
|
||||||
|
|
|
|
||||||
= note: `T` might need a bound for `std::ops::Add`
|
= note: `T` might need a bound for `std::ops::Add`
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
error[E0369]: binary operation `+` cannot be applied to type `std::vec::Vec<R>`
|
error[E0369]: binary operation `+` cannot be applied to type `std::vec::Vec<R>`
|
||||||
--> $DIR/vec-res-add.rs:16:13
|
--> $DIR/vec-res-add.rs:16:15
|
||||||
|
|
|
|
||||||
LL | let k = i + j;
|
LL | let k = i + j;
|
||||||
| ^^^^^
|
| - ^ - std::vec::Vec<R>
|
||||||
|
| |
|
||||||
|
| std::vec::Vec<R>
|
||||||
|
|
|
|
||||||
= note: an implementation of `std::ops::Add` might be missing for `std::vec::Vec<R>`
|
= note: an implementation of `std::ops::Add` might be missing for `std::vec::Vec<R>`
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user