Mention type parameter in more cases and don't suggest ~const bound already there

This commit is contained in:
Esteban Küber 2024-11-28 21:57:48 +00:00
parent 3f2a63a68b
commit d860e5b088
53 changed files with 106 additions and 172 deletions

View File

@ -1450,6 +1450,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
ty::Param(param_ty) => Ok((
generics.type_param(param_ty, tcx),
predicate.trait_ref.print_trait_sugared().to_string(),
Some(predicate.trait_ref.def_id),
)),
_ => Err(()),
}
@ -1463,9 +1464,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
tcx,
hir_generics,
err,
predicates
.iter()
.map(|(param, constraint)| (param.name.as_str(), &**constraint, None)),
predicates.iter().map(|(param, constraint, def_id)| {
(param.name.as_str(), &**constraint, *def_id)
}),
None,
);
}

View File

@ -140,7 +140,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
err,
param_ty.name.as_str(),
&constraint,
None,
Some(trait_ref.def_id),
None,
);
}

View File

@ -162,7 +162,7 @@ pub fn suggest_arbitrary_trait_bound<'tcx>(
true
}
#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
enum SuggestChangingConstraintsMessage<'a> {
RestrictBoundFurther,
RestrictType { ty: &'a str },
@ -319,6 +319,11 @@ pub fn suggest_constraining_type_params<'a>(
suggest_changing_unsized_bound(generics, &mut suggestions, param, def_id);
}
}
let bound_message = if constraints.iter().any(|(_, def_id, _)| def_id.is_none()) {
SuggestChangingConstraintsMessage::RestrictBoundFurther
} else {
SuggestChangingConstraintsMessage::RestrictTypeFurther { ty: param_name }
};
// in the scenario like impl has stricter requirements than trait,
// we should not suggest restrict bound on the impl, here we double check
@ -389,23 +394,11 @@ pub fn suggest_constraining_type_params<'a>(
format!(" {constraint}")
};
use SuggestChangingConstraintsMessage::RestrictBoundFurther;
if let Some(open_paren_sp) = open_paren_sp {
suggestions.push((
open_paren_sp,
post.clone(),
"(".to_string(),
RestrictBoundFurther,
));
suggestions.push((
span,
post.clone(),
format!("){suggestion}"),
RestrictBoundFurther,
));
suggestions.push((open_paren_sp, post.clone(), "(".to_string(), bound_message));
suggestions.push((span, post.clone(), format!("){suggestion}"), bound_message));
} else {
suggestions.push((span, post.clone(), suggestion, RestrictBoundFurther));
suggestions.push((span, post.clone(), suggestion, bound_message));
}
};

View File

@ -7,7 +7,7 @@ LL | |
LL | | Service<AssocType = <Bug as Foo>::OnlyFoo>
| |______________________________________________^ the trait `Foo` is not implemented for `Bug`
|
help: consider further restricting this bound with trait `Foo`
help: consider further restricting type parameter `Bug` with trait `Foo`
|
LL | pub trait ThriftService<Bug: NotFoo + Foo>:
| +++++
@ -24,7 +24,7 @@ LL | |
LL | | }
| |_^ the trait `Foo` is not implemented for `Bug`
|
help: consider further restricting this bound with trait `Foo`
help: consider further restricting type parameter `Bug` with trait `Foo`
|
LL | pub trait ThriftService<Bug: NotFoo + Foo>:
| +++++
@ -38,7 +38,7 @@ LL | | &self,
LL | | ) -> Self::AssocType;
| |_________________________^ the trait `Foo` is not implemented for `Bug`
|
help: consider further restricting this bound with trait `Foo`
help: consider further restricting type parameter `Bug` with trait `Foo`
|
LL | pub trait ThriftService<Bug: NotFoo + Foo>:
| +++++
@ -61,7 +61,7 @@ error[E0277]: the trait bound `Bug: Foo` is not satisfied
LL | ) -> Self::AssocType;
| ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bug`
|
help: consider further restricting this bound with trait `Foo`
help: consider further restricting type parameter `Bug` with trait `Foo`
|
LL | pub trait ThriftService<Bug: NotFoo + Foo>:
| +++++

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 `Sync`
help: consider further restricting type parameter `T` with trait `Sync`
|
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
| +++++++++++++++++++

View File

@ -30,7 +30,7 @@ LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
| ^ - you could clone this value
| |
| consider constraining this type parameter with `Clone`
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | fn copy<T: Magic + Copy>(x: T) -> (T, T) { (x, x) }
| ++++++

View File

@ -17,7 +17,7 @@ LL | lhs + rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn add<A: Add<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++
@ -64,7 +64,7 @@ LL | lhs - rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn sub<A: Sub<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++
@ -111,7 +111,7 @@ LL | lhs * rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn mul<A: Mul<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++
@ -158,7 +158,7 @@ LL | lhs / rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn div<A: Div<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++
@ -205,7 +205,7 @@ LL | lhs % rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn rem<A: Rem<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++
@ -252,7 +252,7 @@ LL | lhs & rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn bitand<A: BitAnd<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++
@ -299,7 +299,7 @@ LL | lhs | rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn bitor<A: BitOr<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++
@ -346,7 +346,7 @@ LL | lhs ^ rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn bitxor<A: BitXor<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++
@ -393,7 +393,7 @@ LL | lhs << rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn shl<A: Shl<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++
@ -440,7 +440,7 @@ LL | lhs >> rhs;
| --- you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `A` with trait `Copy`
|
LL | fn shr<A: Shr<B, Output=()> + Copy, B>(lhs: A, rhs: B) {
| ++++++

View File

@ -20,7 +20,7 @@ LL | x
| - you could clone this value
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | fn double_move<T: Add<Output=()> + Copy>(x: T) {
| ++++++
@ -40,7 +40,7 @@ help: consider cloning the value if the performance cost is acceptable
|
LL | x.clone()
| ++++++++
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | fn move_then_borrow<T: Add<Output=()> + Clone + Copy>(x: T) {
| ++++++

View File

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

View File

@ -12,7 +12,7 @@ LL |
LL | drop(cloned_items);
| ------------ immutable borrow later used here
|
help: consider further restricting this bound with trait `Clone`
help: consider further restricting type parameter `T` with trait `Clone`
|
LL | fn foo<T: Default + Clone>(list: &mut Vec<T>) {
| +++++++
@ -39,7 +39,7 @@ LL | fn bar<T: std::fmt::Display>(x: T) {
| ^ consider constraining this type parameter with `Clone`
LL | let a = &x;
| - you could clone this value
help: consider further restricting this bound with trait `Clone`
help: consider further restricting type parameter `T` with trait `Clone`
|
LL | fn bar<T: std::fmt::Display + Clone>(x: T) {
| +++++++

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 `Send`
help: consider further restricting type parameter `T` 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 `Sync`
help: consider further restricting type parameter `T` 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 `Send`
help: consider further restricting type parameter `T` 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 `Send`
help: consider further restricting type parameter `T` 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 `Send`
help: consider further restricting type parameter `F` 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 `Send`
help: consider further restricting type parameter `F` 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 `Sync`
help: consider further restricting type parameter `F` with trait `Sync`
|
LL | fn give_owned<F>(f: F) where F: FnOnce() + Send + std::marker::Sync {
| +++++++++++++++++++

View File

@ -212,10 +212,6 @@ LL | f()
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const Fn()`
|
LL | T: ~const Fn<()> + ~const Destruct + ~const Fn(),
| +++++++++++++
error[E0015]: cannot call non-const closure in constant functions
--> $DIR/fn_trait_refs.rs:23:5
@ -224,10 +220,6 @@ LL | f()
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const FnMut()`
|
LL | T: ~const FnMut<()> + ~const Destruct + ~const FnMut(),
| ++++++++++++++++
error[E0015]: cannot call non-const closure in constant functions
--> $DIR/fn_trait_refs.rs:30:5
@ -236,10 +228,6 @@ LL | f()
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const FnOnce()`
|
LL | T: ~const FnOnce<()> + ~const FnOnce(),
| +++++++++++++++++
error: aborting due to 25 previous errors

View File

