Rollup merge of #154161 - estebank:e0277-ty-impls, r=Kivooeo

On E0277 tweak help when single type impls traits

When encountering an unmet predicate, when we point at the trait impls that do exist, if they are all for the same self type, tweak the wording to make it less verbose.
This commit is contained in:
Jonathan Brouwer
2026-03-23 12:01:01 +01:00
committed by GitHub
37 changed files with 272 additions and 238 deletions
@@ -2299,6 +2299,11 @@ pub(super) fn report_similar_impl_candidates(
// FIXME: this could use a better heuristic, like just checking
// that args[1..] is the same.
let all_traits_equal = traits.len() == 1;
let mut types: Vec<_> =
candidates.iter().map(|(c, _)| c.self_ty().to_string()).collect();
types.sort();
types.dedup();
let all_types_equal = types.len() == 1;
let end = if candidates.len() <= 9 || self.tcx.sess.opts.verbose {
candidates.len()
@@ -2312,6 +2317,11 @@ pub(super) fn report_similar_impl_candidates(
for (c, def_id) in &candidates {
let msg = if all_traits_equal {
format!("`{}`", self.tcx.short_string(c.self_ty(), err.long_ty_path()))
} else if all_types_equal {
format!(
"`{}`",
self.tcx.short_string(c.print_only_trait_path(), err.long_ty_path())
)
} else {
format!(
"`{}` implements `{}`",
@@ -2321,13 +2331,19 @@ pub(super) fn report_similar_impl_candidates(
};
span.push_span_label(self.tcx.def_span(*def_id), msg);
}
err.span_help(
span,
let msg = if all_types_equal {
format!(
"`{}` implements trait `{}`",
self.tcx.short_string(candidates[0].0.self_ty(), err.long_ty_path()),
self.tcx.short_string(trait_ref.print_trait_sugared(), err.long_ty_path()),
)
} else {
format!(
"the following {other}types implement trait `{}`",
trait_ref.print_trait_sugared(),
),
);
self.tcx.short_string(trait_ref.print_trait_sugared(), err.long_ty_path()),
)
};
err.span_help(span, msg);
} else {
let candidate_names: Vec<String> = candidates
.iter()
@@ -2337,6 +2353,12 @@ pub(super) fn report_similar_impl_candidates(
"\n {}",
self.tcx.short_string(c.self_ty(), err.long_ty_path())
)
} else if all_types_equal {
format!(
"\n {}",
self.tcx
.short_string(c.print_only_trait_path(), err.long_ty_path())
)
} else {
format!(
"\n `{}` implements `{}`",
@@ -2347,9 +2369,21 @@ pub(super) fn report_similar_impl_candidates(
}
})
.collect();
let msg = if all_types_equal {
format!(
"`{}` implements trait `{}`",
self.tcx.short_string(candidates[0].0.self_ty(), err.long_ty_path()),
self.tcx.short_string(trait_ref.print_trait_sugared(), err.long_ty_path()),
)
} else {
format!(
"the following {other}types implement trait `{}`",
self.tcx.short_string(trait_ref.print_trait_sugared(), err.long_ty_path()),
)
};
err.help(format!(
"the following {other}types implement trait `{}`:{}{}",
trait_ref.print_trait_sugared(),
"{msg}:{}{}",
candidate_names[..end].join(""),
if candidates.len() > 9 && !self.tcx.sess.opts.verbose {
format!("\nand {} others", candidates.len() - 8)
@@ -177,14 +177,14 @@ LL | Err(Error2)?;
| this can't be annotated with `?` because it has type `Result<_, Error2>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
help: the following other types implement trait `From<T>`
help: `dependency::OtherError` implements trait `From<T>`
--> replaced
|
LL | impl From<()> for OtherError {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dependency::OtherError` implements `From<()>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `From<()>`
...
LL | impl From<i32> for OtherError {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dependency::OtherError` implements `From<i32>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `From<i32>`
= note: there are multiple different versions of crate `dependency` in the dependency graph
= help: you can use `cargo tree` to explore your dependency tree
@@ -4,15 +4,15 @@ error[E0277]: the trait bound `(): Foo<N>` is not satisfied
LL | <() as Foo<N>>::test()
| ^^ the trait `Foo<N>` is not implemented for `()`
|
= help: the following other types implement trait `Foo<N>`:
`()` implements `Foo<0>`
`()` implements `Foo<100>`
`()` implements `Foo<101>`
`()` implements `Foo<102>`
`()` implements `Foo<103>`
`()` implements `Foo<104>`
`()` implements `Foo<105>`
`()` implements `Foo<106>`
= help: `()` implements trait `Foo<N>`:
Foo<0>
Foo<100>
Foo<101>
Foo<102>
Foo<103>
Foo<104>
Foo<105>
Foo<106>
and 248 others
error: aborting due to 1 previous error
@@ -11,14 +11,14 @@ help: the trait `Foo<usize>` is not implemented for `Bar`
|
LL | struct Bar;
| ^^^^^^^^^^
help: the following other types implement trait `Foo<A>`
help: `Bar` implements trait `Foo<A>`
--> $DIR/issue-21659-show-relevant-trait-impls-1.rs:15:1
|
LL | impl Foo<i32> for Bar {}
| ^^^^^^^^^^^^^^^^^^^^^ `Bar` implements `Foo<i32>`
| ^^^^^^^^^^^^^^^^^^^^^ `Foo<i32>`
LL |
LL | impl Foo<u8> for Bar {}
| ^^^^^^^^^^^^^^^^^^^^ `Bar` implements `Foo<u8>`
| ^^^^^^^^^^^^^^^^^^^^ `Foo<u8>`
error: aborting due to 1 previous error
@@ -11,13 +11,13 @@ help: the trait `Foo<usize>` is not implemented for `Bar`
|
LL | struct Bar;
| ^^^^^^^^^^
= help: the following other types implement trait `Foo<A>`:
`Bar` implements `Foo<i16>`
`Bar` implements `Foo<i32>`
`Bar` implements `Foo<i8>`
`Bar` implements `Foo<u16>`
`Bar` implements `Foo<u32>`
`Bar` implements `Foo<u8>`
= help: `Bar` implements trait `Foo<A>`:
Foo<i16>
Foo<i32>
Foo<i8>
Foo<u16>
Foo<u32>
Foo<u8>
error: aborting due to 1 previous error
@@ -6,12 +6,12 @@ LL | Foo::<i32>::bar(&1i8);
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `Foo<B>`:
`i8` implements `Foo<bool>`
`i8` implements `Foo<u16>`
`i8` implements `Foo<u32>`
`i8` implements `Foo<u64>`
`i8` implements `Foo<u8>`
= help: `i8` implements trait `Foo<B>`:
Foo<bool>
Foo<u16>
Foo<u32>
Foo<u64>
Foo<u8>
error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:25:21
@@ -21,17 +21,17 @@ LL | Foo::<i32>::bar(&1u8);
| |
| required by a bound introduced by this call
|
help: the following other types implement trait `Foo<B>`
help: `u8` implements trait `Foo<B>`
--> $DIR/issue-39802-show-5-trait-impls.rs:11:1
|
LL | impl Foo<u16> for u8 {}
| ^^^^^^^^^^^^^^^^^^^^ `u8` implements `Foo<u16>`
| ^^^^^^^^^^^^^^^^^^^^ `Foo<u16>`
LL | impl Foo<u32> for u8 {}
| ^^^^^^^^^^^^^^^^^^^^ `u8` implements `Foo<u32>`
| ^^^^^^^^^^^^^^^^^^^^ `Foo<u32>`
LL | impl Foo<u64> for u8 {}
| ^^^^^^^^^^^^^^^^^^^^ `u8` implements `Foo<u64>`
| ^^^^^^^^^^^^^^^^^^^^ `Foo<u64>`
LL | impl Foo<bool> for u8 {}
| ^^^^^^^^^^^^^^^^^^^^^ `u8` implements `Foo<bool>`
| ^^^^^^^^^^^^^^^^^^^^^ `Foo<bool>`
error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:26:21
@@ -41,13 +41,13 @@ LL | Foo::<i32>::bar(&true);
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `Foo<B>`:
`bool` implements `Foo<bool>`
`bool` implements `Foo<i8>`
`bool` implements `Foo<u16>`
`bool` implements `Foo<u32>`
`bool` implements `Foo<u64>`
`bool` implements `Foo<u8>`
= help: `bool` implements trait `Foo<B>`:
Foo<bool>
Foo<i8>
Foo<u16>
Foo<u32>
Foo<u64>
Foo<u8>
error: aborting due to 3 previous errors
+3 -3
View File
@@ -5,13 +5,13 @@ LL | x[0i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `Vec<{integer}>` to implement `Index<i32>`
error: aborting due to 1 previous error
@@ -5,13 +5,13 @@ LL | v[3u8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `u8`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `Vec<isize>` to implement `Index<u8>`
error[E0277]: the type `[isize]` cannot be indexed by `i8`
@@ -21,13 +21,13 @@ LL | v[3i8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `i8`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `Vec<isize>` to implement `Index<i8>`
error[E0277]: the type `[isize]` cannot be indexed by `u32`
@@ -37,13 +37,13 @@ LL | v[3u32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `u32`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `Vec<isize>` to implement `Index<u32>`
error[E0277]: the type `[isize]` cannot be indexed by `i32`
@@ -53,13 +53,13 @@ LL | v[3i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `i32`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `Vec<isize>` to implement `Index<i32>`
error[E0277]: the type `[u8]` cannot be indexed by `u8`
@@ -69,13 +69,13 @@ LL | s.as_bytes()[3u8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `u8`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `[u8]` to implement `Index<u8>`
error[E0277]: the type `[u8]` cannot be indexed by `i8`
@@ -85,13 +85,13 @@ LL | s.as_bytes()[3i8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `i8`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `[u8]` to implement `Index<i8>`
error[E0277]: the type `[u8]` cannot be indexed by `u32`
@@ -101,13 +101,13 @@ LL | s.as_bytes()[3u32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `u32`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `[u8]` to implement `Index<u32>`
error[E0277]: the type `[u8]` cannot be indexed by `i32`
@@ -117,13 +117,13 @@ LL | s.as_bytes()[3i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `i32`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `[u8]` to implement `Index<i32>`
error: aborting due to 8 previous errors
@@ -5,13 +5,13 @@ LL | [0][0u8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `[{integer}]` to implement `Index<u8>`
error[E0308]: mismatched types
@@ -33,13 +33,13 @@ LL | println!("{}", scores.sum::<i32>());
| required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
help: the following other types implement trait `Sum<A>`
help: `i32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum<&i32>`
= note: `Sum<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -74,13 +74,13 @@ LL | .sum::<i32>(),
| required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
help: the following other types implement trait `Sum<A>`
help: `i32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum<&i32>`
= note: `Sum<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -115,13 +115,13 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
| required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
help: the following other types implement trait `Sum<A>`
help: `i32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum<&i32>`
= note: `Sum<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -7,13 +7,13 @@ LL | let x = Some(()).iter().map(|()| 1).sum::<f32>();
| required by a bound introduced by this call
|
= help: the trait `Sum<{integer}>` is not implemented for `f32`
help: the following other types implement trait `Sum<A>`
help: `f32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `f32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `f32` implements `Sum<&f32>`
= note: `Sum<&f32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -33,13 +33,13 @@ LL | println!("{}", scores.sum::<i32>());
| required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
help: the following other types implement trait `Sum<A>`
help: `i32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum<&i32>`
= note: `Sum<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -73,13 +73,13 @@ LL | .sum::<i32>(),
| required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
help: the following other types implement trait `Sum<A>`
help: `i32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum<&i32>`
= note: `Sum<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -120,13 +120,13 @@ LL | .sum::<i32>(),
| required by a bound introduced by this call
|
= help: the trait `Sum<f64>` is not implemented for `i32`
help: the following other types implement trait `Sum<A>`
help: `i32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum<&i32>`
= note: `Sum<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -158,13 +158,13 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
| required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
help: the following other types implement trait `Sum<A>`
help: `i32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum<&i32>`
= note: `Sum<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -194,13 +194,13 @@ LL | println!("{}", vec![(), ()].iter().sum::<i32>());
| required by a bound introduced by this call
|
= help: the trait `Sum<&()>` is not implemented for `i32`
help: the following other types implement trait `Sum<A>`
help: `i32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum<&i32>`
= note: `Sum<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -4,13 +4,13 @@ error[E0277]: the trait bound `String: From<()>` is not satisfied
LL | let _: Alias<()>;
| ^^ the trait `From<()>` is not implemented for `String`
|
= help: the following other types implement trait `From<T>`:
`String` implements `From<&String>`
`String` implements `From<&mut str>`
`String` implements `From<&str>`
`String` implements `From<Box<str>>`
`String` implements `From<Cow<'_, str>>`
`String` implements `From<char>`
= help: `String` implements trait `From<T>`:
From<&String>
From<&mut str>
From<&str>
From<Box<str>>
From<Cow<'_, str>>
From<char>
note: required by a bound in `Alias`
--> $DIR/trailing-where-clause.rs:8:13
|
+7 -7
View File
@@ -5,13 +5,13 @@ LL | x[1i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[i32]>` is not implemented for `i32`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `[i32]` to implement `Index<i32>`
error[E0277]: the type `[i32]` cannot be indexed by `RangeTo<i32>`
@@ -21,19 +21,19 @@ LL | x[..1i32];
| ^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[i32]>` is not implemented for `RangeTo<i32>`
help: the following other types implement trait `SliceIndex<T>`
help: `RangeTo<usize>` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `RangeTo<usize>` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `RangeTo<usize>` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
::: $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/str/traits.rs:LL:COL
|
= note: `RangeTo<usize>` implements `SliceIndex<str>`
= note: `SliceIndex<str>`
= note: required for `[i32]` to implement `Index<RangeTo<i32>>`
= note: this error originates in the macro `impl_slice_index` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -5,7 +5,7 @@ fn from(_: (u8,)) -> Self {
todo!()
}
}
impl From<(u8, u8)> for Tuple { //~ HELP the following other types implement trait `From<T>`
impl From<(u8, u8)> for Tuple { //~ HELP `Tuple` implements trait `From<T>`
fn from(_: (u8, u8)) -> Self {
todo!()
}
@@ -11,17 +11,17 @@ help: the trait `From<u8>` is not implemented for `Tuple`
|
LL | struct Tuple;
| ^^^^^^^^^^^^
help: the following other types implement trait `From<T>`
help: `Tuple` implements trait `From<T>`
--> $DIR/suggest_tuple_wrap_root_obligation.rs:3:1
|
LL | impl From<(u8,)> for Tuple {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `Tuple` implements `From<(u8,)>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `From<(u8,)>`
...
LL | impl From<(u8, u8)> for Tuple {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Tuple` implements `From<(u8, u8)>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `From<(u8, u8)>`
...
LL | impl From<(u8, u8, u8)> for Tuple {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Tuple` implements `From<(u8, u8, u8)>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `From<(u8, u8, u8)>`
= note: required for `u8` to implement `Into<Tuple>`
note: required by a bound in `convert_into_tuple`
--> $DIR/suggest_tuple_wrap_root_obligation.rs:19:32
+6 -6
View File
@@ -7,13 +7,13 @@ LL | vec![(), ()].iter().sum::<i32>();
| required by a bound introduced by this call
|
= help: the trait `Sum<&()>` is not implemented for `i32`
help: the following other types implement trait `Sum<A>`
help: `i32` implements trait `Sum<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum`
= note: `Sum`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Sum<&i32>`
= note: `Sum<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
@@ -37,13 +37,13 @@ LL | vec![(), ()].iter().product::<i32>();
| required by a bound introduced by this call
|
= help: the trait `Product<&()>` is not implemented for `i32`
help: the following other types implement trait `Product<A>`
help: `i32` implements trait `Product<A>`
--> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Product`
= note: `Product`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: `i32` implements `Product<&i32>`
= note: `Product<&i32>`
::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL
|
= note: in this macro invocation
+9 -9
View File
@@ -7,13 +7,13 @@ LL | let _: u8 = s[4];
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `str` to implement `Index<{integer}>`
error[E0277]: the type `str` cannot be indexed by `{integer}`
@@ -27,13 +27,13 @@ LL | let _ = s.get(4);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
note: required by a bound in `core::str::<impl str>::get`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
@@ -48,13 +48,13 @@ LL | let _ = s.get_unchecked(4);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
note: required by a bound in `core::str::<impl str>::get_unchecked`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
+9 -9
View File
@@ -31,13 +31,13 @@ LL | s[1usize] = bot();
| ^^^^^^ string indices are ranges of `usize`
|
= help: the trait `SliceIndex<str>` is not implemented for `usize`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `str` to implement `Index<usize>`
error[E0277]: the type `str` cannot be indexed by `{integer}`
@@ -51,13 +51,13 @@ LL | s.get_mut(1);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
note: required by a bound in `core::str::<impl str>::get_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
@@ -72,13 +72,13 @@ LL | s.get_unchecked_mut(1);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
@@ -4,13 +4,13 @@ error[E0277]: the trait bound `str: From<_>` is not satisfied
LL | let _ = &str::from("value");
| ^^^ the trait `From<_>` is not implemented for `str`
|
= help: the following other types implement trait `From<T>`:
`String` implements `From<&String>`
`String` implements `From<&mut str>`
`String` implements `From<&str>`
`String` implements `From<Box<str>>`
`String` implements `From<Cow<'_, str>>`
`String` implements `From<char>`
= help: `String` implements trait `From<T>`:
From<&String>
From<&mut str>
From<&str>
From<Box<str>>
From<Cow<'_, str>>
From<char>
help: you likely meant to call the associated function `from` for type `&str`, but the code as written calls associated function `from` on type `str`
|
LL | let _ = <&str>::from("value");
+7 -7
View File
@@ -7,13 +7,13 @@ LL | foo(String::new());
| required by a bound introduced by this call
|
= note: to coerce a `String` into a `&str`, use `&*` as a prefix
= help: the following other types implement trait `From<T>`:
`String` implements `From<&String>`
`String` implements `From<&mut str>`
`String` implements `From<&str>`
`String` implements `From<Box<str>>`
`String` implements `From<Cow<'_, str>>`
`String` implements `From<char>`
= help: `String` implements trait `From<T>`:
From<&String>
From<&mut str>
From<&str>
From<Box<str>>
From<Cow<'_, str>>
From<char>
= note: required for `String` to implement `Into<&str>`
note: required by a bound in `foo`
--> $DIR/into-str.rs:1:31
@@ -5,15 +5,15 @@ LL | String::from("Girls Band Cry") == T(String::from("Girls Band Cry"));
| ^^ no implementation for `String == T`
|
= help: the trait `PartialEq<T>` is not implemented for `String`
= help: the following other types implement trait `PartialEq<Rhs>`:
`String` implements `PartialEq<&str>`
`String` implements `PartialEq<ByteStr>`
`String` implements `PartialEq<ByteString>`
`String` implements `PartialEq<Cow<'_, str>>`
`String` implements `PartialEq<Path>`
`String` implements `PartialEq<PathBuf>`
`String` implements `PartialEq<str>`
`String` implements `PartialEq`
= help: `String` implements trait `PartialEq<Rhs>`:
PartialEq<&str>
PartialEq<ByteStr>
PartialEq<ByteString>
PartialEq<Cow<'_, str>>
PartialEq<Path>
PartialEq<PathBuf>
PartialEq<str>
PartialEq
= note: `T` implements `PartialEq<String>`
help: consider swapping the equality
|
@@ -20,15 +20,15 @@ LL | .collect::<String>();
| required by a bound introduced by this call
|
= help: the trait `FromIterator<()>` is not implemented for `String`
= help: the following other types implement trait `FromIterator<A>`:
`String` implements `FromIterator<&char>`
`String` implements `FromIterator<&std::ascii::Char>`
`String` implements `FromIterator<&str>`
`String` implements `FromIterator<Box<str, A>>`
`String` implements `FromIterator<Cow<'_, str>>`
`String` implements `FromIterator<String>`
`String` implements `FromIterator<char>`
`String` implements `FromIterator<std::ascii::Char>`
= help: `String` implements trait `FromIterator<A>`:
FromIterator<&char>
FromIterator<&std::ascii::Char>
FromIterator<&str>
FromIterator<Box<str, A>>
FromIterator<Cow<'_, str>>
FromIterator<String>
FromIterator<char>
FromIterator<std::ascii::Char>
note: the method call chain might not have had the expected associated types
--> $DIR/semi-suggestion-when-stmt-and-expr-span-equal.rs:20:10
|
@@ -5,13 +5,13 @@ LL | let one_item_please: i32 = [1, 2, 3][i];
| ^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `&usize`
help: the following other types implement trait `SliceIndex<T>`
help: `usize` implements trait `SliceIndex<T>`
--> $SRC_DIR/core/src/slice/index.rs:LL:COL
|
= note: `usize` implements `SliceIndex<[T]>`
= note: `SliceIndex<[T]>`
--> $SRC_DIR/core/src/bstr/traits.rs:LL:COL
|
= note: `usize` implements `SliceIndex<ByteStr>`
= note: `SliceIndex<ByteStr>`
= note: required for `[{integer}]` to implement `Index<&usize>`
help: dereference this index
|
+1 -1
View File
@@ -7,7 +7,7 @@
//~^ HELP the trait `From<&PathBuf>` is not implemented for `ToolA`
impl From<&Path> for ToolA {
//~^ HELP the following other types implement trait `From<T>`
//~^ HELP `ToolA` implements trait `From<T>`
fn from(p: &Path) -> ToolA {
ToolA(p.to_path_buf())
}
@@ -10,14 +10,14 @@ help: the trait `From<&PathBuf>` is not implemented for `ToolA`
|
LL | pub struct ToolA(PathBuf);
| ^^^^^^^^^^^^^^^^
help: the following other types implement trait `From<T>`
help: `ToolA` implements trait `From<T>`
--> $DIR/explicit-reference-cast.rs:9:1
|
LL | impl From<&Path> for ToolA {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `ToolA` implements `From<&Path>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `From<&Path>`
...
LL | impl From<&str> for ToolA {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ `ToolA` implements `From<&str>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^ `From<&str>`
error[E0277]: the trait bound `ToolB: TryFrom<&PathBuf>` is not satisfied
--> $DIR/explicit-reference-cast.rs:43:13
@@ -6,14 +6,14 @@ LL | c.same_as(22)
| |
| required by a bound introduced by this call
|
help: the following other types implement trait `CompareTo<T>`
help: `i64` implements trait `CompareTo<T>`
--> $DIR/repeated-supertrait-ambig.rs:15:1
|
LL | impl CompareTo<i64> for i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `i64` implements `CompareTo<i64>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CompareTo<i64>`
...
LL | impl CompareTo<u64> for i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `i64` implements `CompareTo<u64>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CompareTo<u64>`
error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
--> $DIR/repeated-supertrait-ambig.rs:30:15
@@ -34,14 +34,14 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfi
LL | <dyn CompareToInts>::same_as(c, 22)
| ^^^^^^^^^^^^^^^^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
|
help: the following other types implement trait `CompareTo<T>`
help: `i64` implements trait `CompareTo<T>`
--> $DIR/repeated-supertrait-ambig.rs:15:1
|
LL | impl CompareTo<i64> for i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `i64` implements `CompareTo<i64>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CompareTo<i64>`
...
LL | impl CompareTo<u64> for i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `i64` implements `CompareTo<u64>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CompareTo<u64>`
error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
--> $DIR/repeated-supertrait-ambig.rs:38:24
@@ -64,14 +64,14 @@ LL | assert_eq!(22_i64.same_as(22), true);
| |
| required by a bound introduced by this call
|
help: the following other types implement trait `CompareTo<T>`
help: `i64` implements trait `CompareTo<T>`
--> $DIR/repeated-supertrait-ambig.rs:15:1
|
LL | impl CompareTo<i64> for i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `i64` implements `CompareTo<i64>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CompareTo<i64>`
...
LL | impl CompareTo<u64> for i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `i64` implements `CompareTo<u64>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CompareTo<u64>`
error: aborting due to 5 previous errors
@@ -5,7 +5,7 @@ LL | impls_trait::<Root<_>>()
| ^^^^^^^ cannot infer type for struct `Head<_>`
|
= note: cannot satisfy `Head<_>: Trait`
help: the following types implement trait `Trait`
help: `Head<T>` implements trait `Trait`
--> $DIR/forced_ambiguity-use-head-maybe-cause.rs:23:1
|
LL | / impl<T> Trait for Head<T>
@@ -21,7 +21,7 @@ help: the trait `Trait` is not implemented for `MultipleCandidates`
|
LL | struct MultipleCandidates;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: the following other types implement trait `Trait`
help: `MultipleCandidates` implements trait `Trait`
--> $DIR/inductive-cycle-but-err.rs:26:1
|
LL | / impl Trait for MultipleCandidates
@@ -4,13 +4,13 @@ error[E0277]: the trait bound `(): Trait<1>` is not satisfied
LL | needs::<1>();
| ^ the trait `Trait<1>` is not implemented for `()`
|
help: the following other types implement trait `Trait<N>`
help: `()` implements trait `Trait<N>`
--> $DIR/unevaluated-const-impl-trait-ref.rs:7:1
|
LL | impl Trait<{ 1 - 1 }> for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` implements `Trait<0>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Trait<0>`
LL | impl Trait<{ 1 + 1 }> for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` implements `Trait<2>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Trait<2>`
note: required by a bound in `needs`
--> $DIR/unevaluated-const-impl-trait-ref.rs:10:38
|
@@ -35,7 +35,7 @@ fn bar() -> Result<(), String> { //~ NOTE expected `String` because of this
//~| NOTE the trait `From<()>` is not implemented for `String`
//~| NOTE the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
//~| NOTE required for `Result<(), String>` to implement `FromResidual<Result<Infallible, ()>>`
//~| HELP the following other types implement trait `From<T>`:
//~| HELP `String` implements trait `From<T>`:
Ok(one)
}
@@ -30,13 +30,13 @@ LL | .map_err(|_| ())?;
| this can't be annotated with `?` because it has type `Result<_, ()>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
`String` implements `From<&String>`
`String` implements `From<&mut str>`
`String` implements `From<&str>`
`String` implements `From<Box<str>>`
`String` implements `From<Cow<'_, str>>`
`String` implements `From<char>`
= help: `String` implements trait `From<T>`:
From<&String>
From<&mut str>
From<&str>
From<Box<str>>
From<Cow<'_, str>>
From<char>
= note: required for `Result<(), String>` to implement `FromResidual<Result<Infallible, ()>>`
error[E0277]: `?` couldn't convert the error to `String`
@@ -9,12 +9,12 @@ LL | Err("str").map_err(|e| e)?;
| this has type `Result<_, &str>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
`i32` implements `From<bool>`
`i32` implements `From<i16>`
`i32` implements `From<i8>`
`i32` implements `From<u16>`
`i32` implements `From<u8>`
= help: `i32` implements trait `From<T>`:
From<bool>
From<i16>
From<i8>
From<u16>
From<u8>
error[E0277]: `?` couldn't convert the error to `i32`
--> $DIR/question-mark-span-144304.rs:4:42
@@ -29,12 +29,12 @@ LL | Err("str").map_err(|e| e.to_string())?;
| this has type `Result<_, &str>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
`i32` implements `From<bool>`
`i32` implements `From<i16>`
`i32` implements `From<i8>`
`i32` implements `From<u16>`
`i32` implements `From<u8>`
= help: `i32` implements trait `From<T>`:
From<bool>
From<i16>
From<i8>
From<u16>
From<u8>
error: aborting due to 2 previous errors
@@ -9,16 +9,16 @@ LL | Ok(Err(123_i32)?)
| this can't be annotated with `?` because it has type `Result<_, i32>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
help: the following other types implement trait `From<T>`
help: `u8` implements trait `From<T>`
--> $SRC_DIR/core/src/convert/num.rs:LL:COL
|
= note: `u8` implements `From<bool>`
= note: `From<bool>`
::: $SRC_DIR/core/src/convert/num.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL
|
= note: `u8` implements `From<std::ascii::Char>`
= note: `From<std::ascii::Char>`
::: $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL
|
= note: in this macro invocation
@@ -9,14 +9,14 @@ help: the trait `Trait<Bar>` is not implemented for `Foo`
|
LL | struct Foo;
| ^^^^^^^^^^
help: the following other types implement trait `Trait<T>`
help: `Foo` implements trait `Trait<T>`
--> $DIR/constrain_in_projection2.rs:18:1
|
LL | impl Trait<()> for Foo {
| ^^^^^^^^^^^^^^^^^^^^^^ `Foo` implements `Trait<()>`
| ^^^^^^^^^^^^^^^^^^^^^^ `Trait<()>`
...
LL | impl Trait<u32> for Foo {
| ^^^^^^^^^^^^^^^^^^^^^^^ `Foo` implements `Trait<u32>`
| ^^^^^^^^^^^^^^^^^^^^^^^ `Trait<u32>`
error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
--> $DIR/constrain_in_projection2.rs:28:13
@@ -29,14 +29,14 @@ help: the trait `Trait<Bar>` is not implemented for `Foo`
|
LL | struct Foo;
| ^^^^^^^^^^
help: the following other types implement trait `Trait<T>`
help: `Foo` implements trait `Trait<T>`
--> $DIR/constrain_in_projection2.rs:18:1
|
LL | impl Trait<()> for Foo {
| ^^^^^^^^^^^^^^^^^^^^^^ `Foo` implements `Trait<()>`
| ^^^^^^^^^^^^^^^^^^^^^^ `Trait<()>`
...
LL | impl Trait<u32> for Foo {
| ^^^^^^^^^^^^^^^^^^^^^^^ `Foo` implements `Trait<u32>`
| ^^^^^^^^^^^^^^^^^^^^^^^ `Trait<u32>`
error: aborting due to 2 previous errors
@@ -7,13 +7,13 @@ LL |
LL | ()
| -- return type was inferred to be `()` here
|
help: the following other types implement trait `Foo<A>`
help: `()` implements trait `Foo<A>`
--> $DIR/nested-tait-inference2.rs:14:1
|
LL | impl Foo<()> for () {}
| ^^^^^^^^^^^^^^^^^^^ `()` implements `Foo<()>`
| ^^^^^^^^^^^^^^^^^^^ `Foo<()>`
LL | impl Foo<u32> for () {}
| ^^^^^^^^^^^^^^^^^^^^ `()` implements `Foo<u32>`
| ^^^^^^^^^^^^^^^^^^^^ `Foo<u32>`
error: aborting due to 1 previous error
+6 -6
View File
@@ -6,12 +6,12 @@ LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world")
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
`PathBuf` implements `From<&T>`
`PathBuf` implements `From<Box<Path>>`
`PathBuf` implements `From<Cow<'_, Path>>`
`PathBuf` implements `From<OsString>`
`PathBuf` implements `From<String>`
= help: `PathBuf` implements trait `From<T>`:
From<&T>
From<Box<Path>>
From<Cow<'_, Path>>
From<OsString>
From<String>
= note: required for `Cow<'_, str>` to implement `Into<PathBuf>`
note: required by a bound in `func`
--> $DIR/issue-90101.rs:3:20