Use trait name instead of full constraint in suggestion message

```
help: consider restricting type parameter `T` with traits `Copy` and `Trait`
   |
LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) {
   |                      ++++++++++++++
```

```
help: consider restricting type parameter `V` with trait `Copy`
   |
LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V {
   |                  +++++++++++++++++++
```
This commit is contained in:
Esteban Küber 2024-11-28 20:22:46 +00:00
parent 568b0ac624
commit 3f2a63a68b
99 changed files with 229 additions and 191 deletions

View File

@ -4,7 +4,9 @@ use std::fmt::Write;
use std::ops::ControlFlow;
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{Applicability, Diag, DiagArgValue, IntoDiagArg, into_diag_arg_using_display};
use rustc_errors::{
Applicability, Diag, DiagArgValue, IntoDiagArg, into_diag_arg_using_display, pluralize,
};
use rustc_hir::def::DefKind;
use rustc_hir::def_id::DefId;
use rustc_hir::{self as hir, LangItem, PredicateOrigin, WherePredicateKind};
@ -288,7 +290,11 @@ pub fn suggest_constraining_type_params<'a>(
None => true,
};
if stable || tcx.sess.is_nightly_build() {
grouped.entry(param_name).or_insert(Vec::new()).push((constraint, def_id));
grouped.entry(param_name).or_insert(Vec::new()).push((
constraint,
def_id,
if stable { "" } else { "unstable " },
));
if !stable {
unstable_suggestion = true;
}
@ -303,10 +309,10 @@ pub fn suggest_constraining_type_params<'a>(
let Some(param) = param else { return false };
{
let mut sized_constraints = constraints.extract_if(|(_, def_id)| {
let mut sized_constraints = constraints.extract_if(|(_, def_id, _)| {
def_id.is_some_and(|def_id| tcx.is_lang_item(def_id, LangItem::Sized))
});
if let Some((_, def_id)) = sized_constraints.next() {
if let Some((_, def_id, _)) = sized_constraints.next() {
applicability = Applicability::MaybeIncorrect;
err.span_label(param.span, "this type parameter needs to be `Sized`");
@ -325,15 +331,52 @@ pub fn suggest_constraining_type_params<'a>(
.collect();
constraints
.retain(|(_, def_id)| def_id.map_or(true, |def| !bound_trait_defs.contains(&def)));
.retain(|(_, def_id, _)| def_id.map_or(true, |def| !bound_trait_defs.contains(&def)));
if constraints.is_empty() {
continue;
}
let mut constraint = constraints.iter().map(|&(c, _)| c).collect::<Vec<_>>();
let mut constraint = constraints.iter().map(|&(c, _, _)| c).collect::<Vec<_>>();
constraint.sort();
constraint.dedup();
let all_stable = constraints.iter().all(|&(_, _, stable)| stable.is_empty());
let all_unstable = constraints.iter().all(|&(_, _, stable)| !stable.is_empty());
let post = if all_stable || all_unstable {
// Don't redundantly say "trait `X`, trait `Y`", instead "traits `X` and `Y`"
let mut trait_names = constraints
.iter()
.map(|&(c, def_id, _)| match def_id {
None => format!("`{c}`"),
Some(def_id) => format!("`{}`", tcx.item_name(def_id)),
})
.collect::<Vec<_>>();
trait_names.sort();
trait_names.dedup();
let n = trait_names.len();
let stable = if all_stable { "" } else { "unstable " };
format!("{stable}trait{} {}", pluralize!(n), match &trait_names[..] {
[t] => t.to_string(),
[ts @ .., last] => format!("{} and {last}", ts.join(", ")),
[] => return false,
},)
} else {
// We're more explicit when there's a mix of stable and unstable traits.
let mut trait_names = constraints
.iter()
.map(|&(c, def_id, stable)| match def_id {
None => format!("{stable}trait `{c}`"),
Some(def_id) => format!("{stable}trait `{}`", tcx.item_name(def_id)),
})
.collect::<Vec<_>>();
trait_names.sort();
trait_names.dedup();
match &trait_names[..] {
[t] => t.to_string(),
[ts @ .., last] => format!("{} and {last}", ts.join(", ")),
[] => return false,
}
};
let constraint = constraint.join(" + ");
let mut suggest_restrict = |span, bound_list_non_empty, open_paren_sp| {
let suggestion = if span_to_replace.is_some() {
@ -351,18 +394,18 @@ pub fn suggest_constraining_type_params<'a>(
if let Some(open_paren_sp) = open_paren_sp {
suggestions.push((
open_paren_sp,
constraint.clone(),
post.clone(),
"(".to_string(),
RestrictBoundFurther,
));
suggestions.push((
span,
constraint.clone(),
post.clone(),
format!("){suggestion}"),
RestrictBoundFurther,
));
} else {
suggestions.push((span, constraint.clone(), suggestion, RestrictBoundFurther));
suggestions.push((span, post.clone(), suggestion, RestrictBoundFurther));
}
};
@ -420,8 +463,8 @@ pub fn suggest_constraining_type_params<'a>(
// - insert: `, X: Bar`
suggestions.push((
generics.tail_span_for_predicate_suggestion(),
constraint.clone(),
constraints.iter().fold(String::new(), |mut string, &(constraint, _)| {
post,
constraints.iter().fold(String::new(), |mut string, &(constraint, _, _)| {
write!(string, ", {param_name}: {constraint}").unwrap();
string
}),
@ -450,7 +493,7 @@ pub fn suggest_constraining_type_params<'a>(
// default (`<T=Foo>`), so we suggest adding `where T: Bar`.
suggestions.push((
generics.tail_span_for_predicate_suggestion(),
constraint.clone(),
post,
format!("{where_prefix} {param_name}: {constraint}"),
SuggestChangingConstraintsMessage::RestrictTypeFurther { ty: param_name },
));
@ -464,7 +507,7 @@ pub fn suggest_constraining_type_params<'a>(
if let Some(colon_span) = param.colon_span {
suggestions.push((
colon_span.shrink_to_hi(),
constraint.clone(),
post,
format!(" {constraint}"),
SuggestChangingConstraintsMessage::RestrictType { ty: param_name },
));
@ -477,7 +520,7 @@ pub fn suggest_constraining_type_params<'a>(
// - help: consider restricting this type parameter with `T: Foo`
suggestions.push((
param.span.shrink_to_hi(),
constraint.clone(),
post,
format!(": {constraint}"),
SuggestChangingConstraintsMessage::RestrictType { ty: param_name },
));
@ -490,21 +533,16 @@ pub fn suggest_constraining_type_params<'a>(
.collect::<Vec<_>>();
let suggested = !suggestions.is_empty();
if suggestions.len() == 1 {
let (span, constraint, suggestion, msg) = suggestions.pop().unwrap();
let post = format!(
" with {}trait{} `{constraint}`",
if unstable_suggestion { "unstable " } else { "" },
if constraint.contains('+') { "s" } else { "" },
);
let (span, post, suggestion, msg) = suggestions.pop().unwrap();
let msg = match msg {
SuggestChangingConstraintsMessage::RestrictBoundFurther => {
format!("consider further restricting this bound{post}")
format!("consider further restricting this bound with {post}")
}
SuggestChangingConstraintsMessage::RestrictType { ty } => {
format!("consider restricting type parameter `{ty}`{post}")
format!("consider restricting type parameter `{ty}` with {post}")
}
SuggestChangingConstraintsMessage::RestrictTypeFurther { ty } => {
format!("consider further restricting type parameter `{ty}`{post}")
format!("consider further restricting type parameter `{ty}` with {post}")
}
SuggestChangingConstraintsMessage::RemoveMaybeUnsized => {
format!("consider removing the `?Sized` bound to make the type parameter `Sized`")

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `C: Bar<5>` is not satisfied
LL | pub struct Structure<C: Tec> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C`
|
help: consider further restricting this bound with trait `Bar<5>`
help: consider further restricting this bound with trait `Bar`
|
LL | pub struct Structure<C: Tec + Bar<5>> {
| ++++++++
@ -15,7 +15,7 @@ error[E0277]: the trait bound `C: Bar<5>` is not satisfied
LL | _field: C::BarType,
| ^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C`
|
help: consider further restricting this bound with trait `Bar<5>`
help: consider further restricting this bound with trait `Bar`
|
LL | pub struct Structure<C: Tec + Bar<5>> {
| ++++++++

View File

@ -47,7 +47,7 @@ note: required by a bound in `Foo::Bar`
|
LL | type Bar: Clone = Vec<T>;
| ^^^^^ required by this bound in `Foo::Bar`
help: consider restricting type parameter `T` with trait `std::clone::Clone`
help: consider restricting type parameter `T` with trait `Clone`
|
LL | trait Foo<T: std::clone::Clone> {
| +++++++++++++++++++
@ -132,7 +132,7 @@ LL | Self::Baz: Clone,
...
LL | type Baz = T;
| --- required by a bound in this associated type
help: consider further restricting type parameter `T` with trait `std::clone::Clone`
help: consider further restricting type parameter `T` with trait `Clone`
|
LL | Self::Baz: Clone, T: std::clone::Clone
| ~~~~~~~~~~~~~~~~~~~~~~

View File

@ -47,7 +47,7 @@ note: required by a bound in `Foo::Bar`
|
LL | type Bar: Clone = Vec<T>;
| ^^^^^ required by this bound in `Foo::Bar`
help: consider restricting type parameter `T` with trait `std::clone::Clone`
help: consider restricting type parameter `T` with trait `Clone`
|
LL | trait Foo<T: std::clone::Clone> {
| +++++++++++++++++++
@ -132,7 +132,7 @@ LL | Self::Baz: Clone,
...
LL | type Baz = T;
| --- required by a bound in this associated type
help: consider further restricting type parameter `T` with trait `std::clone::Clone`
help: consider further restricting type parameter `T` with trait `Clone`
|
LL | Self::Baz: Clone, T: std::clone::Clone
| ~~~~~~~~~~~~~~~~~~~~~~

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'b> T: X<'b, T>` is not satisfied
LL | impl<S, T> X<'_, T> for (S,) {
| ^^^^^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T`
|
help: consider restricting type parameter `T` with trait `for<'b> X<'b, T>`
help: consider restricting type parameter `T` with trait `X`
|
LL | impl<S, T: for<'b> X<'b, T>> X<'_, T> for (S,) {
| ++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `copy`
|
LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
| ^^^^^ required by this bound in `copy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T {
| +++++++++++++++++++

View File

@ -14,7 +14,7 @@ note: required by a bound in `Complete::Assoc`
|
LL | type Assoc: Partial<Self>;
| ^^^^^^^^^^^^^ required by this bound in `Complete::Assoc`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> Complete for T {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: captured value is not `Send`
|
LL | async { (ty, ty1) }
| ^^^ has type `U` which is not `Send`
help: consider restricting type parameter `U` with trait `std::marker::Send`
help: consider restricting type parameter `U` with trait `Send`
|
LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| +++++++++++++++++++

View File

@ -14,7 +14,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless
LL | let x = x;
| ^ has type `&T` which is not `Send`, because `T` is not `Sync`
= note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 18:27}>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
help: consider further restricting this bound with trait `std::marker::Sync`
help: consider further restricting this bound with trait `Sync`
|
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
| +++++++++++++++++++

View File

@ -6,7 +6,7 @@ LL | val == val
| |
| MyType<T>
|
help: consider further restricting this bound with trait `std::cmp::Eq`
help: consider further restricting this bound with trait `Eq`
|
LL | fn cond<T: PartialEq + std::cmp::Eq>(val: MyType<T>) -> bool {
| ++++++++++++++

View File

@ -10,7 +10,7 @@ note: required by a bound in `Foo`
|
LL | trait Foo : Send+Sync { }
| ^^^^ required by this bound in `Foo`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | impl <T: Sync+'static + std::marker::Send> Foo for (T,) { }
| +++++++++++++++++++
@ -27,7 +27,7 @@ note: required by a bound in `Foo`
|
LL | trait Foo : Send+Sync { }
| ^^^^ required by this bound in `Foo`
help: consider further restricting this bound with trait `std::marker::Sync`
help: consider further restricting this bound with trait `Sync`
|
LL | impl <T: Send + std::marker::Sync> Foo for (T,T) { }
| +++++++++++++++++++

View File

@ -14,7 +14,7 @@ note: required by a bound in `RequiresRequiresShareAndSend`
|
LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
| ^^^^ required by this bound in `RequiresRequiresShareAndSend`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | impl <T:Sync+'static + std::marker::Send> RequiresRequiresShareAndSend for X<T> { }
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `Foo`
|
LL | trait Foo : Send { }
| ^^^^ required by this bound in `Foo`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | impl <T: Sync+'static + std::marker::Send> Foo for T { }
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `X`
|
LL | struct X<F> where F: FnOnce() + 'static + Send {
| ^^^^ required by this bound in `X`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send {
| +++++++++++++++++++
@ -25,7 +25,7 @@ note: required by a bound in `X`
|
LL | struct X<F> where F: FnOnce() + 'static + Send {
| ^^^^ required by this bound in `X`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send {
| +++++++++++++++++++

View File

@ -15,7 +15,7 @@ help: use parentheses to call this type parameter
|
LL | take_const_owned(f());
| ++
help: consider further restricting this bound with trait `std::marker::Sync`
help: consider further restricting this bound with trait `Sync`
|
LL | fn give_owned<F>(f: F) where F: FnOnce() + Send + std::marker::Sync {
| +++++++++++++++++++

View File

@ -7,7 +7,7 @@ LL | [x; { N }]
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
| +++++++++++++++++++

View File

@ -7,7 +7,7 @@ LL | [x; N]
= note: the `Copy` trait is required because this value will be copied for each element of the array
= help: consider using `core::array::from_fn` to initialize the array
= help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
| +++++++++++++++++++

View File

@ -12,7 +12,7 @@ LL | fn unsatisfied(self)
LL | where
LL | T: Bar<N>,
| ^^^^^^ required by this bound in `Foo::<T, N>::unsatisfied`
help: consider restricting type parameter `T` with trait `Bar<N>`
help: consider restricting type parameter `T` with trait `Bar`
|
LL | impl<T: Bar<N>, const N: usize> Foo<T, N> {
| ++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `DropMe`
|
LL | struct DropMe<T: Copy>(T);
| ^^^^ required by this bound in `DropMe`
help: consider further restricting type parameter `T` with trait `std::marker::Copy`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
| ~~~~~~~~~~~~~~~~~~~~~~
@ -25,7 +25,7 @@ note: required by a bound in `DropMe`
|
LL | struct DropMe<T: Copy>(T);
| ^^^^ required by this bound in `DropMe`
help: consider further restricting type parameter `T` with trait `std::marker::Copy`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
| ~~~~~~~~~~~~~~~~~~~~~~

View File

@ -9,7 +9,7 @@ note: required by a bound in `DropMe`
|
LL | struct DropMe<T: Copy>(T);
| ^^^^ required by this bound in `DropMe`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> Drop for DropMe<T>
| +++++++++++++++++++
@ -25,7 +25,7 @@ note: required by a bound in `DropMe`
|
LL | struct DropMe<T: Copy>(T);
| ^^^^ required by this bound in `DropMe`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> Drop for DropMe<T>
| +++++++++++++++++++

View File

@ -73,7 +73,7 @@ note: required by a bound in `want`
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q` with trait `std::iter::Iterator`
help: consider restricting type parameter `Q` with trait `Iterator`
|
LL | fn example<Q: std::iter::Iterator>(q: Q) {
| +++++++++++++++++++++
@ -100,7 +100,7 @@ note: required by a bound in `want`
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q` with trait `std::iter::Iterator`
help: consider restricting type parameter `Q` with trait `Iterator`
|
LL | fn example<Q: std::iter::Iterator>(q: Q) {
| +++++++++++++++++++++

View File

@ -5,7 +5,7 @@ LL | type Assoc2<T> = Vec<T>;
| ^^^^^^ `T` cannot be formatted with the default formatter
|
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
help: consider restricting type parameter `T` with trait `std::fmt::Display`
help: consider restricting type parameter `T` with trait `Display`
|
LL | type Assoc2<T: std::fmt::Display> = Vec<T>;
| +++++++++++++++++++

View File

@ -41,7 +41,7 @@ LL | trait Foo {
LL | type C where Self: Clone;
| ^ this trait's associated type doesn't have the requirement `Fooy<T>: Copy`
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
| +++++++++++++++++++
@ -66,7 +66,7 @@ LL | trait Foo {
LL | fn d() where Self: Clone;
| ^ this trait's method doesn't have the requirement `Fooy<T>: Copy`
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `UnsafeCopy::Item`
|
LL | type Item<'a>: Copy;
| ^^^^ required by this bound in `UnsafeCopy::Item`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> UnsafeCopy for T {
| +++++++++++++++++++

View File

@ -10,7 +10,7 @@ note: required by a bound in `Fun::F`
|
LL | type F<'a>: Fn() -> u32;
| ^^^^^^^^^^^ required by this bound in `Fun::F`
help: consider restricting type parameter `T` with trait `Fn()`
help: consider restricting type parameter `T` with trait `Fn`
|
LL | impl<T: Fn()> Fun for T {
| ++++++

View File

@ -10,7 +10,7 @@ note: required by a bound in `Fun::F`
|
LL | type F<'a>: Fn() -> u32;
| ^^^^^^^^^^^ required by this bound in `Fun::F`
help: consider restricting type parameter `T` with trait `Fn()`
help: consider restricting type parameter `T` with trait `Fn`
|
LL | impl<T: Fn()> Fun for T {
| ++++++

View File

@ -10,7 +10,7 @@ note: required by a bound in `Fun::F`
|
LL | type F<'a>: Fn() -> u32;
| ^^^^^^^^^^^ required by this bound in `Fun::F`
help: consider restricting type parameter `T` with trait `Fn()`
help: consider restricting type parameter `T` with trait `Fn`
|
LL | impl<T: Fn()> Fun for T {
| ++++++

View File

@ -10,7 +10,7 @@ note: required by a bound in `Fun::F`
|
LL | type F<'a>: Fn() -> u32;
| ^^^^^^^^^^^ required by this bound in `Fun::F`
help: consider restricting type parameter `T` with trait `Fn()`
help: consider restricting type parameter `T` with trait `Fn`
|
LL | impl<T: Fn()> Fun for T {
| ++++++

View File

@ -23,7 +23,7 @@ note: required by a bound in `UnsafeCopy::Copy`
|
LL | type Copy<T>: Copy = Box<T>;
| ^^^^ required by this bound in `UnsafeCopy::Copy`
help: consider restricting type parameter `T` with trait `std::clone::Clone`
help: consider restricting type parameter `T` with trait `Clone`
|
LL | type Copy<T: std::clone::Clone>: Copy = Box<T>;
| +++++++++++++++++++

View File

@ -23,7 +23,7 @@ note: required by a bound in `UnsafeCopy::Copy`
|
LL | type Copy<T>: Copy = Box<T>;
| ^^^^ required by this bound in `UnsafeCopy::Copy`
help: consider restricting type parameter `T` with trait `std::clone::Clone`
help: consider restricting type parameter `T` with trait `Clone`
|
LL | type Copy<T: std::clone::Clone>: Copy = Box<T>;
| +++++++++++++++++++

View File

@ -71,7 +71,7 @@ LL | Self(self.0 + rhs.0)
| |
| B
|
help: consider restricting type parameter `B` with trait `std::ops::Add<Output = B>`
help: consider restricting type parameter `B` with trait `Add`
|
LL | impl<B: std::ops::Add<Output = B>> Add for D<B> {
| +++++++++++++++++++++++++++

View File

@ -5,7 +5,7 @@ error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied
LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
| ^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T`
|
help: consider restricting type parameter `T` with trait `for<'a> ToUnit<'a>`
help: consider restricting type parameter `T` with trait `ToUnit`
|
LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
| ++++++++++++++++++++

View File

@ -13,7 +13,7 @@ LL | fn want_bar_for_any_ccx<B>(b: &B)
| -------------------- required by a bound in this function
LL | where B : for<'ccx> Bar<'ccx>
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx`
help: consider further restricting this bound with trait `for<'ccx> Bar<'ccx>`
help: consider further restricting this bound with trait `Bar`
|
LL | where B : Qux + for<'ccx> Bar<'ccx>
| +++++++++++++++++++++

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied
LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T`
|
help: consider restricting type parameter `T` with trait `for<'a> SomeTrait<'a>`
help: consider restricting type parameter `T` with trait `SomeTrait`
|
LL | fn give_me_ice<T: for<'a> SomeTrait<'a>>() {
| +++++++++++++++++++++++
@ -15,7 +15,7 @@ error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied
LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T`
|
help: consider restricting type parameter `T` with trait `for<'a> SomeTrait<'a>`
help: consider restricting type parameter `T` with trait `SomeTrait`
|
LL | fn give_me_ice<T: for<'a> SomeTrait<'a>>() {
| +++++++++++++++++++++++

View File

@ -17,7 +17,7 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F {
| ------- ^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
help: consider further restricting this bound with trait `MyFn<i32>`
help: consider further restricting this bound with trait `MyFn`
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
@ -43,7 +43,7 @@ LL | fn autobatch<F>(self) -> impl Trait
...
LL | F: Callback<Self::CallbackArg>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `<Sender as ChannelSender>::autobatch`
help: consider further restricting this bound with trait `MyFn<i32>`
help: consider further restricting this bound with trait `MyFn`
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
@ -68,7 +68,7 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F {
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider further restricting this bound with trait `MyFn<i32>`
help: consider further restricting this bound with trait `MyFn`
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
@ -121,7 +121,7 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F {
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider further restricting this bound with trait `MyFn<i32>`
help: consider further restricting this bound with trait `MyFn`
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
@ -137,7 +137,7 @@ note: required by a bound in `Callback`
|
LL | trait Callback<A>: MyFn<A, Output = Self::Ret> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Callback`
help: consider further restricting this bound with trait `MyFn<i32>`
help: consider further restricting this bound with trait `MyFn`
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++

View File

@ -17,7 +17,7 @@ LL | (S::default(), T::default())
| ---------------------------- return type was inferred to be `(S, T)` here
|
= note: required because it appears within the type `(S, T)`
help: consider further restricting this bound with trait `std::marker::Copy`
help: consider further restricting this bound with trait `Copy`
|
LL | impl<S: Default + std::marker::Copy> Bar for S {
| +++++++++++++++++++
@ -32,7 +32,7 @@ LL | (S::default(), T::default())
| ---------------------------- return type was inferred to be `(S, T)` here
|
= note: required because it appears within the type `(S, T)`
help: consider further restricting this bound with trait `std::marker::Copy`
help: consider further restricting this bound with trait `Copy`
|
LL | fn foo<T: Default + std::marker::Copy>() -> Self::E {
| +++++++++++++++++++

View File

@ -6,7 +6,7 @@ LL | self.x += v.x;
| |
| cannot use `+=` on type `T`
|
help: consider restricting type parameter `T` with trait `std::ops::AddAssign`
help: consider restricting type parameter `T` with trait `AddAssign`
|
LL | impl<T: std::ops::AddAssign> Foo<T> {
| +++++++++++++++++++++

View File

@ -12,7 +12,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| |
| unsatisfied trait bound introduced here
= note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
help: consider restricting type parameter `T` with trait `std::marker::Send`
help: consider restricting type parameter `T` with trait `Send`
|
LL | fn f<T: std::marker::Send>(val: T) {
| +++++++++++++++++++
@ -31,7 +31,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| |
| unsatisfied trait bound introduced here
= note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | fn f<T: std::marker::Copy>(val: T) {
| +++++++++++++++++++
@ -50,7 +50,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| |
| unsatisfied trait bound introduced here
= note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
help: consider restricting type parameter `T` with trait `std::marker::Send`
help: consider restricting type parameter `T` with trait `Send`
|
LL | fn g<T: std::marker::Send>(val: T) {
| +++++++++++++++++++
@ -69,7 +69,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
| |
| unsatisfied trait bound introduced here
= note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | fn g<T: std::marker::Copy>(val: T) {
| +++++++++++++++++++

View File

@ -6,7 +6,7 @@ LL | impl<A, B> FnOnce<A> for CachedFun<A, B>
|
note: required by a bound in `FnOnce`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
help: consider further restricting this bound with unstable trait `std::marker::Tuple`
help: consider further restricting this bound with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
@ -19,7 +19,7 @@ LL | impl<A, B> FnMut<A> for CachedFun<A, B>
|
note: required by a bound in `FnMut`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
help: consider further restricting this bound with unstable trait `std::marker::Tuple`
help: consider further restricting this bound with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
@ -30,7 +30,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup
LL | extern "rust-call" fn call_once(mut self, a: A) -> Self::Output {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
help: consider further restricting this bound with unstable trait `std::marker::Tuple`
help: consider further restricting this bound with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
@ -41,7 +41,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup
LL | extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
help: consider further restricting this bound with unstable trait `std::marker::Tuple`
help: consider further restricting this bound with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
@ -56,7 +56,7 @@ LL | self.call_mut(a)
|
note: required by a bound in `call_mut`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
help: consider further restricting this bound with unstable trait `std::marker::Tuple`
help: consider further restricting this bound with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++

View File

@ -4,7 +4,7 @@ error[E0277]: cannot multiply `T` by `T`
LL | type Alias<T> = <T as std::ops::Mul>::Output;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T`
|
help: consider restricting type parameter `T` with trait `std::ops::Mul`
help: consider restricting type parameter `T` with trait `Mul`
|
LL | type Alias<T: std::ops::Mul> = <T as std::ops::Mul>::Output;
| +++++++++++++++

View File

@ -8,7 +8,7 @@ LL | | where
LL | | F: for<'a> FnOnce(<F as Output<'a>>::Type),
| |___________________________________________________^ the trait `for<'a> Output<'a>` is not implemented for `F`
|
help: consider further restricting this bound with trait `for<'a> Output<'a>`
help: consider further restricting this bound with trait `Output`
|
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
| ++++++++++++++++++++
@ -19,7 +19,7 @@ error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
LL | fn do_something_wrapper<O, F>(self, _: F)
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
|
help: consider further restricting this bound with trait `for<'a> Output<'a>`
help: consider further restricting this bound with trait `Output`
|
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
| ++++++++++++++++++++
@ -30,7 +30,7 @@ error[E0277]: the trait bound `F: Output<'_>` is not satisfied
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F`
|
help: consider further restricting this bound with trait `Output<'_>`
help: consider further restricting this bound with trait `Output`
|
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>,
| ++++++++++++
@ -41,7 +41,7 @@ error[E0277]: the trait bound `F: Output<'_>` is not satisfied
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F`
|
help: consider further restricting this bound with trait `Output<'_>`
help: consider further restricting this bound with trait `Output`
|
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>,
| ++++++++++++

View File

@ -10,7 +10,7 @@ note: required by a bound in `CastTo`
|
LL | pub trait CastTo<U: ?Sized>: Unsize<U> {}
| ^^^^^^^^^ required by this bound in `CastTo`
help: consider further restricting this bound with unstable trait `std::marker::Unsize<U>`
help: consider further restricting this bound with unstable trait `Unsize`
|
LL | impl<T: ?Sized + std::marker::Unsize<U>, U: ?Sized> CastTo<U> for T {}
| ++++++++++++++++++++++++

View File

@ -6,7 +6,7 @@ LL | let _ = s == t;
| |
| &[T]
|
help: consider restricting type parameter `T` with trait `std::cmp::PartialEq`
help: consider restricting type parameter `T` with trait `PartialEq`
|
LL | pub fn foo<T: std::cmp::PartialEq>(s: &[T], t: &[T]) {
| +++++++++++++++++++++

View File

@ -81,7 +81,7 @@ LL | (t, t)
| |
| value moved here
|
help: consider restricting type parameter `T` with traits `Copy + Trait`
help: consider restricting type parameter `T` with traits `Copy` and `Trait`
|
LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) {
| ++++++++++++++
@ -97,7 +97,7 @@ LL | (t, t)
| |
| value moved here
|
help: consider restricting type parameter `T` with traits `Copy + Trait`
help: consider restricting type parameter `T` with traits `Copy` and `Trait`
|
LL | fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where {
| ++++++++++++++
@ -113,7 +113,7 @@ LL | (t, t)
| |
| value moved here
|
help: consider further restricting this bound with traits `Copy + Trait`
help: consider further restricting this bound with traits `Copy` and `Trait`
|
LL | T: A + Copy + Trait,
| ++++++++++++++
@ -129,7 +129,7 @@ LL | (t, t)
| |
| value moved here
|
help: consider further restricting this bound with traits `Copy + Trait`
help: consider further restricting this bound with traits `Copy` and `Trait`
|
LL | T: A + Copy + Trait,
| ++++++++++++++
@ -145,7 +145,7 @@ LL | (t, t)
| |
| value moved here
|
help: consider further restricting this bound with traits `Copy + Trait`
help: consider further restricting this bound with traits `Copy` and `Trait`
|
LL | fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>)
| ++++++++++++++

View File

@ -23,7 +23,7 @@ note: required by a bound in `is_zen`
|
LL | fn is_zen<T: Zen>(_: T) {}
| ^^^ required by this bound in `is_zen`
help: consider restricting type parameter `T` with trait `std::marker::Sync`
help: consider restricting type parameter `T` with trait `Sync`
|
LL | fn not_sync<T: std::marker::Sync>(x: Guard<T>) {
| +++++++++++++++++++
@ -58,7 +58,7 @@ note: required by a bound in `is_zen`
|
LL | fn is_zen<T: Zen>(_: T) {}
| ^^^ required by this bound in `is_zen`
help: consider restricting type parameter `T` with trait `std::marker::Sync`
help: consider restricting type parameter `T` with trait `Sync`
|
LL | fn nested_not_sync<T: std::marker::Sync>(x: Nested<Guard<T>>) {
| +++++++++++++++++++

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied
LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T`
|
help: consider restricting type parameter `T` with trait `for<'z> Trait2<'y, 'z>`
help: consider restricting type parameter `T` with trait `Trait2`
|
LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
| ++++++++++++++++++++++++
@ -17,7 +17,7 @@ LL | |
LL | | }
| |_^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T`
|
help: consider restricting type parameter `T` with trait `for<'z> Trait2<'y, 'z>`
help: consider restricting type parameter `T` with trait `Trait2`
|
LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
| ++++++++++++++++++++++++

View File

@ -20,7 +20,7 @@ note: required by a bound in `X::U`
|
LL | type U<'a>: PartialEq<&'a Self> where Self: 'a;
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `X::U`
help: consider further restricting this bound with trait `std::cmp::PartialEq`
help: consider further restricting this bound with trait `PartialEq`
|
LL | impl<T: 'static + std::cmp::PartialEq> X for T {
| +++++++++++++++++++++

View File

@ -19,7 +19,7 @@ note: required by a bound in `Foo`
|
LL | trait Foo<'a, T: Eq + 'a> { }
| ^^ required by this bound in `Foo`
help: consider restricting type parameter `U` with trait `std::cmp::Eq`
help: consider restricting type parameter `U` with trait `Eq`
|
LL | default impl<U: std::cmp::Eq> Foo<'static, U> for () {}
| ++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `UncheckedCopy::Output`
|
LL | type Output: From<Self> + Copy + Into<Self>;
| ^^^^ required by this bound in `UncheckedCopy::Output`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> UncheckedCopy for T {
| +++++++++++++++++++

View File

@ -5,7 +5,7 @@ LL | impl<B: ?Sized> Display for Cow<'_, B> {
| ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting this bound with trait `std::clone::Clone`
help: consider further restricting this bound with trait `Clone`
|
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++
@ -17,7 +17,7 @@ LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting this bound with trait `std::clone::Clone`
help: consider further restricting this bound with trait `Clone`
|
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++
@ -29,7 +29,7 @@ LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
| ^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting this bound with trait `std::clone::Clone`
help: consider further restricting this bound with trait `Clone`
|
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++
@ -47,7 +47,7 @@ LL | | }
| |_____^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting this bound with trait `std::clone::Clone`
help: consider further restricting this bound with trait `Clone`
|
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++

View File

@ -5,7 +5,7 @@ LL | println!("{:?}", t);
| ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `std::fmt::Debug`
help: consider further restricting this bound with trait `Debug`
|
LL | fn test_impl(t: impl Sized + std::fmt::Debug) {
| +++++++++++++++++
@ -17,7 +17,7 @@ LL | println!("{:?}", t);
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `std::fmt::Debug`
help: consider restricting type parameter `T` with trait `Debug`
|
LL | fn test_no_bounds<T: std::fmt::Debug>(t: T) {
| +++++++++++++++++
@ -29,7 +29,7 @@ LL | println!("{:?}", t);
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `std::fmt::Debug`
help: consider further restricting this bound with trait `Debug`
|
LL | fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) {
| +++++++++++++++++
@ -41,7 +41,7 @@ LL | println!("{:?} {:?}", x, y);
| ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `Y` with trait `std::fmt::Debug`
help: consider further restricting type parameter `Y` with trait `Debug`
|
LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug {
| ~~~~~~~~~~~~~~~~~~~~
@ -53,7 +53,7 @@ LL | println!("{:?}", x);
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `std::fmt::Debug`
help: consider further restricting this bound with trait `Debug`
|
LL | fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug {
| +++++++++++++++++
@ -65,7 +65,7 @@ LL | println!("{:?}", x);
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `std::fmt::Debug`
help: consider further restricting this bound with trait `Debug`
|
LL | fn test_many_bounds_where<X>(x: X) where X: Sized + std::fmt::Debug, X: Sized {
| +++++++++++++++++

View File

@ -14,7 +14,7 @@ LL | impl<T: Clone, U> PartialEq<U> for Struct<T>
note: required by a bound in `Eq`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `std::clone::Clone`
help: consider restricting type parameter `T` with trait `Clone`
|
LL | pub struct Struct<T: std::clone::Clone>(T);
| +++++++++++++++++++

View File

@ -38,7 +38,7 @@ LL | impl<T: Debug + Trait> Debug for Inner<T> {
= note: required for `&c::Inner<T>` to implement `Debug`
= note: required for the cast from `&&c::Inner<T>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `c::Trait`
help: consider restricting type parameter `T` with trait `Trait`
|
LL | struct Outer<T: c::Trait>(Inner<T>);
| ++++++++++
@ -60,7 +60,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug, T: Trait {
= note: required for `&d::Inner<T>` to implement `Debug`
= note: required for the cast from `&&d::Inner<T>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `d::Trait`
help: consider restricting type parameter `T` with trait `Trait`
|
LL | struct Outer<T: d::Trait>(Inner<T>);
| ++++++++++
@ -82,7 +82,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug + Trait {
= note: required for `&e::Inner<T>` to implement `Debug`
= note: required for the cast from `&&e::Inner<T>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `e::Trait`
help: consider restricting type parameter `T` with trait `Trait`
|
LL | struct Outer<T: e::Trait>(Inner<T>);
| ++++++++++
@ -104,7 +104,7 @@ LL | impl<T: Debug> Debug for Inner<T> where T: Trait {
= note: required for `&f::Inner<T>` to implement `Debug`
= note: required for the cast from `&&f::Inner<T>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `f::Trait`
help: consider restricting type parameter `T` with trait `Trait`
|
LL | struct Outer<T: f::Trait>(Inner<T>);
| ++++++++++

View File

@ -6,7 +6,7 @@ LL | n + 10
| |
| N
|
help: consider restricting type parameter `N` with trait `std::ops::Add<i32, Output = N>`
help: consider restricting type parameter `N` with trait `Add`
|
LL | fn add_ten<N: std::ops::Add<i32, Output = N>>(n: N) -> N {
| ++++++++++++++++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `Vector2`
|
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ^^^^ required by this bound in `Vector2`
help: consider further restricting this bound with trait `std::marker::Copy`
help: consider further restricting this bound with trait `Copy`
|
LL | pub struct AABB<K: Debug + std::marker::Copy> {
| +++++++++++++++++++
@ -32,7 +32,7 @@ LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ---- unsatisfied trait bound introduced in this `derive` macro
= note: required for the cast from `&Vector2<K>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `std::marker::Copy`
help: consider further restricting this bound with trait `Copy`
|
LL | pub struct AABB<K: Debug + std::marker::Copy> {
| +++++++++++++++++++
@ -52,7 +52,7 @@ note: required by a bound in `Vector2`
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ^^^^ required by this bound in `Vector2`
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `std::marker::Copy`
help: consider further restricting this bound with trait `Copy`
|
LL | pub struct AABB<K: Debug + std::marker::Copy> {
| +++++++++++++++++++
@ -74,7 +74,7 @@ LL | #[derive(Debug, Copy, Clone)]
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ---- unsatisfied trait bound introduced in this `derive` macro
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `std::marker::Copy`
help: consider further restricting this bound with trait `Copy`
|
LL | pub struct AABB<K: Debug + std::marker::Copy> {
| +++++++++++++++++++

View File

@ -29,7 +29,7 @@ note: required by a bound in `Vector2`
|
LL | pub struct Vector2<T: Debug + Copy + Clone>{
| ^^^^^ required by this bound in `Vector2`
help: consider further restricting this bound with trait `std::fmt::Debug`
help: consider further restricting this bound with trait `Debug`
|
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
| +++++++++++++++++
@ -44,7 +44,7 @@ LL | pub loc: Vector2<K>,
| ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `std::fmt::Debug`
help: consider further restricting this bound with trait `Debug`
|
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
| +++++++++++++++++
@ -59,7 +59,7 @@ LL | pub size: Vector2<K>
| ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `std::fmt::Debug`
help: consider further restricting this bound with trait `Debug`
|
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
| +++++++++++++++++

View File

@ -29,7 +29,7 @@ note: required by a bound in `Vector2`
|
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ^^^^^ required by this bound in `Vector2`
help: consider restricting type parameter `K` with trait `std::fmt::Debug`
help: consider restricting type parameter `K` with trait `Debug`
|
LL | pub struct AABB<K: std::fmt::Debug> {
| +++++++++++++++++
@ -45,7 +45,7 @@ note: required by a bound in `Vector2`
|
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ^^^^ required by this bound in `Vector2`
help: consider restricting type parameter `K` with trait `std::marker::Copy`
help: consider restricting type parameter `K` with trait `Copy`
|
LL | pub struct AABB<K: std::marker::Copy> {
| +++++++++++++++++++
@ -68,7 +68,7 @@ LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ---- unsatisfied trait bound introduced in this `derive` macro
= note: required for the cast from `&Vector2<K>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `K` with trait `std::marker::Copy`
help: consider restricting type parameter `K` with trait `Copy`
|
LL | pub struct AABB<K: std::marker::Copy> {
| +++++++++++++++++++
@ -83,7 +83,7 @@ LL | pub loc: Vector2<K>,
| ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `K` with trait `std::fmt::Debug`
help: consider restricting type parameter `K` with trait `Debug`
|
LL | pub struct AABB<K: std::fmt::Debug> {
| +++++++++++++++++
@ -103,7 +103,7 @@ note: required by a bound in `Vector2`
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ^^^^ required by this bound in `Vector2`
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `K` with trait `std::marker::Copy`
help: consider restricting type parameter `K` with trait `Copy`
|
LL | pub struct AABB<K: std::marker::Copy> {
| +++++++++++++++++++
@ -118,7 +118,7 @@ LL | pub size: Vector2<K>,
| ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `K` with trait `std::fmt::Debug`
help: consider restricting type parameter `K` with trait `Debug`
|
LL | pub struct AABB<K: std::fmt::Debug> {
| +++++++++++++++++
@ -140,7 +140,7 @@ LL | #[derive(Debug, Copy, Clone)]
LL | pub struct Vector2<T: Debug + Copy + Clone> {
| ---- unsatisfied trait bound introduced in this `derive` macro
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `K` with trait `std::marker::Copy`
help: consider restricting type parameter `K` with trait `Copy`
|
LL | pub struct AABB<K: std::marker::Copy> {
| +++++++++++++++++++

View File

@ -12,7 +12,7 @@ note: the `Copy` impl for `OnlyCopyIfDisplay<S>` requires that `S: std::fmt::Dis
|
LL | struct Wrapper<T>(T);
| ^
help: consider restricting type parameter `S` with trait `std::fmt::Display`
help: consider restricting type parameter `S` with trait `Display`
|
LL | impl<S: std::fmt::Display> Copy for Wrapper<OnlyCopyIfDisplay<S>> {}
| +++++++++++++++++++

View File

@ -11,7 +11,7 @@ note: required by a bound in `is_send`
|
LL | fn is_send<T: Send>(val: T) {}
| ^^^^ required by this bound in `is_send`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | fn use_impl_sync(val: impl Sync + std::marker::Send) {
| +++++++++++++++++++
@ -29,7 +29,7 @@ note: required by a bound in `is_send`
|
LL | fn is_send<T: Send>(val: T) {}
| ^^^^ required by this bound in `is_send`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | fn use_where<S>(val: S) where S: Sync + std::marker::Send {
| +++++++++++++++++++
@ -47,7 +47,7 @@ note: required by a bound in `is_send`
|
LL | fn is_send<T: Send>(val: T) {}
| ^^^^ required by this bound in `is_send`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | fn use_bound<S: Sync + std::marker::Send>(val: S) {
| +++++++++++++++++++
@ -65,7 +65,7 @@ note: required by a bound in `is_send`
|
LL | fn is_send<T: Send>(val: T) {}
| ^^^^ required by this bound in `is_send`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | Sync + std::marker::Send
| +++++++++++++++++++
@ -83,7 +83,7 @@ note: required by a bound in `is_send`
|
LL | fn is_send<T: Send>(val: T) {}
| ^^^^ required by this bound in `is_send`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | fn use_bound_and_where<S: Sync + std::marker::Send>(val: S) where S: std::fmt::Debug {
| +++++++++++++++++++
@ -101,7 +101,7 @@ note: required by a bound in `is_send`
|
LL | fn is_send<T: Send>(val: T) {}
| ^^^^ required by this bound in `is_send`
help: consider restricting type parameter `S` with trait `std::marker::Send`
help: consider restricting type parameter `S` with trait `Send`
|
LL | fn use_unbound<S: std::marker::Send>(val: S) {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `ConstrainedStruct`
|
LL | struct ConstrainedStruct<X: Copy> {
| ^^^^ required by this bound in `ConstrainedStruct`
help: consider further restricting type parameter `X` with trait `std::marker::Copy`
help: consider further restricting type parameter `X` with trait `Copy`
|
LL | trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy {
| ++++++++++++++++++++++
@ -25,7 +25,7 @@ note: required by a bound in `ConstrainedStruct`
|
LL | struct ConstrainedStruct<X: Copy> {
| ^^^^ required by this bound in `ConstrainedStruct`
help: consider further restricting type parameter `X` with trait `std::marker::Copy`
help: consider further restricting type parameter `X` with trait `Copy`
|
LL | trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy {
| ++++++++++++++++++++++
@ -41,7 +41,7 @@ note: required by a bound in `ConstrainedStruct`
|
LL | struct ConstrainedStruct<X: Copy> {
| ^^^^ required by this bound in `ConstrainedStruct`
help: consider further restricting type parameter `X` with trait `std::marker::Copy`
help: consider further restricting type parameter `X` with trait `Copy`
|
LL | trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy {
| ++++++++++++++++++++++
@ -57,7 +57,7 @@ note: required by a bound in `ConstrainedStruct`
|
LL | struct ConstrainedStruct<X: Copy> {
| ^^^^ required by this bound in `ConstrainedStruct`
help: consider further restricting type parameter `X` with trait `std::marker::Copy`
help: consider further restricting type parameter `X` with trait `Copy`
|
LL | trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy {
| ++++++++++++++++++++++

View File

@ -24,7 +24,7 @@ LL | for _ in t {}
|
= note: required for `std::ops::Range<T>` to implement `Iterator`
= note: required for `std::ops::Range<T>` to implement `IntoIterator`
help: consider restricting type parameter `T` with unstable trait `std::iter::Step`
help: consider restricting type parameter `T` with unstable trait `Step`
|
LL | pub fn baz<T: std::iter::Step>(t: std::ops::Range<T>) {
| +++++++++++++++++

View File

@ -11,7 +11,7 @@ note: required by a bound in `Bar::bar`
|
LL | fn bar<T:Send>(&self);
| ^^^^ required by this bound in `Bar::bar`
help: consider further restricting this bound with trait `std::marker::Send`
help: consider further restricting this bound with trait `Send`
|
LL | fn foo<T:'static + std::marker::Send>() {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `Magic::X`
|
LL | type X: Trait;
| ^^^^^ required by this bound in `Magic::X`
help: consider further restricting this bound with trait `std::marker::Sync`
help: consider further restricting this bound with trait `Sync`
|
LL | impl<T: Magic + std::marker::Sync> Magic for T {
| +++++++++++++++++++

View File

@ -18,7 +18,7 @@ LL | c.same_as(22)
| |
| required by a bound introduced by this call
|
help: consider further restricting this bound with trait `CompareTo<i32>`
help: consider further restricting this bound with trait `CompareTo`
|
LL | fn with_trait<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
| ++++++++++++++++
@ -41,7 +41,7 @@ LL | CompareTo::same_as(c, 22)
| |
| required by a bound introduced by this call
|
help: consider further restricting this bound with trait `CompareTo<i32>`
help: consider further restricting this bound with trait `CompareTo`
|
LL | fn with_ufcs2<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
| ++++++++++++++++

View File

@ -14,7 +14,7 @@ note: required by a bound in `Complete`
|
LL | pub trait Complete: Partial {
| ^^^^^^^ required by this bound in `Complete`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> Complete for T {}
| +++++++++++++++++++

View File

@ -10,7 +10,7 @@ note: required by a bound in `copy`
|
LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
| ^^^^^ required by this bound in `copy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T {
| +++++++++++++++++++
@ -38,7 +38,7 @@ LL | copy::<dyn Setup<From=T>>(t)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `dyn Setup<From = T>`, the trait `Copy` is not implemented for `T`
|
= note: required because it appears within the type `dyn Setup<From = T>`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T {
| +++++++++++++++++++

View File

@ -14,7 +14,7 @@ LL | impl<T: Clone, U> PartialEq<U> for Struct<T>
note: required by a bound in `Eq`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `std::clone::Clone`
help: consider restricting type parameter `T` with trait `Clone`
|
LL | pub struct Struct<T: std::clone::Clone>(T);
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `assert_is_tuple`
|
LL | fn assert_is_tuple<T: std::marker::Tuple + ?Sized>() {}
| ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple`
help: consider restricting type parameter `T` with unstable trait `std::marker::Tuple`
help: consider restricting type parameter `T` with unstable trait `Tuple`
|
LL | fn from_param_env<T: std::marker::Tuple>() {
| ++++++++++++++++++++

View File

@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type
|
LL | fn f<T: Clone>(t: T) -> X<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `T` with trait `std::clone::Clone`
help: consider restricting type parameter `T` with trait `Clone`
|
LL | pub type X<T: std::clone::Clone> = impl Clone;
| +++++++++++++++++++

View File

@ -10,7 +10,7 @@ note: required by a bound in `Struct`
|
LL | struct Struct<V: Display>(Option<V>);
| ^^^^^^^ required by this bound in `Struct`
help: consider further restricting this bound with trait `std::fmt::Display`
help: consider further restricting this bound with trait `Display`
|
LL | type Foo<T: Debug + std::fmt::Display> = (impl Debug, Struct<T>);
| +++++++++++++++++++

View File

@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type
|
LL | fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `T` with trait `std::fmt::Debug`
help: consider restricting type parameter `T` with trait `Debug`
|
LL | type Two<T: std::fmt::Debug, U> = impl Debug;
| +++++++++++++++++

View File

@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type
|
LL | fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `U` with trait `std::fmt::Debug`
help: consider restricting type parameter `U` with trait `Debug`
|
LL | type Two<T, U: std::fmt::Debug> = impl Debug;
| +++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound on the type alias `Underconstrained`
|
LL | type Underconstrained<T: std::fmt::Debug> = impl Send;
| ^^^^^^^^^^^^^^^ required by this bound
help: consider restricting type parameter `U` with trait `std::fmt::Debug`
help: consider restricting type parameter `U` with trait `Debug`
|
LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
| +++++++++++++++++
@ -25,7 +25,7 @@ note: required by a bound on the type alias `Underconstrained2`
|
LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
| ^^^^^^^^^^^^^^^ required by this bound
help: consider restricting type parameter `V` with trait `std::fmt::Debug`
help: consider restricting type parameter `V` with trait `Debug`
|
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
| +++++++++++++++++
@ -46,7 +46,7 @@ note: required by a bound on the type alias `Underconstrained`
|
LL | type Underconstrained<T: std::fmt::Debug> = impl Send;
| ^^^^^^^^^^^^^^^ required by this bound
help: consider restricting type parameter `U` with trait `std::fmt::Debug`
help: consider restricting type parameter `U` with trait `Debug`
|
LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
| +++++++++++++++++
@ -67,7 +67,7 @@ note: required by a bound on the type alias `Underconstrained2`
|
LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
| ^^^^^^^^^^^^^^^ required by this bound
help: consider restricting type parameter `V` with trait `std::fmt::Debug`
help: consider restricting type parameter `V` with trait `Debug`
|
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
| +++++++++++++++++

View File

@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type
|
LL | fn foo<T: Default>(t: T) -> Foo<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `T` with trait `std::default::Default`
help: consider restricting type parameter `T` with trait `Default`
|
LL | type Foo<T: std::default::Default> = impl Default;
| +++++++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `make_bug`
|
LL | fn make_bug<T, U: From<T>>() -> Bug<T, U> {
| ^^^^^^^ required by this bound in `make_bug`
help: consider restricting type parameter `U` with trait `std::convert::From<T>`
help: consider restricting type parameter `U` with trait `From`
|
LL | pub type Bug<T, U: std::convert::From<T>> = impl Fn(T) -> U + Copy;
| +++++++++++++++++++++++

View File

@ -53,7 +53,7 @@ note: required by a bound in `Super`
|
LL | trait Super<T: Copy> { }
| ^^^^ required by this bound in `Super`
help: consider further restricting type parameter `T` with trait `std::marker::Copy`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | trait Base<T = String>: Super<T> where T: std::marker::Copy { }
| ++++++++++++++++++++++++++

View File

@ -6,7 +6,7 @@ LL | let z = x + y;
| |
| T
|
help: consider restricting type parameter `T` with trait `std::ops::Add`
help: consider restricting type parameter `T` with trait `Add`
|
LL | fn foo<T: std::ops::Add>(x: T, y: T) {
| +++++++++++++++
@ -19,7 +19,7 @@ LL | x += x;
| |
| cannot use `+=` on type `T`
|
help: consider restricting type parameter `T` with trait `std::ops::AddAssign`
help: consider restricting type parameter `T` with trait `AddAssign`
|
LL | fn bar<T: std::ops::AddAssign>(x: T) {
| +++++++++++++++++++++
@ -30,7 +30,7 @@ error[E0600]: cannot apply unary operator `-` to type `T`
LL | let y = -x;
| ^^ cannot apply unary operator `-`
|
help: consider restricting type parameter `T` with trait `std::ops::Neg`
help: consider restricting type parameter `T` with trait `Neg`
|
LL | fn baz<T: std::ops::Neg>(x: T) {
| +++++++++++++++
@ -41,7 +41,7 @@ error[E0600]: cannot apply unary operator `!` to type `T`
LL | let y = !x;
| ^^ cannot apply unary operator `!`
|
help: consider restricting type parameter `T` with trait `std::ops::Not`
help: consider restricting type parameter `T` with trait `Not`
|
LL | fn baz<T: std::ops::Not>(x: T) {
| +++++++++++++++

View File

@ -12,7 +12,7 @@ LL | impl<K, V> Index<&K> for HashMap<K, V>
LL | where
LL | K: Hash,
| ---- unsatisfied trait bound introduced here
help: consider restricting type parameter `K` with trait `std::hash::Hash`
help: consider restricting type parameter `K` with trait `Hash`
|
LL | fn index<'a, K: std::hash::Hash, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
| +++++++++++++++++
@ -31,7 +31,7 @@ LL | impl<K, V> Index<&K> for HashMap<K, V>
...
LL | V: Copy,
| ---- unsatisfied trait bound introduced here
help: consider restricting type parameter `V` with trait `std::marker::Copy`
help: consider restricting type parameter `V` with trait `Copy`
|
LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V {
| +++++++++++++++++++

View File

@ -13,7 +13,7 @@ note: required by a bound in `copy`
|
LL | fn copy<R: Unpin, W>(_: R, _: W) {}
| ^^^^^ required by this bound in `copy`
help: consider restricting type parameter `T` with trait `std::marker::Unpin`
help: consider restricting type parameter `T` with trait `Unpin`
|
LL | fn f<T: std::marker::Unpin>(r: T) {
| ++++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `is_send`
|
LL | fn is_send<T:Send>() {
| ^^^^ required by this bound in `is_send`
help: consider restricting type parameter `T` with trait `std::marker::Send`
help: consider restricting type parameter `T` with trait `Send`
|
LL | fn foo<T: std::marker::Send>() {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy`
|
LL | trait ExtraCopy<T:Copy> { }
| ^^^^ required by this bound in `ExtraCopy`
help: consider further restricting type parameter `U` with trait `std::marker::Copy`
help: consider further restricting type parameter `U` with trait `Copy`
|
LL | where T: ExtraCopy<U>, U: std::marker::Copy
| ++++++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `IsCopy`
|
LL | struct IsCopy<T:Copy> {
| ^^^^ required by this bound in `IsCopy`
help: consider restricting type parameter `A` with trait `std::marker::Copy`
help: consider restricting type parameter `A` with trait `Copy`
|
LL | enum AnotherEnum<A: std::marker::Copy> {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `IsCopy`
|
LL | struct IsCopy<T:Copy> {
| ^^^^ required by this bound in `IsCopy`
help: consider restricting type parameter `A` with trait `std::marker::Copy`
help: consider restricting type parameter `A` with trait `Copy`
|
LL | enum SomeEnum<A: std::marker::Copy> {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy`
|
LL | trait ExtraCopy<T:Copy> { }
| ^^^^ required by this bound in `ExtraCopy`
help: consider further restricting type parameter `U` with trait `std::marker::Copy`
help: consider further restricting type parameter `U` with trait `Copy`
|
LL | fn foo<T,U>() where T: ExtraCopy<U>, U: std::marker::Copy
| ++++++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy`
|
LL | struct MustBeCopy<T:Copy> {
| ^^^^ required by this bound in `MustBeCopy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | fn bar<T: std::marker::Copy>(_: &MustBeCopy<T>)
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy`
|
LL | struct MustBeCopy<T: Copy> {
| ^^^^ required by this bound in `MustBeCopy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | fn bar<T: std::marker::Copy>() -> MustBeCopy<T>
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy`
|
LL | struct MustBeCopy<T:Copy> {
| ^^^^ required by this bound in `MustBeCopy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | struct Bar<T: std::marker::Copy> {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy`
|
LL | struct MustBeCopy<T:Copy> {
| ^^^^ required by this bound in `MustBeCopy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | struct Foo<T: std::marker::Copy> {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy`
|
LL | trait MustBeCopy<T:Copy> {
| ^^^^ required by this bound in `MustBeCopy`
help: consider further restricting type parameter `U` with trait `std::marker::Copy`
help: consider further restricting type parameter `U` with trait `Copy`
|
LL | where T: MustBeCopy<U>, U: std::marker::Copy
| ++++++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy`
|
LL | struct MustBeCopy<T:Copy> {
| ^^^^ required by this bound in `MustBeCopy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | struct Bar<T: std::marker::Copy> {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy`
|
LL | trait ExtraCopy<T:Copy> { }
| ^^^^ required by this bound in `ExtraCopy`
help: consider restricting type parameter `U` with trait `std::marker::Copy`
help: consider restricting type parameter `U` with trait `Copy`
|
LL | impl<T,U: std::marker::Copy> Foo<T,U> {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy`
|
LL | trait ExtraCopy<T:Copy> { }
| ^^^^ required by this bound in `ExtraCopy`
help: consider further restricting type parameter `U` with trait `std::marker::Copy`
help: consider further restricting type parameter `U` with trait `Copy`
|
LL | impl<T,U> Foo<T,U> where T: ExtraCopy<U>, U: std::marker::Copy
| ++++++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy`
|
LL | trait ExtraCopy<T:Copy> { }
| ^^^^ required by this bound in `ExtraCopy`
help: consider further restricting type parameter `U` with trait `std::marker::Copy`
help: consider further restricting type parameter `U` with trait `Copy`
|
LL | where T: ExtraCopy<U>, U: std::marker::Copy
| ++++++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `IsCopy`
|
LL | struct IsCopy<T:Copy> {
| ^^^^ required by this bound in `IsCopy`
help: consider restricting type parameter `A` with trait `std::marker::Copy`
help: consider restricting type parameter `A` with trait `Copy`
|
LL | struct SomeStruct<A: std::marker::Copy> {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy`
|
LL | trait ExtraCopy<T:Copy> { }
| ^^^^ required by this bound in `ExtraCopy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | trait SomeTrait<T: std::marker::Copy> {
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy`
|
LL | trait ExtraCopy<T:Copy> { }
| ^^^^ required by this bound in `ExtraCopy`
help: consider further restricting type parameter `U` with trait `std::marker::Copy`
help: consider further restricting type parameter `U` with trait `Copy`
|
LL | where T: ExtraCopy<U>, U: std::marker::Copy
| ++++++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy`
|
LL | trait ExtraCopy<T:Copy> { }
| ^^^^ required by this bound in `ExtraCopy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | trait SomeTrait<T: std::marker::Copy>: ExtraCopy<T> {
| +++++++++++++++++++

View File

@ -11,7 +11,7 @@ note: required by a bound in `require_copy`
|
LL | fn require_copy<T: Copy>(x: T) {}
| ^^^^ required by this bound in `require_copy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> Foo<T> {
| +++++++++++++++++++

View File

@ -11,7 +11,7 @@ note: required by a bound in `require_copy`
|
LL | fn require_copy<T: Copy>(x: T) {}
| ^^^^ required by this bound in `require_copy`
help: consider restricting type parameter `T` with trait `std::marker::Copy`
help: consider restricting type parameter `T` with trait `Copy`
|
LL | impl<T: std::marker::Copy> Foo<T> for Bar<T> {
| +++++++++++++++++++