When a trait isn't implemented, but another similar impl is found, point at it:
```
error[E0277]: the trait bound `u32: Trait` is not satisfied
--> $DIR/trait_objects_fail.rs:26:9
|
LL | foo(&10_u32);
| ^^^^^^^ the trait `Trait` is not implemented for `u32`
|
help: the trait `Trait<12>` is not implemented for `u32`
but trait `Trait<2>` is implemented for it
--> $DIR/trait_objects_fail.rs:7:1
|
LL | impl Trait<2> for u32 {}
| ^^^^^^^^^^^^^^^^^^^^^
= note: required for the cast from `&u32` to `&dyn Trait`
```
Pointing at the `impl` definition that *could* apply given a different self type is particularly useful when it has a blanket self type, as it might not be obvious and is not trivially greppable:
```
error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
--> $DIR/issue-62742.rs:4:5
|
LL | WrongImpl::foo(0i32);
| ^^^^^^^^^ unsatisfied trait bound
|
help: the trait `Raw<_>` is not implemented for `RawImpl<_>`
but trait `Raw<[_]>` is implemented for it
--> $DIR/issue-62742.rs:29:1
|
LL | impl<T> Raw<[T]> for RawImpl<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `SafeImpl`
--> $DIR/issue-62742.rs:33:35
|
LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
| ^^^^^^ required by this bound in `SafeImpl`
```
This commit is contained in:
parent
51f5892019
commit
1d860902f6
32 changed files with 236 additions and 102 deletions
|
|
@ -1523,16 +1523,17 @@ impl HumanEmitter {
|
|||
label_width += 2;
|
||||
}
|
||||
let mut line = 0;
|
||||
let mut pad = false;
|
||||
for (text, style) in msgs.iter() {
|
||||
let text =
|
||||
self.translator.translate_message(text, args).map_err(Report::new).unwrap();
|
||||
// Account for newlines to align output to its label.
|
||||
for text in normalize_whitespace(&text).lines() {
|
||||
for text in normalize_whitespace(&text).split('\n') {
|
||||
buffer.append(
|
||||
line,
|
||||
&format!(
|
||||
"{}{}",
|
||||
if line == 0 { String::new() } else { " ".repeat(label_width) },
|
||||
if pad { " ".repeat(label_width) } else { String::new() },
|
||||
text
|
||||
),
|
||||
match style {
|
||||
|
|
@ -1541,7 +1542,9 @@ impl HumanEmitter {
|
|||
},
|
||||
);
|
||||
line += 1;
|
||||
pad = true;
|
||||
}
|
||||
pad = false;
|
||||
// We add lines above, but if the last line has no explicit newline (which would
|
||||
// yield an empty line), then we revert one line up to continue with the next
|
||||
// styled text chunk on the same line as the last one from the prior one. Otherwise
|
||||
|
|
|
|||
|
|
@ -2191,7 +2191,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
msg.extend(types.1.0);
|
||||
msg.push(StringPart::normal("`"));
|
||||
}
|
||||
err.highlighted_help(msg);
|
||||
err.highlighted_span_help(self.tcx.def_span(single.impl_def_id), msg);
|
||||
|
||||
if let [TypeError::Sorts(exp_found)] = &terrs[..] {
|
||||
let exp_found = self.resolve_vars_if_possible(*exp_found);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `u16: Bar<N>` is not satisfied
|
|||
LL | type Assoc = u16;
|
||||
| ^^^ the trait `Bar<N>` is not implemented for `u16`
|
||||
|
|
||||
= help: the trait `Bar<N>` is not implemented for `u16`
|
||||
but trait `Bar<3>` is implemented for it
|
||||
help: the trait `Bar<N>` is not implemented for `u16`
|
||||
but trait `Bar<3>` is implemented for it
|
||||
--> $DIR/associated-type-bound-fail.rs:7:1
|
||||
|
|
||||
LL | impl Bar<3> for u16 {}
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `Foo::Assoc`
|
||||
--> $DIR/associated-type-bound-fail.rs:4:17
|
||||
|
|
||||
|
|
|
|||
|
|
@ -23,8 +23,12 @@ LL |
|
|||
LL | 1_u32
|
||||
| ----- return type was inferred to be `u32` here
|
||||
|
|
||||
= help: the trait `Traitor<N, N>` is not implemented for `u32`
|
||||
but trait `Traitor<N, 2>` is implemented for it
|
||||
help: the trait `Traitor<N, N>` is not implemented for `u32`
|
||||
but trait `Traitor<N, 2>` is implemented for it
|
||||
--> $DIR/rp_impl_trait_fail.rs:13:1
|
||||
|
|
||||
LL | impl<const N: u8> Traitor<N, 2> for u32 {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `u64: Traitor` is not satisfied
|
||||
--> $DIR/rp_impl_trait_fail.rs:21:13
|
||||
|
|
@ -35,8 +39,12 @@ LL |
|
|||
LL | 1_u64
|
||||
| ----- return type was inferred to be `u64` here
|
||||
|
|
||||
= help: the trait `Traitor<1, 1>` is not implemented for `u64`
|
||||
but trait `Traitor<1, 2>` is implemented for it
|
||||
help: the trait `Traitor<1, 1>` is not implemented for `u64`
|
||||
but trait `Traitor<1, 2>` is implemented for it
|
||||
--> $DIR/rp_impl_trait_fail.rs:14:1
|
||||
|
|
||||
LL | impl Traitor<1, 2> for u64 {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/rp_impl_trait_fail.rs:28:5
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied
|
|||
LL | foo(&10_u32);
|
||||
| ^^^^^^^ the trait `Trait` is not implemented for `u32`
|
||||
|
|
||||
= help: the trait `Trait<12>` is not implemented for `u32`
|
||||
but trait `Trait<2>` is implemented for it
|
||||
help: the trait `Trait<12>` is not implemented for `u32`
|
||||
but trait `Trait<2>` is implemented for it
|
||||
--> $DIR/trait_objects_fail.rs:7:1
|
||||
|
|
||||
LL | impl Trait<2> for u32 {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: required for the cast from `&u32` to `&dyn Trait`
|
||||
|
||||
error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied
|
||||
|
|
@ -14,8 +18,12 @@ error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied
|
|||
LL | bar(&true);
|
||||
| ^^^^^ the trait `Traitor<_>` is not implemented for `bool`
|
||||
|
|
||||
= help: the trait `Traitor<_, _>` is not implemented for `bool`
|
||||
but trait `Traitor<2, 3>` is implemented for it
|
||||
help: the trait `Traitor<_, _>` is not implemented for `bool`
|
||||
but trait `Traitor<2, 3>` is implemented for it
|
||||
--> $DIR/trait_objects_fail.rs:19:1
|
||||
|
|
||||
LL | impl Traitor<2, 3> for bool {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: required for the cast from `&bool` to `&dyn Traitor<_>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
|||
|
|
@ -10,8 +10,12 @@ error[E0277]: the trait bound `(): Trait<2>` is not satisfied
|
|||
LL | (): Trait<N>;
|
||||
| ^^^^^^^^ the trait `Trait<2>` is not implemented for `()`
|
||||
|
|
||||
= help: the trait `Trait<2>` is not implemented for `()`
|
||||
but trait `Trait<3>` is implemented for it
|
||||
help: the trait `Trait<2>` is not implemented for `()`
|
||||
but trait `Trait<3>` is implemented for it
|
||||
--> $DIR/wfness.rs:5:1
|
||||
|
|
||||
LL | impl Trait<3> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `WhereClause`
|
||||
--> $DIR/wfness.rs:8:9
|
||||
|
|
||||
|
|
@ -27,8 +31,12 @@ error[E0277]: the trait bound `(): Trait<1>` is not satisfied
|
|||
LL | fn foo() -> DependentDefaultWfness {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<1>` is not implemented for `()`
|
||||
|
|
||||
= help: the trait `Trait<1>` is not implemented for `()`
|
||||
but trait `Trait<3>` is implemented for it
|
||||
help: the trait `Trait<1>` is not implemented for `()`
|
||||
but trait `Trait<3>` is implemented for it
|
||||
--> $DIR/wfness.rs:5:1
|
||||
|
|
||||
LL | impl Trait<3> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `WhereClause`
|
||||
--> $DIR/wfness.rs:8:9
|
||||
|
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied
|
|||
LL | let _ = A;
|
||||
| ^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `Bar<_>` is not implemented for `A<_>`
|
||||
but it is implemented for `A<{ 6 + 1 }>`
|
||||
help: the trait `Bar<_>` is not implemented for `A<_>`
|
||||
but it is implemented for `A<{ 6 + 1 }>`
|
||||
--> $DIR/unused-substs-1.rs:5:1
|
||||
|
|
||||
LL | impl<const N: usize> Bar<N> for A<{ 6 + 1 }> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `A`
|
||||
--> $DIR/unused-substs-1.rs:9:11
|
||||
|
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied
|
|||
LL | SelectInt.check("bar");
|
||||
| ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
|
|
||||
= help: the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
but trait `AsExpression<Text>` is implemented for it
|
||||
help: the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
but trait `AsExpression<Text>` is implemented for it
|
||||
--> $DIR/as_expression.rs:40:1
|
||||
|
|
||||
LL | impl AsExpression<Text> for &'_ str {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `Text`, found `Integer`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
|
|||
|
|
@ -6,8 +6,12 @@ LL | SelectInt.check("bar");
|
|||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
but trait `AsExpression<Text>` is implemented for it
|
||||
help: the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
but trait `AsExpression<Text>` is implemented for it
|
||||
--> $DIR/as_expression.rs:40:1
|
||||
|
|
||||
LL | impl AsExpression<Text> for &'_ str {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `Text`, found `Integer`
|
||||
note: required by a bound in `Foo::check`
|
||||
--> $DIR/as_expression.rs:47:12
|
||||
|
|
@ -24,8 +28,12 @@ error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied
|
|||
LL | SelectInt.check("bar");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
|
|
||||
= help: the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
but trait `AsExpression<Text>` is implemented for it
|
||||
help: the trait `AsExpression<Integer>` is not implemented for `&str`
|
||||
but trait `AsExpression<Text>` is implemented for it
|
||||
--> $DIR/as_expression.rs:40:1
|
||||
|
|
||||
LL | impl AsExpression<Text> for &'_ str {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `Text`, found `Integer`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ error[E0277]: a value of type `Vec<(&str, fn())>` cannot be built from an iterat
|
|||
LL | let _: Vec<(&str, fn())> = [("foo", foo)].into_iter().collect();
|
||||
| ^^^^^^^ value of type `Vec<(&str, fn())>` cannot be built from `std::iter::Iterator<Item=(&str, fn() {foo})>`
|
||||
|
|
||||
= help: the trait `FromIterator<(&_, fn() {foo})>` is not implemented for `Vec<(&str, fn())>`
|
||||
but trait `FromIterator<(&_, fn())>` is implemented for it
|
||||
help: the trait `FromIterator<(&_, fn() {foo})>` is not implemented for `Vec<(&str, fn())>`
|
||||
but trait `FromIterator<(&_, fn())>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `fn()`, found `fn() {foo}`
|
||||
= note: fn items are distinct from fn pointers
|
||||
= help: consider casting the fn item to a fn pointer: `foo as fn()`
|
||||
|
|
@ -25,8 +26,9 @@ error[E0277]: a value of type `Vec<fn()>` cannot be built from an iterator over
|
|||
LL | let _: Vec<fn()> = [foo].into_iter().collect();
|
||||
| ^^^^^^^ value of type `Vec<fn()>` cannot be built from `std::iter::Iterator<Item=fn() {foo}>`
|
||||
|
|
||||
= help: the trait `FromIterator<fn() {foo}>` is not implemented for `Vec<fn()>`
|
||||
but trait `FromIterator<fn()>` is implemented for it
|
||||
help: the trait `FromIterator<fn() {foo}>` is not implemented for `Vec<fn()>`
|
||||
but trait `FromIterator<fn()>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `fn()`, found `fn() {foo}`
|
||||
= note: fn items are distinct from fn pointers
|
||||
= help: consider casting the fn item to a fn pointer: `foo as fn()`
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
|
|||
LL | let () = K::<()>;
|
||||
| ^^ the trait `From<()>` is not implemented for `Infallible`
|
||||
|
|
||||
= help: the trait `From<()>` is not implemented for `Infallible`
|
||||
but trait `From<!>` is implemented for it
|
||||
help: the trait `From<()>` is not implemented for `Infallible`
|
||||
but trait `From<!>` is implemented for it
|
||||
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `!`, found `()`
|
||||
note: required by a bound in `K`
|
||||
--> $DIR/unsatisfied-bounds.rs:12:17
|
||||
|
|
@ -49,8 +50,9 @@ error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
|
|||
LL | let _ = <() as Trait<&'static str>>::B::<()>;
|
||||
| ^^ the trait `From<()>` is not implemented for `Infallible`
|
||||
|
|
||||
= help: the trait `From<()>` is not implemented for `Infallible`
|
||||
but trait `From<!>` is implemented for it
|
||||
help: the trait `From<()>` is not implemented for `Infallible`
|
||||
but trait `From<!>` is implemented for it
|
||||
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `!`, found `()`
|
||||
note: required by a bound in `Trait::B`
|
||||
--> $DIR/unsatisfied-bounds.rs:21:21
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
<svg width="1096px" height="398px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="1188px" height="470px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { fill: #000000 }
|
||||
.fg-bright-blue { fill: #5555FF }
|
||||
.fg-bright-cyan { fill: #55FFFF }
|
||||
.fg-bright-green { fill: #55FF55 }
|
||||
.fg-bright-red { fill: #FF5555 }
|
||||
.fg-magenta { fill: #AA00AA }
|
||||
|
|
@ -37,31 +38,39 @@
|
|||
</tspan>
|
||||
<tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="172px"><tspan> </tspan><tspan class="fg-bright-blue bold">= </tspan><tspan class="bold">help</tspan><tspan>: the trait `Bar<</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>>` </tspan><tspan class="fg-magenta bold">is not</tspan><tspan> implemented for `Struct`</tspan>
|
||||
<tspan x="10px" y="172px"><tspan class="fg-bright-cyan bold">help</tspan><tspan>: the trait `Bar<</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>>` </tspan><tspan class="fg-magenta bold">is not</tspan><tspan> implemented for `Struct`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="190px"><tspan> but trait `Bar<</tspan><tspan class="fg-magenta bold">()</tspan><tspan>>` </tspan><tspan class="fg-magenta bold">is</tspan><tspan> implemented for it</tspan>
|
||||
<tspan x="10px" y="190px"><tspan> but trait `Bar<</tspan><tspan class="fg-magenta bold">()</tspan><tspan>>` </tspan><tspan class="fg-magenta bold">is</tspan><tspan> implemented for it</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="208px"><tspan> </tspan><tspan class="fg-bright-blue bold">= </tspan><tspan class="bold">help</tspan><tspan>: for that trait implementation, expected `</tspan><tspan class="fg-magenta bold">()</tspan><tspan>`, found `</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>`</tspan>
|
||||
<tspan x="10px" y="208px"><tspan> </tspan><tspan class="fg-bright-blue bold">--> </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:13:1</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="226px"><tspan class="fg-bright-green bold">note</tspan><tspan>: required for `Struct` to implement `Foo<i32>`</tspan>
|
||||
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-bright-blue bold">--> </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:10:12</tspan>
|
||||
<tspan x="10px" y="244px"><tspan class="fg-bright-blue bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> impl<'a> Bar<()> for Struct {}</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan>
|
||||
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-cyan bold">^^^^^^^^^^^^^^^^^^^^^^^^^^^</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="280px"><tspan class="fg-bright-blue bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> impl<T, K> Foo<K> for T where T: Bar<K></tspan>
|
||||
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-bright-blue bold">= </tspan><tspan class="bold">help</tspan><tspan>: for that trait implementation, expected `</tspan><tspan class="fg-magenta bold">()</tspan><tspan>`, found `</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="298px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-green bold">^^^^^^</tspan><tspan> </tspan><tspan class="fg-bright-green bold">^</tspan><tspan> </tspan><tspan class="fg-bright-blue bold">------</tspan><tspan> </tspan><tspan class="fg-bright-blue bold">unsatisfied trait bound introduced here</tspan>
|
||||
<tspan x="10px" y="298px"><tspan class="fg-bright-green bold">note</tspan><tspan>: required for `Struct` to implement `Foo<i32>`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="316px">
|
||||
<tspan x="10px" y="316px"><tspan> </tspan><tspan class="fg-bright-blue bold">--> </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:10:12</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="334px"><tspan class="fg-bright-red bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan>
|
||||
<tspan x="10px" y="334px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="352px">
|
||||
<tspan x="10px" y="352px"><tspan class="fg-bright-blue bold">LL</tspan><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> impl<T, K> Foo<K> for T where T: Bar<K></tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="370px"><tspan class="bold">For more information about this error, try `rustc --explain E0277`.</tspan>
|
||||
<tspan x="10px" y="370px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-green bold">^^^^^^</tspan><tspan> </tspan><tspan class="fg-bright-green bold">^</tspan><tspan> </tspan><tspan class="fg-bright-blue bold">------</tspan><tspan> </tspan><tspan class="fg-bright-blue bold">unsatisfied trait bound introduced here</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="388px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="406px"><tspan class="fg-bright-red bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="424px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="442px"><tspan class="bold">For more information about this error, try `rustc --explain E0277`.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="460px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 5.1 KiB |
|
|
@ -29,8 +29,12 @@ LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
|
|||
LL | self
|
||||
| ---- return type was inferred to be `Bar` here
|
||||
|
|
||||
= help: the trait `Foo<u8>` is not implemented for `Bar`
|
||||
but trait `Foo<char>` is implemented for it
|
||||
help: the trait `Foo<u8>` is not implemented for `Bar`
|
||||
but trait `Foo<char>` is implemented for it
|
||||
--> $DIR/return-dont-satisfy-bounds.rs:7:1
|
||||
|
|
||||
LL | impl Foo<char> for Bar {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `char`, found `u8`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
|
|||
LL | WrongImpl::foo(0i32);
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `Raw<_>` is not implemented for `RawImpl<_>`
|
||||
but trait `Raw<[_]>` is implemented for it
|
||||
help: the trait `Raw<_>` is not implemented for `RawImpl<_>`
|
||||
but trait `Raw<[_]>` is implemented for it
|
||||
--> $DIR/issue-62742.rs:29:1
|
||||
|
|
||||
LL | impl<T> Raw<[T]> for RawImpl<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `SafeImpl`
|
||||
--> $DIR/issue-62742.rs:33:35
|
||||
|
|
||||
|
|
@ -43,8 +47,12 @@ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied
|
|||
LL | WrongImpl::<()>::foo(0i32);
|
||||
| ^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `Raw<()>` is not implemented for `RawImpl<()>`
|
||||
but trait `Raw<[()]>` is implemented for it
|
||||
help: the trait `Raw<()>` is not implemented for `RawImpl<()>`
|
||||
but trait `Raw<[()]>` is implemented for it
|
||||
--> $DIR/issue-62742.rs:29:1
|
||||
|
|
||||
LL | impl<T> Raw<[T]> for RawImpl<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `[()]`, found `()`
|
||||
note: required by a bound in `SafeImpl`
|
||||
--> $DIR/issue-62742.rs:33:35
|
||||
|
|
|
|||
|
|
@ -83,8 +83,12 @@ error[E0277]: the trait bound `for<'a> &'a (): Qux<'b>` is not satisfied
|
|||
LL | fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Qux<'b>> {}
|
||||
| ^^^^^^^^^^^^ the trait `for<'a> Qux<'b>` is not implemented for `&'a ()`
|
||||
|
|
||||
= help: the trait `Qux<'b>` is not implemented for `&'a ()`
|
||||
but trait `Qux<'_>` is implemented for `()`
|
||||
help: the trait `Qux<'b>` is not implemented for `&'a ()`
|
||||
but trait `Qux<'_>` is implemented for `()`
|
||||
--> $DIR/nested-rpit-hrtb.rs:22:1
|
||||
|
|
||||
LL | impl Qux<'_> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `()`, found `&'a ()`
|
||||
|
||||
error: implementation of `Bar` is not general enough
|
||||
|
|
@ -102,8 +106,12 @@ error[E0277]: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied
|
|||
LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Qux<'b>` is not implemented for `&'a ()`
|
||||
|
|
||||
= help: the trait `Qux<'b>` is not implemented for `&'a ()`
|
||||
but trait `Qux<'_>` is implemented for `()`
|
||||
help: the trait `Qux<'b>` is not implemented for `&'a ()`
|
||||
but trait `Qux<'_>` is implemented for `()`
|
||||
--> $DIR/nested-rpit-hrtb.rs:22:1
|
||||
|
|
||||
LL | impl Qux<'_> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `()`, found `&'a ()`
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `String: Trait<u32>` is not satisfied
|
|||
LL | impls_trait(x);
|
||||
| ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
||||
|
|
||||
= help: the trait `Trait<u32>` is not implemented for `String`
|
||||
but trait `Trait<u64>` is implemented for it
|
||||
help: the trait `Trait<u32>` is not implemented for `String`
|
||||
but trait `Trait<u64>` is implemented for it
|
||||
--> $DIR/avoid-inference-constraints-from-blanket-3.rs:17:1
|
||||
|
|
||||
LL | impl Trait<u64> for String {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `u64`, found `u32`
|
||||
note: required for `String` to implement `Trait<u32>`
|
||||
--> $DIR/avoid-inference-constraints-from-blanket-3.rs:16:15
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ error[E0277]: the trait bound `String: Borrow<&str>` is not satisfied
|
|||
LL | &s
|
||||
| ^^ the trait `Borrow<&str>` is not implemented for `String`
|
||||
|
|
||||
= help: the trait `Borrow<&_>` is not implemented for `String`
|
||||
but trait `Borrow<_>` is implemented for it
|
||||
help: the trait `Borrow<&_>` is not implemented for `String`
|
||||
but trait `Borrow<_>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/str.rs:LL:COL
|
||||
= help: for that trait implementation, expected `str`, found `&str`
|
||||
= note: required for `HashMap<String, String>` to implement `Index<&&str>`
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@ error[E0277]: a value of type `Vec<(u32, _, _)>` cannot be built from an iterato
|
|||
LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
|
||||
| ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>`
|
||||
|
|
||||
= help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>`
|
||||
but trait `FromIterator<(u32, _, _)>` is implemented for it
|
||||
help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>`
|
||||
but trait `FromIterator<(u32, _, _)>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `(u32, _, _)`, found `()`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/issue-34334.rs:5:43
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `Params: Plugin<i32>` is not satisfied
|
|||
LL | req.get_ref::<Params>();
|
||||
| ^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `Plugin<i32>` is not implemented for `Params`
|
||||
but trait `Plugin<Foo>` is implemented for it
|
||||
help: the trait `Plugin<i32>` is not implemented for `Params`
|
||||
but trait `Plugin<Foo>` is implemented for it
|
||||
--> $DIR/issue-45801.rs:14:1
|
||||
|
|
||||
LL | impl Plugin<Foo> for Params {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `Foo`, found `i32`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ LL | let i = i.map(|x| x.clone());
|
|||
LL | i.collect()
|
||||
| ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>`
|
||||
|
|
||||
= help: the trait `FromIterator<&_>` is not implemented for `Vec<X>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
help: the trait `FromIterator<&_>` is not implemented for `Vec<X>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `X`, found `&X`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/invalid-iterator-chain-fixable.rs:5:26
|
||||
|
|
@ -123,8 +124,9 @@ error[E0277]: a value of type `Vec<i32>` cannot be built from an iterator over e
|
|||
LL | let g: Vec<i32> = f.collect();
|
||||
| ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
|
||||
|
|
||||
= help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
|
||||
but trait `FromIterator<i32>` is implemented for it
|
||||
help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
|
||||
but trait `FromIterator<i32>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `i32`, found `()`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/invalid-iterator-chain-fixable.rs:32:15
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ LL | let i = i.map(|x| x.clone());
|
|||
LL | i.collect()
|
||||
| ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>`
|
||||
|
|
||||
= help: the trait `FromIterator<&_>` is not implemented for `Vec<X>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
help: the trait `FromIterator<&_>` is not implemented for `Vec<X>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `X`, found `&X`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/invalid-iterator-chain.rs:4:26
|
||||
|
|
@ -180,8 +181,9 @@ error[E0277]: a value of type `Vec<i32>` cannot be built from an iterator over e
|
|||
LL | let g: Vec<i32> = f.collect();
|
||||
| ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
|
||||
|
|
||||
= help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
|
||||
but trait `FromIterator<i32>` is implemented for it
|
||||
help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
|
||||
but trait `FromIterator<i32>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `i32`, found `()`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/invalid-iterator-chain.rs:44:15
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over e
|
|||
LL | let x2: Vec<f64> = x1.into_iter().collect();
|
||||
| ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
||||
|
|
||||
= help: the trait `FromIterator<&_>` is not implemented for `Vec<f64>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
help: the trait `FromIterator<&_>` is not implemented for `Vec<f64>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `f64`, found `&f64`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/collect-method-type-mismatch-66923.rs:9:27
|
||||
|
|
@ -25,8 +26,9 @@ LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
|
|||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `FromIterator<&_>` is not implemented for `Vec<f64>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
help: the trait `FromIterator<&_>` is not implemented for `Vec<f64>`
|
||||
but trait `FromIterator<_>` is implemented for it
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `f64`, found `&f64`
|
||||
note: the method call chain might not have had the expected associated types
|
||||
--> $DIR/collect-method-type-mismatch-66923.rs:13:17
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied
|
|||
LL | <E as From<_>>::from(never); // Should the inference fail?
|
||||
| ^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `From<()>` is not implemented for `E`
|
||||
but trait `From<!>` is implemented for it
|
||||
help: the trait `From<()>` is not implemented for `E`
|
||||
but trait `From<!>` is implemented for it
|
||||
--> $DIR/from_infer_breaking_with_unit_fallback.rs:16:1
|
||||
|
|
||||
LL | impl From<!> for E {
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `!`, found `()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied
|
|||
LL | <E as From<_>>::from(never);
|
||||
| ^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `From<()>` is not implemented for `E`
|
||||
but trait `From<!>` is implemented for it
|
||||
help: the trait `From<()>` is not implemented for `E`
|
||||
but trait `From<!>` is implemented for it
|
||||
--> $DIR/never-value-fallback-issue-66757.rs:17:1
|
||||
|
|
||||
LL | impl From<!> for E {
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `!`, found `()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
|
|||
|
|
@ -7,8 +7,12 @@ LL | Trait::do_stuff({ fun(&mut *inner) });
|
|||
| | the trait `Trait<'_>` is not implemented for `*mut ()`
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Trait<'_>` is not implemented for `*mut ()`
|
||||
but it is implemented for `()`
|
||||
help: the trait `Trait<'_>` is not implemented for `*mut ()`
|
||||
but it is implemented for `()`
|
||||
--> $DIR/issue-101623.rs:15:1
|
||||
|
|
||||
LL | impl<'a> Trait<'a> for () {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `()`, found `*mut ()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `Struct: Trait<isize>` is not satisfied
|
|||
LL | let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `Trait<isize>` is not implemented for `Struct`
|
||||
but trait `Trait<&'static str>` is implemented for it
|
||||
help: the trait `Trait<isize>` is not implemented for `Struct`
|
||||
but trait `Trait<&'static str>` is implemented for it
|
||||
--> $DIR/coercion-generic-bad.rs:9:1
|
||||
|
|
||||
LL | impl Trait<&'static str> for Struct {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `&'static str`, found `isize`
|
||||
= note: required for the cast from `Box<Struct>` to `Box<dyn Trait<isize>>`
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ LL | Err("")?;
|
|||
| this can't be annotated with `?` because it has type `Result<_, &str>`
|
||||
|
|
||||
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
|
||||
= help: the trait `From<&str>` is not implemented for `TryFromSliceError`
|
||||
but trait `From<Infallible>` is implemented for it
|
||||
help: the trait `From<&str>` is not implemented for `TryFromSliceError`
|
||||
but trait `From<Infallible>` is implemented for it
|
||||
--> $SRC_DIR/core/src/array/mod.rs:LL:COL
|
||||
= help: for that trait implementation, expected `Infallible`, found `&str`
|
||||
|
||||
error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str`
|
||||
|
|
|
|||
|
|
@ -53,8 +53,9 @@ LL | fn result_to_control_flow() -> ControlFlow<String> {
|
|||
LL | ControlFlow::Continue(Err("hello")?)
|
||||
| ^ this `?` produces `Result<Infallible, &str>`, which is incompatible with `ControlFlow<String>`
|
||||
|
|
||||
= help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `ControlFlow<String>`
|
||||
but trait `FromResidual<ControlFlow<String, Infallible>>` is implemented for it
|
||||
help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `ControlFlow<String>`
|
||||
but trait `FromResidual<ControlFlow<String, Infallible>>` is implemented for it
|
||||
--> $SRC_DIR/core/src/ops/control_flow.rs:LL:COL
|
||||
= help: for that trait implementation, expected `ControlFlow<String, Infallible>`, found `Result<Infallible, &str>`
|
||||
|
||||
error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
|
||||
|
|
@ -65,8 +66,9 @@ LL | fn option_to_control_flow() -> ControlFlow<u64> {
|
|||
LL | Some(3)?;
|
||||
| ^ this `?` produces `Option<Infallible>`, which is incompatible with `ControlFlow<u64>`
|
||||
|
|
||||
= help: the trait `FromResidual<Option<Infallible>>` is not implemented for `ControlFlow<u64>`
|
||||
but trait `FromResidual<ControlFlow<u64, Infallible>>` is implemented for it
|
||||
help: the trait `FromResidual<Option<Infallible>>` is not implemented for `ControlFlow<u64>`
|
||||
but trait `FromResidual<ControlFlow<u64, Infallible>>` is implemented for it
|
||||
--> $SRC_DIR/core/src/ops/control_flow.rs:LL:COL
|
||||
= help: for that trait implementation, expected `ControlFlow<u64, Infallible>`, found `Option<Infallible>`
|
||||
|
||||
error[E0277]: the `?` operator in a function that returns `ControlFlow<B, _>` can only be used on other `ControlFlow<B, _>`s (with the same Break type)
|
||||
|
|
@ -78,8 +80,9 @@ LL | ControlFlow::Break(4_u8)?;
|
|||
| ^ this `?` produces `ControlFlow<u8, Infallible>`, which is incompatible with `ControlFlow<i64>`
|
||||
|
|
||||
= note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow`
|
||||
= help: the trait `FromResidual<ControlFlow<u8, _>>` is not implemented for `ControlFlow<i64>`
|
||||
but trait `FromResidual<ControlFlow<i64, _>>` is implemented for it
|
||||
help: the trait `FromResidual<ControlFlow<u8, _>>` is not implemented for `ControlFlow<i64>`
|
||||
but trait `FromResidual<ControlFlow<i64, _>>` is implemented for it
|
||||
--> $SRC_DIR/core/src/ops/control_flow.rs:LL:COL
|
||||
= help: for that trait implementation, expected `i64`, found `u8`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
|
|||
LL | let x = <Foo as Trait<Bar>>::Assoc::default();
|
||||
| ^^^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `Trait<Bar>` is not implemented for `Foo`
|
||||
but trait `Trait<()>` is implemented for it
|
||||
help: the trait `Trait<Bar>` is not implemented for `Foo`
|
||||
but trait `Trait<()>` is implemented for it
|
||||
--> $DIR/constrain_in_projection.rs:19:1
|
||||
|
|
||||
LL | impl Trait<()> for Foo {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
|
||||
--> $DIR/constrain_in_projection.rs:25:13
|
||||
|
|
@ -13,8 +17,12 @@ error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
|
|||
LL | let x = <Foo as Trait<Bar>>::Assoc::default();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
= help: the trait `Trait<Bar>` is not implemented for `Foo`
|
||||
but trait `Trait<()>` is implemented for it
|
||||
help: the trait `Trait<Bar>` is not implemented for `Foo`
|
||||
but trait `Trait<()>` is implemented for it
|
||||
--> $DIR/constrain_in_projection.rs:19:1
|
||||
|
|
||||
LL | impl Trait<()> for Foo {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,12 @@ LL | fn foo() -> impl Foo<FooX> {
|
|||
LL | ()
|
||||
| -- return type was inferred to be `()` here
|
||||
|
|
||||
= help: the trait `Foo<FooX>` is not implemented for `()`
|
||||
but trait `Foo<()>` is implemented for it
|
||||
help: the trait `Foo<FooX>` is not implemented for `()`
|
||||
but trait `Foo<()>` is implemented for it
|
||||
--> $DIR/nested-tait-inference.rs:15:1
|
||||
|
|
||||
LL | impl Foo<()> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ LL | fn bar() -> Bar {
|
|||
LL | 42_i32
|
||||
| ------ return type was inferred to be `i32` here
|
||||
|
|
||||
= help: the trait `PartialEq<Foo>` is not implemented for `i32`
|
||||
but trait `PartialEq<i32>` is implemented for it
|
||||
help: the trait `PartialEq<Foo>` is not implemented for `i32`
|
||||
but trait `PartialEq<i32>` is implemented for it
|
||||
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
||||
= note: this error originates in the macro `partial_eq_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ error[E0277]: the trait bound `((),): Into<Bar>` is not satisfied
|
|||
LL | let _: Bar = ((),).into();
|
||||
| ^^^^ the trait `Foo<'_>` is not implemented for `((),)`
|
||||
|
|
||||
= help: the trait `Foo<'_>` is not implemented for `((),)`
|
||||
but it is implemented for `()`
|
||||
help: the trait `Foo<'_>` is not implemented for `((),)`
|
||||
but it is implemented for `()`
|
||||
--> $DIR/suggest-similar-impls-for-root-obligation.rs:3:1
|
||||
|
|
||||
LL | impl<'s> Foo<'s> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: for that trait implementation, expected `()`, found `((),)`
|
||||
note: required for `Bar` to implement `From<((),)>`
|
||||
--> $DIR/suggest-similar-impls-for-root-obligation.rs:7:22
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue