Make Diag::multipart_suggestions always verbose
This commit is contained in:
@@ -1165,7 +1165,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
|
|||||||
self.push_suggestion(CodeSuggestion {
|
self.push_suggestion(CodeSuggestion {
|
||||||
substitutions,
|
substitutions,
|
||||||
msg: self.subdiagnostic_message_to_diagnostic_message(msg),
|
msg: self.subdiagnostic_message_to_diagnostic_message(msg),
|
||||||
style: SuggestionStyle::ShowCode,
|
style: SuggestionStyle::ShowAlways,
|
||||||
applicability,
|
applicability,
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ error[E0277]: the trait bound `B<C>: Copy` is not satisfied
|
|||||||
--> $DIR/deriving-copyclone.rs:31:26
|
--> $DIR/deriving-copyclone.rs:31:26
|
||||||
|
|
|
|
||||||
LL | is_copy(B { a: 1, b: C });
|
LL | is_copy(B { a: 1, b: C });
|
||||||
| ------- ^
|
| ------- ^ the trait `Copy` is not implemented for `B<C>`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Copy` is not implemented for `B<C>`
|
|
||||||
| | help: consider borrowing here: `&`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required for `B<C>` to implement `Copy`
|
note: required for `B<C>` to implement `Copy`
|
||||||
@@ -18,15 +16,17 @@ note: required by a bound in `is_copy`
|
|||||||
|
|
|
|
||||||
LL | fn is_copy<T: Copy>(_: T) {}
|
LL | fn is_copy<T: Copy>(_: T) {}
|
||||||
| ^^^^ required by this bound in `is_copy`
|
| ^^^^ required by this bound in `is_copy`
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | is_copy(B { a: 1, b: &C });
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: the trait bound `B<C>: Clone` is not satisfied
|
error[E0277]: the trait bound `B<C>: Clone` is not satisfied
|
||||||
--> $DIR/deriving-copyclone.rs:32:27
|
--> $DIR/deriving-copyclone.rs:32:27
|
||||||
|
|
|
|
||||||
LL | is_clone(B { a: 1, b: C });
|
LL | is_clone(B { a: 1, b: C });
|
||||||
| -------- ^
|
| -------- ^ the trait `Clone` is not implemented for `B<C>`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Clone` is not implemented for `B<C>`
|
|
||||||
| | help: consider borrowing here: `&`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required for `B<C>` to implement `Clone`
|
note: required for `B<C>` to implement `Clone`
|
||||||
@@ -39,15 +39,17 @@ note: required by a bound in `is_clone`
|
|||||||
|
|
|
|
||||||
LL | fn is_clone<T: Clone>(_: T) {}
|
LL | fn is_clone<T: Clone>(_: T) {}
|
||||||
| ^^^^^ required by this bound in `is_clone`
|
| ^^^^^ required by this bound in `is_clone`
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | is_clone(B { a: 1, b: &C });
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: the trait bound `B<D>: Copy` is not satisfied
|
error[E0277]: the trait bound `B<D>: Copy` is not satisfied
|
||||||
--> $DIR/deriving-copyclone.rs:35:26
|
--> $DIR/deriving-copyclone.rs:35:26
|
||||||
|
|
|
|
||||||
LL | is_copy(B { a: 1, b: D });
|
LL | is_copy(B { a: 1, b: D });
|
||||||
| ------- ^
|
| ------- ^ the trait `Copy` is not implemented for `B<D>`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Copy` is not implemented for `B<D>`
|
|
||||||
| | help: consider borrowing here: `&`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required for `B<D>` to implement `Copy`
|
note: required for `B<D>` to implement `Copy`
|
||||||
@@ -60,6 +62,10 @@ note: required by a bound in `is_copy`
|
|||||||
|
|
|
|
||||||
LL | fn is_copy<T: Copy>(_: T) {}
|
LL | fn is_copy<T: Copy>(_: T) {}
|
||||||
| ^^^^ required by this bound in `is_copy`
|
| ^^^^ required by this bound in `is_copy`
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | is_copy(B { a: 1, b: &D });
|
||||||
|
| +
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ error[E0277]: `dyn Iterator<Item = &'a mut u8>` is not an iterator
|
|||||||
--> $DIR/issue-20605.rs:6:17
|
--> $DIR/issue-20605.rs:6:17
|
||||||
|
|
|
|
||||||
LL | for item in *things { *item = 0 }
|
LL | for item in *things { *item = 0 }
|
||||||
| -^^^^^^
|
| ^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>`
|
||||||
| |
|
|
||||||
| the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>`
|
|
||||||
| help: consider mutably borrowing here: `&mut`
|
|
||||||
|
|
|
|
||||||
= note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
|
= note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
|
||||||
= note: required for `dyn Iterator<Item = &'a mut u8>` to implement `IntoIterator`
|
= note: required for `dyn Iterator<Item = &'a mut u8>` to implement `IntoIterator`
|
||||||
|
help: consider mutably borrowing here
|
||||||
|
|
|
||||||
|
LL | for item in &mut *things { *item = 0 }
|
||||||
|
| ++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ error[E0277]: `dyn Iterator<Item = &'a mut u8>` is not an iterator
|
|||||||
--> $DIR/issue-20605.rs:6:17
|
--> $DIR/issue-20605.rs:6:17
|
||||||
|
|
|
|
||||||
LL | for item in *things { *item = 0 }
|
LL | for item in *things { *item = 0 }
|
||||||
| -^^^^^^
|
| ^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>`
|
||||||
| |
|
|
||||||
| the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>`
|
|
||||||
| help: consider mutably borrowing here: `&mut`
|
|
||||||
|
|
|
|
||||||
= note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
|
= note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
|
||||||
= note: required for `dyn Iterator<Item = &'a mut u8>` to implement `IntoIterator`
|
= note: required for `dyn Iterator<Item = &'a mut u8>` to implement `IntoIterator`
|
||||||
|
help: consider mutably borrowing here
|
||||||
|
|
|
||||||
|
LL | for item in &mut *things { *item = 0 }
|
||||||
|
| ++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ error[E0308]: mismatched types
|
|||||||
LL | async fn woopsie_async(&self) -> String {
|
LL | async fn woopsie_async(&self) -> String {
|
||||||
| ------ expected `String` because of return type
|
| ------ expected `String` because of return type
|
||||||
LL | 42
|
LL | 42
|
||||||
| ^^- help: try using a conversion method: `.to_string()`
|
| ^^ expected `String`, found integer
|
||||||
| |
|
|
|
||||||
| expected `String`, found integer
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | 42.to_string()
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ error[E0308]: mismatched types
|
|||||||
--> $DIR/deref-suggestion.rs:8:9
|
--> $DIR/deref-suggestion.rs:8:9
|
||||||
|
|
|
|
||||||
LL | foo(s);
|
LL | foo(s);
|
||||||
| --- ^- help: try using a conversion method: `.to_string()`
|
| --- ^ expected `String`, found `&String`
|
||||||
| | |
|
| |
|
||||||
| | expected `String`, found `&String`
|
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
note: function defined here
|
note: function defined here
|
||||||
@@ -12,6 +11,10 @@ note: function defined here
|
|||||||
|
|
|
|
||||||
LL | fn foo(_: String) {}
|
LL | fn foo(_: String) {}
|
||||||
| ^^^ ---------
|
| ^^^ ---------
|
||||||
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | foo(s.to_string());
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/deref-suggestion.rs:14:10
|
--> $DIR/deref-suggestion.rs:14:10
|
||||||
|
|||||||
@@ -38,9 +38,12 @@ error[E0308]: mismatched types
|
|||||||
--> $DIR/typo-in-repeat-expr-issue-80173.rs:32:29
|
--> $DIR/typo-in-repeat-expr-issue-80173.rs:32:29
|
||||||
|
|
|
|
||||||
LL | let e = [String::new(), 10];
|
LL | let e = [String::new(), 10];
|
||||||
| ^^- help: try using a conversion method: `.to_string()`
|
| ^^ expected `String`, found integer
|
||||||
| |
|
|
|
||||||
| expected `String`, found integer
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | let e = [String::new(), 10.to_string()];
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/typo-in-repeat-expr-issue-80173.rs:36:19
|
--> $DIR/typo-in-repeat-expr-issue-80173.rs:36:19
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ error[E0308]: mismatched types
|
|||||||
--> $DIR/bad-const-type.rs:1:20
|
--> $DIR/bad-const-type.rs:1:20
|
||||||
|
|
|
|
||||||
LL | static i: String = 10;
|
LL | static i: String = 10;
|
||||||
| ^^- help: try using a conversion method: `.to_string()`
|
| ^^ expected `String`, found integer
|
||||||
| |
|
|
|
||||||
| expected `String`, found integer
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | static i: String = 10.to_string();
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,8 @@ error[E0277]: the trait bound `S: Trait` is not satisfied
|
|||||||
--> $DIR/imm-ref-trait-object-literal.rs:13:7
|
--> $DIR/imm-ref-trait-object-literal.rs:13:7
|
||||||
|
|
|
|
||||||
LL | foo(s);
|
LL | foo(s);
|
||||||
| --- ^
|
| --- ^ the trait `Trait` is not implemented for `S`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Trait` is not implemented for `S`
|
|
||||||
| | help: consider mutably borrowing here: `&mut`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `foo`
|
note: required by a bound in `foo`
|
||||||
@@ -32,6 +30,10 @@ note: required by a bound in `foo`
|
|||||||
|
|
|
|
||||||
LL | fn foo<X: Trait>(_: X) {}
|
LL | fn foo<X: Trait>(_: X) {}
|
||||||
| ^^^^^ required by this bound in `foo`
|
| ^^^^^ required by this bound in `foo`
|
||||||
|
help: consider mutably borrowing here
|
||||||
|
|
|
||||||
|
LL | foo(&mut s);
|
||||||
|
| ++++
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|||||||
@@ -18,15 +18,17 @@ error[E0277]: the trait bound `String: Pattern` is not satisfied
|
|||||||
--> $DIR/issue-104961.rs:9:19
|
--> $DIR/issue-104961.rs:9:19
|
||||||
|
|
|
|
||||||
LL | x.starts_with("hi".to_string())
|
LL | x.starts_with("hi".to_string())
|
||||||
| ----------- -^^^^^^^^^^^^^^^
|
| ----------- ^^^^^^^^^^^^^^^^ the trait `Pattern` is not implemented for `String`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Pattern` is not implemented for `String`
|
|
||||||
| | help: consider borrowing here: `&`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: required for `String` to implement `Pattern`
|
= note: required for `String` to implement `Pattern`
|
||||||
note: required by a bound in `core::str::<impl str>::starts_with`
|
note: required by a bound in `core::str::<impl str>::starts_with`
|
||||||
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | x.starts_with(&"hi".to_string())
|
||||||
|
| +
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,13 @@ error[E0308]: mismatched types
|
|||||||
--> $DIR/issue-52820.rs:13:17
|
--> $DIR/issue-52820.rs:13:17
|
||||||
|
|
|
|
||||||
LL | brains: guts.clone(),
|
LL | brains: guts.clone(),
|
||||||
| ^^^^^-----^^
|
| ^^^^^^^^^^^^ expected `String`, found `&str`
|
||||||
| | |
|
|
|
||||||
| | help: try using a conversion method: `to_string`
|
help: try using a conversion method
|
||||||
| expected `String`, found `&str`
|
|
|
||||||
|
LL - brains: guts.clone(),
|
||||||
|
LL + brains: guts.to_string(),
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|||||||
@@ -2,24 +2,31 @@ error[E0308]: mismatched types
|
|||||||
--> $DIR/issue-53692.rs:7:33
|
--> $DIR/issue-53692.rs:7:33
|
||||||
|
|
|
|
||||||
LL | let items_clone: Vec<i32> = ref_items.clone();
|
LL | let items_clone: Vec<i32> = ref_items.clone();
|
||||||
| -------- ^^^^^^^^^^-----^^
|
| -------- ^^^^^^^^^^^^^^^^^ expected `Vec<i32>`, found `&[i32]`
|
||||||
| | | |
|
| |
|
||||||
| | | help: try using a conversion method: `to_vec`
|
|
||||||
| | expected `Vec<i32>`, found `&[i32]`
|
|
||||||
| expected due to this
|
| expected due to this
|
||||||
|
|
|
|
||||||
= note: expected struct `Vec<i32>`
|
= note: expected struct `Vec<i32>`
|
||||||
found reference `&[i32]`
|
found reference `&[i32]`
|
||||||
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL - let items_clone: Vec<i32> = ref_items.clone();
|
||||||
|
LL + let items_clone: Vec<i32> = ref_items.to_vec();
|
||||||
|
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/issue-53692.rs:14:26
|
--> $DIR/issue-53692.rs:14:26
|
||||||
|
|
|
|
||||||
LL | let string: String = s.clone();
|
LL | let string: String = s.clone();
|
||||||
| ------ ^^-----^^
|
| ------ ^^^^^^^^^ expected `String`, found `&str`
|
||||||
| | | |
|
| |
|
||||||
| | | help: try using a conversion method: `to_string`
|
|
||||||
| | expected `String`, found `&str`
|
|
||||||
| expected due to this
|
| expected due to this
|
||||||
|
|
|
||||||
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL - let string: String = s.clone();
|
||||||
|
LL + let string: String = s.to_string();
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,14 @@ error[E0308]: mismatched types
|
|||||||
--> $DIR/issue-59819.rs:34:21
|
--> $DIR/issue-59819.rs:34:21
|
||||||
|
|
|
|
||||||
LL | let g: String = f;
|
LL | let g: String = f;
|
||||||
| ------ ^- help: try using a conversion method: `.to_string()`
|
| ------ ^ expected `String`, found `Bar`
|
||||||
| | |
|
| |
|
||||||
| | expected `String`, found `Bar`
|
|
||||||
| expected due to this
|
| expected due to this
|
||||||
|
|
|
||||||
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | let g: String = f.to_string();
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,17 @@ error[E0277]: the trait bound `String: Pattern` is not satisfied
|
|||||||
--> $DIR/issue-62843.rs:4:32
|
--> $DIR/issue-62843.rs:4:32
|
||||||
|
|
|
|
||||||
LL | println!("{:?}", line.find(pattern));
|
LL | println!("{:?}", line.find(pattern));
|
||||||
| ---- -^^^^^^
|
| ---- ^^^^^^^ the trait `Pattern` is not implemented for `String`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Pattern` is not implemented for `String`
|
|
||||||
| | help: consider borrowing here: `&`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: required for `String` to implement `Pattern`
|
= note: required for `String` to implement `Pattern`
|
||||||
note: required by a bound in `core::str::<impl str>::find`
|
note: required by a bound in `core::str::<impl str>::find`
|
||||||
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | println!("{:?}", line.find(&pattern));
|
||||||
|
| +
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,14 @@ LL | | "A".to_string()
|
|||||||
| | --------------- expected because of this
|
| | --------------- expected because of this
|
||||||
LL | | } else {
|
LL | | } else {
|
||||||
LL | | "B"
|
LL | | "B"
|
||||||
| | ^^^- help: try using a conversion method: `.to_string()`
|
| | ^^^ expected `String`, found `&str`
|
||||||
| | |
|
|
||||||
| | expected `String`, found `&str`
|
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____- `if` and `else` have incompatible types
|
| |_____- `if` and `else` have incompatible types
|
||||||
|
|
|
||||||
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | "B".to_string()
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ error[E0277]: the trait bound `i32: Tr` is not satisfied
|
|||||||
--> $DIR/issue-84973-2.rs:11:9
|
--> $DIR/issue-84973-2.rs:11:9
|
||||||
|
|
|
|
||||||
LL | foo(a);
|
LL | foo(a);
|
||||||
| --- ^
|
| --- ^ the trait `Tr` is not implemented for `i32`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Tr` is not implemented for `i32`
|
|
||||||
| | help: consider mutably borrowing here: `&mut`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `foo`
|
note: required by a bound in `foo`
|
||||||
@@ -13,6 +11,10 @@ note: required by a bound in `foo`
|
|||||||
|
|
|
|
||||||
LL | fn foo<T: Tr>(i: T) {}
|
LL | fn foo<T: Tr>(i: T) {}
|
||||||
| ^^ required by this bound in `foo`
|
| ^^ required by this bound in `foo`
|
||||||
|
help: consider mutably borrowing here
|
||||||
|
|
|
||||||
|
LL | foo(&mut a);
|
||||||
|
| ++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,8 @@ error[E0277]: the trait bound `f32: Tr` is not satisfied
|
|||||||
--> $DIR/issue-84973-negative.rs:11:9
|
--> $DIR/issue-84973-negative.rs:11:9
|
||||||
|
|
|
|
||||||
LL | bar(b);
|
LL | bar(b);
|
||||||
| --- ^
|
| --- ^ the trait `Tr` is not implemented for `f32`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Tr` is not implemented for `f32`
|
|
||||||
| | help: consider borrowing here: `&`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `bar`
|
note: required by a bound in `bar`
|
||||||
@@ -28,6 +26,10 @@ note: required by a bound in `bar`
|
|||||||
|
|
|
|
||||||
LL | fn bar<T: Tr>(t: T) {}
|
LL | fn bar<T: Tr>(t: T) {}
|
||||||
| ^^ required by this bound in `bar`
|
| ^^ required by this bound in `bar`
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | bar(&b);
|
||||||
|
| +
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ error[E0277]: the trait bound `Fancy: SomeTrait` is not satisfied
|
|||||||
--> $DIR/issue-84973.rs:6:24
|
--> $DIR/issue-84973.rs:6:24
|
||||||
|
|
|
|
||||||
LL | let o = Other::new(f);
|
LL | let o = Other::new(f);
|
||||||
| ---------- ^
|
| ---------- ^ the trait `SomeTrait` is not implemented for `Fancy`
|
||||||
| | |
|
| |
|
||||||
| | the trait `SomeTrait` is not implemented for `Fancy`
|
|
||||||
| | help: consider borrowing here: `&`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `Other::<'a, G>::new`
|
note: required by a bound in `Other::<'a, G>::new`
|
||||||
@@ -16,6 +14,10 @@ LL | G: SomeTrait,
|
|||||||
LL | {
|
LL | {
|
||||||
LL | pub fn new(g: G) -> Self {
|
LL | pub fn new(g: G) -> Self {
|
||||||
| --- required by a bound in this associated function
|
| --- required by a bound in this associated function
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | let o = Other::new(&f);
|
||||||
|
| +
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ LL | fn get_name() -> String {
|
|||||||
| ------ expected `String` because of return type
|
| ------ expected `String` because of return type
|
||||||
...
|
...
|
||||||
LL | your_name.trim()
|
LL | your_name.trim()
|
||||||
| ^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
|
| ^^^^^^^^^^^^^^^^ expected `String`, found `&str`
|
||||||
| |
|
|
|
||||||
| expected `String`, found `&str`
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | your_name.trim().to_string()
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -2,19 +2,23 @@ error[E0277]: the trait bound `&mut usize: Default` is not satisfied
|
|||||||
--> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:13:9
|
--> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:13:9
|
||||||
|
|
|
|
||||||
LL | foo(Default::default());
|
LL | foo(Default::default());
|
||||||
| -^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `&mut usize`
|
||||||
| |
|
|
|
||||||
| the trait `Default` is not implemented for `&mut usize`
|
help: consider mutably borrowing here
|
||||||
| help: consider mutably borrowing here: `&mut`
|
|
|
||||||
|
LL | foo(&mut Default::default());
|
||||||
|
| ++++
|
||||||
|
|
||||||
error[E0277]: the trait bound `&usize: Default` is not satisfied
|
error[E0277]: the trait bound `&usize: Default` is not satisfied
|
||||||
--> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:14:9
|
--> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:14:9
|
||||||
|
|
|
|
||||||
LL | bar(Default::default());
|
LL | bar(Default::default());
|
||||||
| -^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `&usize`
|
||||||
| |
|
|
|
||||||
| the trait `Default` is not implemented for `&usize`
|
help: consider borrowing here
|
||||||
| help: consider borrowing here: `&`
|
|
|
||||||
|
LL | bar(&Default::default());
|
||||||
|
| +
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,8 @@ error[E0277]: the trait bound `B: Trait` is not satisfied
|
|||||||
--> $DIR/suggest-imm-mut-trait-implementations.rs:21:9
|
--> $DIR/suggest-imm-mut-trait-implementations.rs:21:9
|
||||||
|
|
|
|
||||||
LL | foo(b);
|
LL | foo(b);
|
||||||
| --- ^
|
| --- ^ the trait `Trait` is not implemented for `B`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Trait` is not implemented for `B`
|
|
||||||
| | help: consider borrowing here: `&`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `foo`
|
note: required by a bound in `foo`
|
||||||
@@ -33,15 +31,17 @@ note: required by a bound in `foo`
|
|||||||
|
|
|
|
||||||
LL | fn foo<X: Trait>(_: X) {}
|
LL | fn foo<X: Trait>(_: X) {}
|
||||||
| ^^^^^ required by this bound in `foo`
|
| ^^^^^ required by this bound in `foo`
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | foo(&b);
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: the trait bound `C: Trait` is not satisfied
|
error[E0277]: the trait bound `C: Trait` is not satisfied
|
||||||
--> $DIR/suggest-imm-mut-trait-implementations.rs:22:9
|
--> $DIR/suggest-imm-mut-trait-implementations.rs:22:9
|
||||||
|
|
|
|
||||||
LL | foo(c);
|
LL | foo(c);
|
||||||
| --- ^
|
| --- ^ the trait `Trait` is not implemented for `C`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Trait` is not implemented for `C`
|
|
||||||
| | help: consider mutably borrowing here: `&mut`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
note: required by a bound in `foo`
|
note: required by a bound in `foo`
|
||||||
@@ -49,6 +49,10 @@ note: required by a bound in `foo`
|
|||||||
|
|
|
|
||||||
LL | fn foo<X: Trait>(_: X) {}
|
LL | fn foo<X: Trait>(_: X) {}
|
||||||
| ^^^^^ required by this bound in `foo`
|
| ^^^^^ required by this bound in `foo`
|
||||||
|
help: consider mutably borrowing here
|
||||||
|
|
|
||||||
|
LL | foo(&mut c);
|
||||||
|
| ++++
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ error[E0308]: mismatched types
|
|||||||
--> $DIR/switched-expectations.rs:3:30
|
--> $DIR/switched-expectations.rs:3:30
|
||||||
|
|
|
|
||||||
LL | let ref string: String = var;
|
LL | let ref string: String = var;
|
||||||
| ^^^- help: try using a conversion method: `.to_string()`
|
| ^^^ expected `String`, found `i32`
|
||||||
| |
|
|
|
||||||
| expected `String`, found `i32`
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | let ref string: String = var.to_string();
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|||||||
@@ -61,10 +61,8 @@ error[E0277]: `dummy2::TestType` cannot be sent between threads safely
|
|||||||
--> $DIR/negated-auto-traits-error.rs:48:13
|
--> $DIR/negated-auto-traits-error.rs:48:13
|
||||||
|
|
|
|
||||||
LL | is_send(Box::new(TestType));
|
LL | is_send(Box::new(TestType));
|
||||||
| ------- -^^^^^^^^^^^^^^^^^
|
| ------- ^^^^^^^^^^^^^^^^^^ the trait `Send` is not implemented for `Unique<dummy2::TestType>`
|
||||||
| | |
|
| |
|
||||||
| | the trait `Send` is not implemented for `Unique<dummy2::TestType>`
|
|
||||||
| | help: consider borrowing here: `&`
|
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: the trait bound `Unique<dummy2::TestType>: Send` is not satisfied
|
= note: the trait bound `Unique<dummy2::TestType>: Send` is not satisfied
|
||||||
@@ -76,6 +74,10 @@ note: required by a bound in `is_send`
|
|||||||
|
|
|
|
||||||
LL | fn is_send<T: Send>(_: T) {}
|
LL | fn is_send<T: Send>(_: T) {}
|
||||||
| ^^^^ required by this bound in `is_send`
|
| ^^^^ required by this bound in `is_send`
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | is_send(&Box::new(TestType));
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: `dummy3::TestType` cannot be sent between threads safely
|
error[E0277]: `dummy3::TestType` cannot be sent between threads safely
|
||||||
--> $DIR/negated-auto-traits-error.rs:56:13
|
--> $DIR/negated-auto-traits-error.rs:56:13
|
||||||
|
|||||||
@@ -2,28 +2,40 @@ error[E0308]: mismatched types
|
|||||||
--> $DIR/conversion-methods.rs:5:41
|
--> $DIR/conversion-methods.rs:5:41
|
||||||
|
|
|
|
||||||
LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—";
|
LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—";
|
||||||
| ------ ^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
|
| ------ ^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `&str`
|
||||||
| | |
|
| |
|
||||||
| | expected `String`, found `&str`
|
|
||||||
| expected due to this
|
| expected due to this
|
||||||
|
|
|
||||||
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—".to_string();
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/conversion-methods.rs:6:40
|
--> $DIR/conversion-methods.rs:6:40
|
||||||
|
|
|
|
||||||
LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise");
|
LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise");
|
||||||
| ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_path_buf()`
|
| ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `PathBuf`, found `&Path`
|
||||||
| | |
|
| |
|
||||||
| | expected `PathBuf`, found `&Path`
|
|
||||||
| expected due to this
|
| expected due to this
|
||||||
|
|
|
||||||
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise").to_path_buf();
|
||||||
|
| ++++++++++++++
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/conversion-methods.rs:9:40
|
--> $DIR/conversion-methods.rs:9:40
|
||||||
|
|
|
|
||||||
LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here
|
LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here
|
||||||
| ------ ^- help: try using a conversion method: `.to_string()`
|
| ------ ^ expected `String`, found integer
|
||||||
| | |
|
| |
|
||||||
| | expected `String`, found integer
|
|
||||||
| expected due to this
|
| expected due to this
|
||||||
|
|
|
||||||
|
help: try using a conversion method
|
||||||
|
|
|
||||||
|
LL | let _but_should_the_play: String = 2.to_string(); // Perhaps surprisingly, we suggest .to_string() here
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/conversion-methods.rs:12:47
|
--> $DIR/conversion-methods.rs:12:47
|
||||||
|
|||||||
Reference in New Issue
Block a user