1
Fork 0

Dedup logic and improve output for other types that impl trait

This commit is contained in:
Esteban Kuber 2022-03-27 01:49:01 +00:00
parent e2bba0708a
commit ef91519b45
47 changed files with 363 additions and 357 deletions

View file

@ -30,7 +30,7 @@ use rustc_middle::traits::select::OverflowError;
use rustc_middle::ty::error::ExpectedFound;
use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::{
self, SubtypePredicate, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable,
self, SubtypePredicate, ToPolyTraitRef, ToPredicate, TraitRef, Ty, TyCtxt, TypeFoldable,
};
use rustc_span::symbol::{kw, sym};
use rustc_span::{ExpnKind, MultiSpan, Span, DUMMY_SP};
@ -1756,6 +1756,60 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
trait_ref: ty::PolyTraitRef<'tcx>,
err: &mut Diagnostic,
) -> bool {
let report = |mut candidates: Vec<TraitRef<'_>>, err: &mut Diagnostic| {
candidates.sort();
candidates.dedup();
let len = candidates.len();
if candidates.len() == 0 {
return false;
}
let trait_ref = candidates[0];
if candidates.len() == 1 {
err.highlighted_help(vec![
(
format!(
"the trait `{}` is implemented for `",
trait_ref.print_only_trait_path()
),
Style::NoStyle,
),
(candidates[0].self_ty().to_string(), Style::Highlight),
("`".to_string(), Style::NoStyle),
]);
return true;
}
// Check if the trait is the same in all cases. If so, we'll only show the type.
// FIXME: there *has* to be a better way!
let mut traits: Vec<_> = candidates
.iter()
.map(|c| format!("{}", c).split(" as ").last().unwrap().to_string())
.collect();
traits.sort();
traits.dedup();
let mut candidates: Vec<String> = candidates
.into_iter()
.map(|c| {
if traits.len() == 1 {
format!("\n {}", c.self_ty())
} else {
format!("\n {}", c)
}
})
.collect();
candidates.sort();
candidates.dedup();
let end = if candidates.len() <= 9 { candidates.len() } else { 8 };
err.help(&format!(
"the following other types implement trait `{}`:{}{}",
trait_ref.print_only_trait_path(),
candidates[..end].join(""),
if len > 9 { format!("\nand {} others", len - 8) } else { String::new() }
));
true
};
let def_id = trait_ref.def_id();
if impl_candidates.is_empty() {
if self.tcx.trait_is_auto(def_id)
@ -1765,7 +1819,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
// Mentioning implementers of `Copy`, `Debug` and friends is not useful.
return false;
}
let mut normalized_impl_candidates: Vec<_> = self
let normalized_impl_candidates: Vec<_> = self
.tcx
.all_impls(def_id)
// Ignore automatically derived impls and `!Trait` impls.
@ -1776,44 +1830,9 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
.filter_map(|def_id| self.tcx.impl_trait_ref(def_id))
// Avoid mentioning type parameters.
.filter(|trait_ref| !matches!(trait_ref.self_ty().kind(), ty::Param(_)))
.map(|trait_ref| format!("\n {}", trait_ref.self_ty()))
.collect();
normalized_impl_candidates.sort();
normalized_impl_candidates.dedup();
let len = normalized_impl_candidates.len();
if len == 0 {
return false;
return report(normalized_impl_candidates, err);
}
if len == 1 {
err.highlighted_help(vec![
(
format!(
"the trait `{}` is implemented for `",
trait_ref.print_only_trait_path()
),
Style::NoStyle,
),
(normalized_impl_candidates[0].trim().to_string(), Style::Highlight),
("`".to_string(), Style::NoStyle),
]);
return true;
}
let end = if normalized_impl_candidates.len() <= 9 {
normalized_impl_candidates.len()
} else {
8
};
err.help(&format!(
"the following other types implement trait `{}`:{}{}",
trait_ref.print_only_trait_path(),
normalized_impl_candidates[..end].join(""),
if len > 9 { format!("\nand {} others", len - 8) } else { String::new() }
));
return true;
}
let len = impl_candidates.len();
let end = if impl_candidates.len() <= 9 { impl_candidates.len() } else { 8 };
let normalize = |candidate| {
self.tcx.infer_ctxt().enter(|ref infcx| {
@ -1822,8 +1841,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
.normalize(candidate)
.ok();
match normalized {
Some(normalized) => format!("\n {}", normalized.value),
None => format!("\n {}", candidate),
Some(normalized) => normalized.value,
None => candidate,
}
})
};
@ -1834,7 +1853,6 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
//
// Prefer more similar candidates first, then sort lexicographically
// by their normalized string representation.
let first_candidate = impl_candidates.get(0).map(|candidate| candidate.trait_ref);
let mut normalized_impl_candidates_and_similarities = impl_candidates
.into_iter()
.map(|ImplCandidate { trait_ref, similarity }| {
@ -1850,26 +1868,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
.map(|(_, normalized)| normalized)
.collect::<Vec<_>>();
if normalized_impl_candidates.len() == 1 {
err.highlighted_help(vec![
(
format!(
"the trait `{}` is implemented for `",
first_candidate.unwrap().print_only_trait_path()
),
Style::NoStyle,
),
(first_candidate.unwrap().self_ty().to_string(), Style::Highlight),
("`".to_string(), Style::NoStyle),
]);
} else {
err.help(&format!(
"the following implementations were found:{}{}",
normalized_impl_candidates[..end].join(""),
if len > 9 { format!("\nand {} others", len - 8) } else { String::new() }
));
}
true
report(normalized_impl_candidates, err)
}
/// Gets the parent trait chain start

View file

@ -557,8 +557,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
} else if real_trait_pred != trait_pred {
// This branch addresses #87437.
let obligation =
self.mk_trait_obligation_with_new_self_ty(param_env, real_trait_pred, base_ty);
let obligation = self.mk_trait_obligation_with_new_self_ty(
param_env,
real_trait_pred,
base_ty,
);
if self.predicate_may_hold(&obligation) {
err.span_suggestion_verbose(
span.shrink_to_lo(),

View file

@ -5,15 +5,15 @@ LL | x * y
| ^ no implementation for `i32 * f32`
|
= help: the trait `Mul<f32>` is not implemented for `i32`
= help: the following implementations were found:
<&'a i32 as Mul<i32>>
<&i32 as Mul<&i32>>
<i32 as Mul<&i32>>
<i32 as Mul>
= help: the following other types implement trait `Mul`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
error: aborting due to previous error

View file

@ -16,15 +16,15 @@ LL | assert_eq!(foo, y);
| ^^^^^^^^^^^^^^^^^^ `for<'r> fn(&'r i32) -> &'r i32 {foo}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= help: the trait `Debug` is not implemented for `for<'r> fn(&'r i32) -> &'r i32 {foo}`
= help: the following implementations were found:
<extern "C" fn() -> Ret as Debug>
<extern "C" fn(A) -> Ret as Debug>
<extern "C" fn(A, ...) -> Ret as Debug>
<extern "C" fn(A, B) -> Ret as Debug>
<extern "C" fn(A, B, ...) -> Ret as Debug>
<extern "C" fn(A, B, C) -> Ret as Debug>
<extern "C" fn(A, B, C, ...) -> Ret as Debug>
<extern "C" fn(A, B, C, D) -> Ret as Debug>
= help: the following other types implement trait `Debug`:
extern "C" fn() -> Ret
extern "C" fn(A) -> Ret
extern "C" fn(A, ...) -> Ret
extern "C" fn(A, B) -> Ret
extern "C" fn(A, B, ...) -> Ret
extern "C" fn(A, B, C) -> Ret
extern "C" fn(A, B, C, ...) -> Ret
extern "C" fn(A, B, C, D) -> Ret
and 68 others
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -5,7 +5,7 @@ LL | 22 >> p.char;
| ^^ no implementation for `{integer} >> char`
|
= help: the trait `Shr<char>` is not implemented for `{integer}`
= help: the following implementations were found:
= help: the following other types implement trait `Shr`:
<&'a i128 as Shr<i128>>
<&'a i128 as Shr<i16>>
<&'a i128 as Shr<i32>>
@ -23,7 +23,7 @@ LL | 22 >> p.str;
| ^^ no implementation for `{integer} >> &str`
|
= help: the trait `Shr<&str>` is not implemented for `{integer}`
= help: the following implementations were found:
= help: the following other types implement trait `Shr`:
<&'a i128 as Shr<i128>>
<&'a i128 as Shr<i16>>
<&'a i128 as Shr<i32>>
@ -41,7 +41,7 @@ LL | 22 >> p;
| ^^ no implementation for `{integer} >> &Panolpy`
|
= help: the trait `Shr<&Panolpy>` is not implemented for `{integer}`
= help: the following implementations were found:
= help: the following other types implement trait `Shr`:
<&'a i128 as Shr<i128>>
<&'a i128 as Shr<i16>>
<&'a i128 as Shr<i32>>

View file

@ -4,9 +4,9 @@ error[E0277]: the trait bound `f32: Foo` is not satisfied
LL | gimme::<f32>();
| ^^^ the trait `Foo` is not implemented for `f32`
|
= help: the following implementations were found:
<i32 as Foo>
<u32 as Foo>
= help: the following other types implement trait `Foo`:
i32
u32
note: required by a bound in `gimme`
--> $DIR/chalk_initial_program.rs:9:13
|

View file

@ -6,9 +6,9 @@ LL | only_bar(x);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<i32 as Bar>
<u32 as Bar>
= help: the following other types implement trait `Bar`:
i32
u32
note: required by a bound in `only_bar`
--> $DIR/type_inference.rs:12:16
|

View file

@ -25,7 +25,7 @@ error[E0277]: the trait bound `u32: Traitor<N, N>` is not satisfied
LL | fn uwu<const N: u8>() -> impl Traitor<N> {
| ^^^^^^^^^^^^^^^ the trait `Traitor<N, N>` is not implemented for `u32`
|
= help: the following implementations were found:
= help: the following other types implement trait `Traitor<N, 2_u8>`:
<u32 as Traitor<N, 2_u8>>
<u64 as Traitor<1_u8, 2_u8>>
@ -50,9 +50,9 @@ error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied
LL | fn owo() -> impl Traitor {
| ^^^^^^^^^^^^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64`
|
= help: the following implementations were found:
<u64 as Traitor<1_u8, 2_u8>>
= help: the following other types implement trait `Traitor<N, 2_u8>`:
<u32 as Traitor<N, 2_u8>>
<u64 as Traitor<1_u8, 2_u8>>
error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied
--> $DIR/rp_impl_trait_fail.rs:24:26

View file

@ -4,7 +4,7 @@ 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 implementations were found:
= help: the following other types implement trait `Foo<0_u8>`:
<() as Foo<0_u8>>
<() as Foo<100_u8>>
<() as Foo<101_u8>>

View file

@ -4,9 +4,9 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
LL | <u8 as Baz>::Quaks: Bar,
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -16,9 +16,9 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
LL | [<u8 as Baz>::Quaks; 2]: Bar,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -28,9 +28,9 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:15:25
|
@ -46,9 +46,9 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:14:30
|
@ -64,9 +64,9 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
LL | fn f(_: impl Foo) {}
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:14:30
|
@ -82,9 +82,9 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
LL | fn f(_: impl Foo) {}
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:15:25
|

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `A<{_: usize}>: Bar<{_: usize}>` is not satisfied
LL | let _ = A;
| ^ the trait `Bar<{_: usize}>` is not implemented for `A<{_: usize}>`
|
= help: the trait `Bar<N>` is implemented for `A<{ 6 + 1 }>`
= help: the trait `Bar<N>` is implemented for `A<7_usize>`
note: required by a bound in `A`
--> $DIR/unused-substs-1.rs:9:11
|

View file

@ -11,15 +11,15 @@ LL | = [0; (i8::MAX + 1u8) as usize];
| ^ no implementation for `i8 + u8`
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following implementations were found:
<&'a i8 as Add<i8>>
<&i8 as Add<&i8>>
<i8 as Add<&i8>>
<i8 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 2 previous errors

View file

@ -11,15 +11,15 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
| ^ no implementation for `i8 + u8`
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following implementations were found:
<&'a i8 as Add<i8>>
<&i8 as Add<&i8>>
<i8 as Add<&i8>>
<i8 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0604]: only `u8` can be cast as `char`, not `i8`

View file

@ -21,7 +21,7 @@ LL | [5; Self::HOST_SIZE] == [6; 0]
| ^^ no implementation for `[{integer}; _] == [{integer}; 0]`
|
= help: the trait `PartialEq<[{integer}; 0]>` is not implemented for `[{integer}; _]`
= help: the following implementations were found:
= help: the following other types implement trait `PartialEq<[B; N]>`:
<&[B] as PartialEq<[A; N]>>
<&[T] as PartialEq<Vec<U, A>>>
<&mut [B] as PartialEq<[A; N]>>

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
LL | f1.foo(1usize);
| ^^^ the trait `Foo<usize>` is not implemented for `Bar`
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<i32>`:
<Bar as Foo<i32>>
<Bar as Foo<u8>>

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
LL | f1.foo(1usize);
| ^^^ the trait `Foo<usize>` is not implemented for `Bar`
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<i8>`:
<Bar as Foo<i16>>
<Bar as Foo<i32>>
<Bar as Foo<i8>>

View file

@ -6,7 +6,7 @@ LL | Foo::<i32>::bar(&1i8);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<bool>`:
<i8 as Foo<bool>>
<i8 as Foo<u16>>
<i8 as Foo<u32>>
@ -25,16 +25,16 @@ LL | Foo::<i32>::bar(&1u8);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<u8 as Foo<bool>>
<u8 as Foo<u16>>
<u8 as Foo<u32>>
<u8 as Foo<u64>>
= help: the following other types implement trait `Foo<bool>`:
<i8 as Foo<bool>>
<i8 as Foo<u16>>
<i8 as Foo<u32>>
<i8 as Foo<u64>>
<i8 as Foo<u8>>
<u8 as Foo<bool>>
<u8 as Foo<u16>>
<u8 as Foo<u32>>
<u8 as Foo<u64>>
error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:26:21
@ -44,7 +44,7 @@ LL | Foo::<i32>::bar(&true);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<bool>`:
<bool as Foo<bool>>
<bool as Foo<i8>>
<bool as Foo<u16>>

View file

@ -22,7 +22,7 @@ LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e11; // m³⋅kg⁻¹
| ^ no implementation for `{float} - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `{float}`
= help: the following implementations were found:
= help: the following other types implement trait `Sub`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'a> <_ as Trait>::Assoc<'a>: Marker` is not s
LL | test(Foo);
| ^^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>`
|
= help: the trait `for<'a> Marker` is implemented for `()`
= help: the trait `Marker` is implemented for `()`
note: required by a bound in `test`
--> $DIR/issue-88460.rs:17:27
|

View file

@ -24,15 +24,15 @@ LL | n + sum_to(n - 1)
| ^ no implementation for `u32 + impl Foo`
|
= help: the trait `Add<impl Foo>` is not implemented for `u32`
= help: the following implementations were found:
<&'a u32 as Add<u32>>
<&u32 as Add<&u32>>
<u32 as Add<&u32>>
<u32 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 2 previous errors; 1 warning emitted

View file

@ -5,7 +5,7 @@ LL | 1 +
| ^ no implementation for `{integer} + ()`
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following implementations were found:
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
@ -23,7 +23,7 @@ LL | 1 +
| ^ no implementation for `{integer} + ()`
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following implementations were found:
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>

View file

@ -5,15 +5,15 @@ LL | 1.0f64 - 1
| ^ no implementation for `f64 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Sub<f64>>
<&f64 as Sub<&f64>>
<f64 as Sub<&f64>>
<f64 as Sub>
= help: the following other types implement trait `Sub`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|

View file

@ -14,7 +14,7 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
| ^ no implementation for `{integer} + ()`
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following implementations were found:
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>

View file

@ -94,15 +94,15 @@ LL | assert_eq!(Foo::Bar, i);
| ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}`
= help: the following implementations were found:
<extern "C" fn() -> Ret as Debug>
<extern "C" fn(A) -> Ret as Debug>
<extern "C" fn(A, ...) -> Ret as Debug>
<extern "C" fn(A, B) -> Ret as Debug>
<extern "C" fn(A, B, ...) -> Ret as Debug>
<extern "C" fn(A, B, C) -> Ret as Debug>
<extern "C" fn(A, B, C, ...) -> Ret as Debug>
<extern "C" fn(A, B, C, D) -> Ret as Debug>
= help: the following other types implement trait `Debug`:
extern "C" fn() -> Ret
extern "C" fn(A) -> Ret
extern "C" fn(A, ...) -> Ret
extern "C" fn(A, B) -> Ret
extern "C" fn(A, B, ...) -> Ret
extern "C" fn(A, B, C) -> Ret
extern "C" fn(A, B, C, ...) -> Ret
extern "C" fn(A, B, C, D) -> Ret
and 68 others
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -4,15 +4,15 @@ error[E0277]: the trait bound `&'static mut isize: Copy` is not satisfied
LL | assert_copy::<&'static mut isize>();
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'static mut isize`
|
= help: the following implementations were found:
<isize as Copy>
<f32 as Copy>
<f64 as Copy>
<i128 as Copy>
<i16 as Copy>
<i32 as Copy>
<i64 as Copy>
<i8 as Copy>
= help: the following other types implement trait `Copy`:
f32
f64
i128
i16
i32
i64
i8
isize
and 6 others
note: required by a bound in `assert_copy`
--> $DIR/kindck-copy.rs:5:18
@ -26,15 +26,15 @@ error[E0277]: the trait bound `&'a mut isize: Copy` is not satisfied
LL | assert_copy::<&'a mut isize>();
| ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'a mut isize`
|
= help: the following implementations were found:
<isize as Copy>
<f32 as Copy>
<f64 as Copy>
<i128 as Copy>
<i16 as Copy>
<i32 as Copy>
<i64 as Copy>
<i8 as Copy>
= help: the following other types implement trait `Copy`:
f32
f64
i128
i16
i32
i64
i8
isize
and 6 others
note: required by a bound in `assert_copy`
--> $DIR/kindck-copy.rs:5:18

View file

@ -38,15 +38,15 @@ LL | if x == y {}
| ^^ no implementation for `&str == char`
|
= help: the trait `PartialEq<char>` is not implemented for `&str`
= help: the following implementations were found:
= help: the following other types implement trait `PartialEq<Cow<'a, str>>`:
<&'a str as PartialEq<OsString>>
<&'a str as PartialEq<String>>
<&'b str as PartialEq<Cow<'a, str>>>
<String as PartialEq<&'a str>>
<String as PartialEq<Cow<'a, str>>>
<String as PartialEq<str>>
<String as PartialEq>
<str as PartialEq<Cow<'a, str>>>
<str as PartialEq<OsStr>>
<str as PartialEq<OsString>>
<str as PartialEq<String>>
<str as PartialEq>
and 4 others
error[E0308]: mismatched types
@ -64,15 +64,15 @@ LL | if x == z {}
| ^^ no implementation for `&str == char`
|
= help: the trait `PartialEq<char>` is not implemented for `&str`
= help: the following implementations were found:
= help: the following other types implement trait `PartialEq<Cow<'a, str>>`:
<&'a str as PartialEq<OsString>>
<&'a str as PartialEq<String>>
<&'b str as PartialEq<Cow<'a, str>>>
<String as PartialEq<&'a str>>
<String as PartialEq<Cow<'a, str>>>
<String as PartialEq<str>>
<String as PartialEq>
<str as PartialEq<Cow<'a, str>>>
<str as PartialEq<OsStr>>
<str as PartialEq<OsString>>
<str as PartialEq<String>>
<str as PartialEq>
and 4 others
error: aborting due to 6 previous errors

View file

@ -5,7 +5,7 @@ LL | 1 + Some(1);
| ^ no implementation for `{integer} + Option<{integer}>`
|
= help: the trait `Add<Option<{integer}>>` is not implemented for `{integer}`
= help: the following implementations were found:
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
@ -23,15 +23,15 @@ LL | 2 as usize - Some(1);
| ^ no implementation for `usize - Option<{integer}>`
|
= help: the trait `Sub<Option<{integer}>>` is not implemented for `usize`
= help: the following implementations were found:
<&'a usize as Sub<usize>>
<&usize as Sub<&usize>>
<usize as Sub<&usize>>
<usize as Sub>
= help: the following other types implement trait `Sub`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
error[E0277]: cannot multiply `{integer}` by `()`
@ -41,7 +41,7 @@ LL | 3 * ();
| ^ no implementation for `{integer} * ()`
|
= help: the trait `Mul<()>` is not implemented for `{integer}`
= help: the following implementations were found:
= help: the following other types implement trait `Mul`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
@ -59,7 +59,7 @@ LL | 4 / "";
| ^ no implementation for `{integer} / &str`
|
= help: the trait `Div<&str>` is not implemented for `{integer}`
= help: the following implementations were found:
= help: the following other types implement trait `Div`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
@ -77,15 +77,15 @@ LL | 5 < String::new();
| ^ no implementation for `{integer} < String` and `{integer} > String`
|
= help: the trait `PartialOrd<String>` is not implemented for `{integer}`
= help: the following implementations were found:
<f32 as PartialOrd>
<f64 as PartialOrd>
<i128 as PartialOrd>
<i16 as PartialOrd>
<i32 as PartialOrd>
<i64 as PartialOrd>
<i8 as PartialOrd>
<isize as PartialOrd>
= help: the following other types implement trait `PartialOrd`:
f32
f64
i128
i16
i32
i64
i8
isize
and 6 others
error[E0277]: can't compare `{integer}` with `Result<{integer}, _>`
@ -95,15 +95,15 @@ LL | 6 == Ok(1);
| ^^ no implementation for `{integer} == Result<{integer}, _>`
|
= help: the trait `PartialEq<Result<{integer}, _>>` is not implemented for `{integer}`
= help: the following implementations were found:
<f32 as PartialEq>
<f64 as PartialEq>
<i128 as PartialEq>
<i16 as PartialEq>
<i32 as PartialEq>
<i64 as PartialEq>
<i8 as PartialEq>
<isize as PartialEq>
= help: the following other types implement trait `PartialEq`:
f32
f64
i128
i16
i32
i64
i8
isize
and 6 others
error: aborting due to 6 previous errors

View file

@ -5,15 +5,15 @@ LL | 2_usize + (loop {});
| ^ no implementation for `usize + ()`
|
= help: the trait `Add<()>` is not implemented for `usize`
= help: the following implementations were found:
<&'a usize as Add<usize>>
<&usize as Add<&usize>>
<usize as Add<&usize>>
<usize as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to previous error

View file

@ -5,15 +5,15 @@ LL | x + 100.0
| ^ no implementation for `u8 + {float}`
|
= help: the trait `Add<{float}>` is not implemented for `u8`
= help: the following implementations were found:
<&'a u8 as Add<u8>>
<&u8 as Add<&u8>>
<u8 as Add<&u8>>
<u8 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0277]: cannot add `&str` to `f64`
@ -23,15 +23,15 @@ LL | x + "foo"
| ^ no implementation for `f64 + &str`
|
= help: the trait `Add<&str>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Add<f64>>
<&f64 as Add<&f64>>
<f64 as Add<&f64>>
<f64 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0277]: cannot add `{integer}` to `f64`
@ -41,15 +41,15 @@ LL | x + y
| ^ no implementation for `f64 + {integer}`
|
= help: the trait `Add<{integer}>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Add<f64>>
<&f64 as Add<&f64>>
<f64 as Add<&f64>>
<f64 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0277]: cannot subtract `{float}` from `u8`
@ -59,15 +59,15 @@ LL | x - 100.0
| ^ no implementation for `u8 - {float}`
|
= help: the trait `Sub<{float}>` is not implemented for `u8`
= help: the following implementations were found:
<&'a u8 as Sub<u8>>
<&u8 as Sub<&u8>>
<u8 as Sub<&u8>>
<u8 as Sub>
= help: the following other types implement trait `Sub`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
error[E0277]: cannot subtract `&str` from `f64`
@ -77,15 +77,15 @@ LL | x - "foo"
| ^ no implementation for `f64 - &str`
|
= help: the trait `Sub<&str>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Sub<f64>>
<&f64 as Sub<&f64>>
<f64 as Sub<&f64>>
<f64 as Sub>
= help: the following other types implement trait `Sub`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
error[E0277]: cannot subtract `{integer}` from `f64`
@ -95,15 +95,15 @@ LL | x - y
| ^ no implementation for `f64 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Sub<f64>>
<&f64 as Sub<&f64>>
<f64 as Sub<&f64>>
<f64 as Sub>
= help: the following other types implement trait `Sub`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
error[E0277]: cannot multiply `u8` by `{float}`
@ -113,15 +113,15 @@ LL | x * 100.0
| ^ no implementation for `u8 * {float}`
|
= help: the trait `Mul<{float}>` is not implemented for `u8`
= help: the following implementations were found:
<&'a u8 as Mul<u8>>
<&u8 as Mul<&u8>>
<u8 as Mul<&u8>>
<u8 as Mul>
= help: the following other types implement trait `Mul`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
error[E0277]: cannot multiply `f64` by `&str`
@ -131,15 +131,15 @@ LL | x * "foo"
| ^ no implementation for `f64 * &str`
|
= help: the trait `Mul<&str>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Mul<f64>>
<&f64 as Mul<&f64>>
<f64 as Mul<&f64>>
<f64 as Mul>
= help: the following other types implement trait `Mul`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
error[E0277]: cannot multiply `f64` by `{integer}`
@ -149,15 +149,15 @@ LL | x * y
| ^ no implementation for `f64 * {integer}`
|
= help: the trait `Mul<{integer}>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Mul<f64>>
<&f64 as Mul<&f64>>
<f64 as Mul<&f64>>
<f64 as Mul>
= help: the following other types implement trait `Mul`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
error[E0277]: cannot divide `u8` by `{float}`
@ -167,15 +167,15 @@ LL | x / 100.0
| ^ no implementation for `u8 / {float}`
|
= help: the trait `Div<{float}>` is not implemented for `u8`
= help: the following implementations were found:
<&'a u8 as Div<u8>>
<&u8 as Div<&u8>>
<u8 as Div<&u8>>
<u8 as Div<NonZeroU8>>
<u8 as Div>
= help: the following other types implement trait `Div`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
error[E0277]: cannot divide `f64` by `&str`
@ -185,15 +185,15 @@ LL | x / "foo"
| ^ no implementation for `f64 / &str`
|
= help: the trait `Div<&str>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Div<f64>>
<&f64 as Div<&f64>>
<f64 as Div<&f64>>
<f64 as Div>
= help: the following other types implement trait `Div`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
error[E0277]: cannot divide `f64` by `{integer}`
@ -203,15 +203,15 @@ LL | x / y
| ^ no implementation for `f64 / {integer}`
|
= help: the trait `Div<{integer}>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Div<f64>>
<&f64 as Div<&f64>>
<f64 as Div<&f64>>
<f64 as Div>
= help: the following other types implement trait `Div`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
error: aborting due to 12 previous errors

View file

@ -5,15 +5,15 @@ LL | x + 100
| ^ no implementation for `f32 + {integer}`
|
= help: the trait `Add<{integer}>` is not implemented for `f32`
= help: the following implementations were found:
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&f32 as Add<&f32>>
<f32 as Add<&f32>>
<f32 as Add>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|
@ -27,15 +27,15 @@ LL | x + 100
| ^ no implementation for `f64 + {integer}`
|
= help: the trait `Add<{integer}>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Add<f64>>
<&f64 as Add<&f64>>
<f64 as Add<&f64>>
<f64 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|
@ -49,15 +49,15 @@ LL | x - 100
| ^ no implementation for `f32 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f32`
= help: the following implementations were found:
= help: the following other types implement trait `Sub`:
<&'a f32 as Sub<f32>>
<&f32 as Sub<&f32>>
<f32 as Sub<&f32>>
<f32 as Sub>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|
@ -71,15 +71,15 @@ LL | x - 100
| ^ no implementation for `f64 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Sub<f64>>
<&f64 as Sub<&f64>>
<f64 as Sub<&f64>>
<f64 as Sub>
= help: the following other types implement trait `Sub`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|
@ -93,15 +93,15 @@ LL | x * 100
| ^ no implementation for `f32 * {integer}`
|
= help: the trait `Mul<{integer}>` is not implemented for `f32`
= help: the following implementations were found:
= help: the following other types implement trait `Mul`:
<&'a f32 as Mul<f32>>
<&f32 as Mul<&f32>>
<f32 as Mul<&f32>>
<f32 as Mul>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
help: consider using a floating-point literal by writing it with `.0`
|
@ -115,15 +115,15 @@ LL | x * 100
| ^ no implementation for `f64 * {integer}`
|
= help: the trait `Mul<{integer}>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Mul<f64>>
<&f64 as Mul<&f64>>
<f64 as Mul<&f64>>
<f64 as Mul>
= help: the following other types implement trait `Mul`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
help: consider using a floating-point literal by writing it with `.0`
|
@ -137,15 +137,15 @@ LL | x / 100
| ^ no implementation for `f32 / {integer}`
|
= help: the trait `Div<{integer}>` is not implemented for `f32`
= help: the following implementations were found:
= help: the following other types implement trait `Div`:
<&'a f32 as Div<f32>>
<&f32 as Div<&f32>>
<f32 as Div<&f32>>
<f32 as Div>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
help: consider using a floating-point literal by writing it with `.0`
|
@ -159,15 +159,15 @@ LL | x / 100
| ^ no implementation for `f64 / {integer}`
|
= help: the trait `Div<{integer}>` is not implemented for `f64`
= help: the following implementations were found:
<&'a f64 as Div<f64>>
<&f64 as Div<&f64>>
<f64 as Div<&f64>>
<f64 as Div>
= help: the following other types implement trait `Div`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
help: consider using a floating-point literal by writing it with `.0`
|

View file

@ -7,7 +7,7 @@ LL | Index::index(&[] as &[i32], 2u32);
| required by a bound introduced by this call
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the following implementations were found:
= help: the following other types implement trait `Index<Foo<usize>>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
@ -20,7 +20,7 @@ LL | Index::index(&[] as &[i32], Foo(2u32));
| required by a bound introduced by this call
|
= help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
= help: the following implementations were found:
= help: the following other types implement trait `Index<Foo<usize>>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
@ -33,7 +33,7 @@ LL | Index::index(&[] as &[i32], Bar(2u32));
| required by a bound introduced by this call
|
= help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
= help: the following implementations were found:
= help: the following other types implement trait `Index<Foo<usize>>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
@ -44,7 +44,7 @@ LL | Index::index(&[] as &[i32], 2u32);
| ^^^^^^^^^^^^ trait message
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the following implementations were found:
= help: the following other types implement trait `Index<Foo<usize>>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
@ -55,7 +55,7 @@ LL | Index::index(&[] as &[i32], Foo(2u32));
| ^^^^^^^^^^^^ on impl for Foo
|
= help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
= help: the following implementations were found:
= help: the following other types implement trait `Index<Foo<usize>>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
@ -66,7 +66,7 @@ LL | Index::index(&[] as &[i32], Bar(2u32));
| ^^^^^^^^^^^^ on impl for Bar
|
= help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
= help: the following implementations were found:
= help: the following other types implement trait `Index<Foo<usize>>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>

View file

@ -15,7 +15,7 @@ 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 implementations were found:
= help: the following other types implement trait `SliceIndex<str>`:
<RangeTo<usize> as SliceIndex<[T]>>
<RangeTo<usize> as SliceIndex<str>>
= note: required because of the requirements on the impl of `Index<RangeTo<i32>>` for `[i32]`

View file

@ -9,10 +9,10 @@ LL | | }
| |_^ `main` can only return types that implement `Termination`
|
= help: the trait `Termination` is not implemented for `Result<f32, ParseFloatError>`
= help: the following implementations were found:
<Result<!, E> as Termination>
<Result<(), E> as Termination>
<Result<Infallible, E> as Termination>
= help: the following other types implement trait `Termination`:
Result<!, E>
Result<(), E>
Result<Infallible, E>
note: required by a bound in `assert_test_result`
--> $SRC_DIR/test/src/lib.rs:LL:COL
|

View file

@ -5,15 +5,15 @@ LL | foo(1 as u32 +
| ^ no implementation for `u32 + ()`
|
= help: the trait `Add<()>` is not implemented for `u32`
= help: the following implementations were found:
<&'a u32 as Add<u32>>
<&u32 as Add<&u32>>
<u32 as Add<&u32>>
<u32 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to previous error

View file

@ -7,7 +7,7 @@ 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 implementations were found:
= help: the following other types implement trait `From<char>`:
<String as From<&String>>
<String as From<&mut str>>
<String as From<&str>>

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied
LL | let _: &[i8] = data.into();
| ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`
|
= help: the following implementations were found:
= help: the following other types implement trait `From<Mask<T, LANES>>`:
<[T; LANES] as From<Simd<T, LANES>>>
<[bool; LANES] as From<Mask<T, LANES>>>
= note: required because of the requirements on the impl of `Into<&[i8]>` for `&[u8]`

View file

@ -4,7 +4,7 @@ fn strip_lf(s: &str) -> &str {
//~| NOTE expected an `FnMut<(char,)>` closure, found `u8`
//~| NOTE required by a bound introduced by this call
//~| HELP the trait `FnMut<(char,)>` is not implemented for `u8`
//~| HELP the following other types implement trait `Pattern<'_>`:
//~| HELP the following other types implement trait `Pattern<'a>`:
//~| NOTE required because of the requirements on the impl of `Pattern<'_>` for `u8`
}

View file

@ -7,7 +7,7 @@ LL | s.strip_suffix(b'\n').unwrap_or(s)
| required by a bound introduced by this call
|
= help: the trait `FnMut<(char,)>` is not implemented for `u8`
= help: the following other types implement trait `Pattern<'_>`:
= help: the following other types implement trait `Pattern<'a>`:
&'b String
&'b [char; N]
&'b [char]

View file

@ -4,7 +4,9 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfi
LL | c.same_as(22)
| ^^^^^^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
|
= help: the trait `CompareTo<i32>` is implemented for `i64`
= help: the following other types implement trait `CompareTo<i64>`:
<i64 as CompareTo<i64>>
<i64 as CompareTo<u64>>
error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
--> $DIR/repeated-supertrait-ambig.rs:30:7
@ -23,7 +25,9 @@ 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 trait `CompareTo<i32>` is implemented for `i64`
= help: the following other types implement trait `CompareTo<i64>`:
<i64 as CompareTo<i64>>
<i64 as CompareTo<u64>>
error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
--> $DIR/repeated-supertrait-ambig.rs:38:5
@ -42,7 +46,7 @@ error[E0277]: the trait bound `i64: CompareTo<i32>` is not satisfied
LL | assert_eq!(22_i64.same_as(22), true);
| ^^^^^^^ the trait `CompareTo<i32>` is not implemented for `i64`
|
= help: the following implementations were found:
= help: the following other types implement trait `CompareTo<i64>`:
<i64 as CompareTo<i64>>
<i64 as CompareTo<u64>>

View file

@ -7,10 +7,10 @@ LL | struct Foo<'a, T> {
LL | bar: &'a mut T
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&mut T`
|
= help: the following implementations were found:
<&T as Clone>
<*const T as Clone>
<*mut T as Clone>
= help: the following other types implement trait `Clone`:
&T
*const T
*mut T
= note: `Clone` is implemented for `&T`, but not for `&mut T`
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `Box<dyn Map<isize, isize>>: Map<usize, isize>` is
LL | let y: Box<dyn Map<usize, isize>> = Box::new(x);
| ^^^^^^^^^^^ the trait `Map<usize, isize>` is not implemented for `Box<dyn Map<isize, isize>>`
|
= help: the trait `Map<usize, isize>` is implemented for `HashMap<K, V>`
= help: the trait `Map<K, V>` is implemented for `HashMap<K, V>`
= note: required for the cast to the object type `dyn Map<usize, isize>`
error: aborting due to previous error

View file

@ -7,15 +7,15 @@ LL | Ok(Err(123_i32)?)
| ^ the trait `From<i32>` is not implemented for `u8`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following implementations were found:
<u8 as From<NonZeroU8>>
<u8 as From<bool>>
= help: the following other types implement trait `From<bool>`:
<f32 as From<i16>>
<f32 as From<i8>>
<f32 as From<u16>>
<f32 as From<u8>>
<f64 as From<f32>>
<f64 as From<i16>>
<f64 as From<i32>>
<f64 as From<i8>>
and 67 others
= note: required because of the requirements on the impl of `FromResidual<Result<Infallible, i32>>` for `Result<u64, u8>`

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied
LL | fn foo() -> impl Foo<FooX> {
| ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()`
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<u32>`:
<() as Foo<()>>
<() as Foo<u32>>

View file

@ -65,15 +65,15 @@ LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
| ^^^^^^^ no implementation for `i32 + u8`
|
= help: the trait `Add<u8>` is not implemented for `i32`
= help: the following implementations were found:
<&'a i32 as Add<i32>>
<&i32 as Add<&i32>>
<i32 as Add<&i32>>
<i32 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 7 previous errors

View file

@ -20,15 +20,15 @@ LL | a = c + b * 5;
| ^ no implementation for `usize + u16`
|
= help: the trait `Add<u16>` is not implemented for `usize`
= help: the following implementations were found:
<&'a usize as Add<usize>>
<&usize as Add<&usize>>
<usize as Add<&usize>>
<usize as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 3 previous errors

View file

@ -6,7 +6,7 @@ LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world")
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
= help: the following other types implement trait `From<Box<Path>>`:
<PathBuf as From<&T>>
<PathBuf as From<Box<Path>>>
<PathBuf as From<Cow<'a, Path>>>

View file

@ -5,15 +5,15 @@ LL | <i32 as Add<u32>>::add(1, 2);
| ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32`
|
= help: the trait `Add<u32>` is not implemented for `i32`
= help: the following implementations were found:
<&'a i32 as Add<i32>>
<&i32 as Add<&i32>>
<i32 as Add<&i32>>
<i32 as Add>
= help: the following other types implement trait `Add`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0308]: mismatched types