@ -19,10 +19,6 @@ LL | Opt::None => f(),
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const FnOnce()`
|
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const FnOnce()>(self, f: F) -> T {
| +++++++++++++++++
error[E0493]: destructor of `F` cannot be evaluated at compile-time
--> $DIR/unstable-const-fn-in-libcore.rs:19:60

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 `Bar`
help: consider further restricting type parameter `B` with trait `Bar`
|
LL | where B : Qux + for<'ccx> Bar<'ccx>
| +++++++++++++++++++++

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`
help: consider further restricting type parameter `F` 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`
help: consider further restricting type parameter `F` 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`
help: consider further restricting type parameter `F` 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`
help: consider further restricting type parameter `F` 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`
help: consider further restricting type parameter `F` 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 `Copy`
help: consider further restricting type parameter `S` 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 `Copy`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | fn foo<T: Default + std::marker::Copy>() -> Self::E {
| +++++++++++++++++++

View File

@ -33,10 +33,6 @@ LL | fun(filter_positive());
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const Fn(&foo::Alias<'_>)`
|
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&foo::Alias<'_>)>(fun: F) {
| ++++++++++++++++++++++++++++
error: aborting due to 4 previous errors

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 `Tuple`
help: consider further restricting type parameter `A` 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 `Tuple`
help: consider further restricting type parameter `A` 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 `Tuple`
help: consider further restricting type parameter `A` 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 `Tuple`
help: consider further restricting type parameter `A` 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 `Tuple`
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++

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 `Output`
help: consider further restricting type parameter `F` 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 `Output`
help: consider further restricting type parameter `F` 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 type parameter `F` 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 type parameter `F` 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 `Unsize`
help: consider further restricting type parameter `T` with unstable trait `Unsize`
|
LL | impl<T: ?Sized + std::marker::Unsize<U>, U: ?Sized> CastTo<U> for T {}
| ++++++++++++++++++++++++

View File

@ -18,7 +18,7 @@ note: `Foo::zero` takes ownership of the receiver `self`, which moves `x`
|
LL | fn zero(self) -> Self;
| ^^^^
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | pub fn baz<T: Foo + Copy>(x: T) -> T {
| ++++++

View File

@ -48,7 +48,7 @@ fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where {
fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>)
where
T: A + Copy + Trait,
//~^ HELP consider further restricting this bound
//~^ HELP consider further restricting
{
(t, t) //~ use of moved value: `t`
}
@ -56,14 +56,14 @@ where
fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>)
where
T: A + Copy + Trait,
//~^ HELP consider further restricting this bound
//~^ HELP consider further restricting
T: B,
{
(t, t) //~ use of moved value: `t`
}
fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>)
//~^ HELP consider further restricting this bound
//~^ HELP consider further restricting
where
T: B,
{

View File

@ -48,7 +48,7 @@ fn duplicate_custom_1<T>(t: S<T>) -> (S<T>, S<T>) where {
fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>)
where
T: A,
//~^ HELP consider further restricting this bound
//~^ HELP consider further restricting
{
(t, t) //~ use of moved value: `t`
}
@ -56,14 +56,14 @@ where
fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>)
where
T: A,
//~^ HELP consider further restricting this bound
//~^ HELP consider further restricting
T: B,
{
(t, t) //~ use of moved value: `t`
}
fn duplicate_custom_4<T: A>(t: S<T>) -> (S<T>, S<T>)
//~^ HELP consider further restricting this bound
//~^ HELP consider further restricting
where
T: B,
{

View File

@ -113,7 +113,7 @@ LL | (t, t)
| |
| value moved here
|
help: consider further restricting this bound with traits `Copy` and `Trait`
help: consider further restricting type parameter `T` 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` and `Trait`
help: consider further restricting type parameter `T` 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` and `Trait`
help: consider further restricting type parameter `T` with traits `Copy` and `Trait`
|
LL | fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>)
| ++++++++++++++

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 `PartialEq`
help: consider further restricting type parameter `T` with trait `PartialEq`
|
LL | impl<T: 'static + std::cmp::PartialEq> X 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 `Clone`
help: consider further restricting type parameter `B` 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 `Clone`
help: consider further restricting type parameter `B` 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 `Clone`
help: consider further restricting type parameter `B` 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 `Clone`
help: consider further restricting type parameter `B` with trait `Clone`
|
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied
LL | <T as GlUniformScalar>::FACTORY(1, value);
| ^ the trait `GlUniformScalar` is not implemented for `T`
|
help: consider further restricting this bound with trait `GlUniformScalar`
help: consider further restricting type parameter `T` with trait `GlUniformScalar`
|
LL | pub fn foo<T: UniformScalar + GlUniformScalar>(value: T) {
| +++++++++++++++++

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 `Debug`
help: consider further restricting type parameter `impl Sized` with trait `Debug`
|
LL | fn test_impl(t: impl Sized + std::fmt::Debug) {
| +++++++++++++++++
@ -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 `Debug`
help: consider further restricting type parameter `T` with trait `Debug`
|
LL | fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) {
| +++++++++++++++++
@ -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 `Debug`
help: consider further restricting type parameter `X` 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 `Debug`
help: consider further restricting type parameter `X` with trait `Debug`
|
LL | fn test_many_bounds_where<X>(x: X) where X: Sized + std::fmt::Debug, X: Sized {
| +++++++++++++++++

View File

@ -6,7 +6,7 @@ trait DoesAThing {}
impl DoesAThing for ThingThatDoesAThing {}
fn clones_impl_ref_inline(thing: &impl DoesAThing) {
//~^ HELP consider further restricting this bound
//~^ HELP consider further restricting type parameter `impl DoesAThing` with trait `Clone`
drops_impl_owned(thing.clone()); //~ ERROR E0277
//~^ NOTE copies the reference
//~| NOTE the trait `DoesAThing` is not implemented for `&impl DoesAThing`

View File

@ -9,7 +9,7 @@ note: this `clone()` copies the reference, which does not do anything, because `
|
LL | drops_impl_owned(thing.clone());
| ^^^^^
help: consider further restricting this bound with trait `Clone`
help: consider further restricting type parameter `impl DoesAThing` with trait `Clone`
|
LL | fn clones_impl_ref_inline(thing: &impl DoesAThing + Clone) {
| +++++++

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `&T: X` is not satisfied
LL | foo(s);
| ^ the trait `X` is not implemented for `&T`
|
help: consider further restricting this bound with trait `Clone`
help: consider further restricting type parameter `T` with trait `Clone`
|
LL | fn bar<T: X + Clone>(s: &T) {
| +++++++

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 `Copy`
help: consider further restricting type parameter `K` 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 `Copy`
help: consider further restricting type parameter `K` 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 `Copy`
help: consider further restricting type parameter `K` 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 `Copy`
help: consider further restricting type parameter `K` with trait `Copy`
|
LL | pub struct AABB<K: Debug + std::marker::Copy> {
| +++++++++++++++++++

View File

@ -13,7 +13,7 @@ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
LL | pub loc: Vector2<K>,
| ^^^^^^^^^^
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound with trait `Debug`
help: consider further restricting type parameter `K` with trait `Debug`
|
LL | pub struct AABB<K: Copy + Debug>{
| +++++++
@ -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 `Debug`
help: consider further restricting type parameter `K` 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 `Debug`
help: consider further restricting type parameter `K` 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 `Debug`
help: consider further restricting type parameter `K` with trait `Debug`
|
LL | pub struct AABB<K: Copy + std::fmt::Debug>{
| +++++++++++++++++

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 `Send`
help: consider further restricting type parameter `impl Sync` 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 `Send`
help: consider further restricting type parameter `S` 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 `Send`
help: consider further restricting type parameter `S` 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 `Send`
help: consider further restricting type parameter `S` 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 `Send`
help: consider further restricting type parameter `S` with trait `Send`
|
LL | fn use_bound_and_where<S: Sync + std::marker::Send>(val: S) where S: std::fmt::Debug {
| +++++++++++++++++++

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 `Send`
help: consider further restricting type parameter `T` with trait `Send`
|
LL | fn foo<T:'static + std::marker::Send>() {
| +++++++++++++++++++

View File

@ -42,10 +42,6 @@ LL | *t == *t
| ^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const std::cmp::PartialEq`
|
LL | const fn equals_self<T: ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
| ++++++++++++++++++++++++++++
error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions
--> $DIR/call-generic-method-chain.rs:16:15

View File

@ -42,10 +42,6 @@ LL | *t == *t
| ^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const std::cmp::PartialEq`
|
LL | const fn equals_self<T: PartialEq + ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
| ++++++++++++++++++++++++++++
error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions
--> $DIR/call-generic-method-dup-bound.rs:14:15
@ -62,10 +58,6 @@ LL | *t == *t
| ^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const std::cmp::PartialEq`
|
LL | const fn equals_self2<T: A + ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
| ++++++++++++++++++++++++++++
error: aborting due to 8 previous errors

View File

@ -5,10 +5,6 @@ LL | *t == *t
| ^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const std::cmp::PartialEq`
|
LL | pub const fn equals_self<T: PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
| ++++++++++++++++++++++++++++
error: aborting due to 1 previous error

View File

@ -28,10 +28,6 @@ LL | *t == *t
| ^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const std::cmp::PartialEq`
|
LL | const fn equals_self<T: ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
| ++++++++++++++++++++++++++++
error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions
--> $DIR/call-generic-method-pass.rs:16:15

View File

@ -19,10 +19,6 @@ LL | x(())
| ^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const FnOnce(())`
|
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const FnOnce(())>(x: T) -> i32 {
| +++++++++++++++++++
error: aborting due to 3 previous errors

View File

@ -19,10 +19,6 @@ LL | x(())
| ^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const FnOnce(())`
|
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const FnOnce(())>(x: T) -> i32 {
| +++++++++++++++++++
error: aborting due to 3 previous errors

View File

@ -61,10 +61,6 @@ LL | f() + f()
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const Fn()`
|
LL | const fn answer<F: ~const Fn() -> u8 + ~const Fn()>(f: &F) -> u8 {
| +++++++++++++
error[E0015]: cannot call non-const closure in constant functions
--> $DIR/const-closures.rs:24:11
@ -73,10 +69,6 @@ LL | f() + f()
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const Fn()`
|
LL | const fn answer<F: ~const Fn() -> u8 + ~const Fn()>(f: &F) -> u8 {
| +++++++++++++
error[E0015]: cannot call non-const closure in constant functions
--> $DIR/const-closures.rs:12:5
@ -85,10 +77,6 @@ LL | f() * 7
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider further restricting this bound with trait `~const Fn()`
|
LL | F: ~const FnOnce() -> u8 + ~const Fn(),
| +++++++++++++
error: aborting due to 11 previous errors

View File

@ -33,7 +33,7 @@ note: required by a bound in `Foo::b`
|
LL | fn b() where Self: ~const Bar;
| ^^^^^^^^^^ required by this bound in `Foo::b`
help: consider further restricting this bound with trait `Bar`
help: consider further restricting type parameter `T` with trait `Bar`
|
LL | fn test1<T: Foo + Bar>() {
| +++++
@ -49,7 +49,7 @@ note: required by a bound in `Foo::c`
|
LL | fn c<T: ~const Bar>();
| ^^^^^^^^^^ required by this bound in `Foo::c`
help: consider further restricting this bound with trait `Bar`
help: consider further restricting type parameter `T` with trait `Bar`
|
LL | fn test1<T: Foo + Bar>() {
| +++++

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 `Sync`
help: consider further restricting type parameter `T` 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`
help: consider further restricting type parameter `C` 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`
help: consider further restricting type parameter `C` with trait `CompareTo`
|
LL | fn with_ufcs2<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
| ++++++++++++++++

View File

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

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 `Display`
help: consider further restricting type parameter `T` with trait `Display`
|
LL | type Foo<T: Debug + std::fmt::Display> = (impl Debug, Struct<T>);
| +++++++++++++++++++

View File

@ -9,7 +9,7 @@ note: required by a bound in `PtrComponents`
|
LL | struct PtrComponents<T: Pointee + ?Sized> {
| ^^^^^^^ required by this bound in `PtrComponents`
help: consider further restricting this bound with trait `Pointee`
help: consider further restricting type parameter `T` with trait `Pointee`
|
LL | union PtrRepr<T: ?Sized + Pointee> {
| +++++++++

View File

@ -15,7 +15,7 @@ help: consider cloning the value if the performance cost is acceptable
|
LL | !x.clone();
| ++++++++
help: consider further restricting this bound with trait `Copy`
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | fn move_then_borrow<T: Not<Output=T> + Clone + Copy>(x: T) {
| ++++++