Rollup merge of #95525 - ohno418:suggest-derivable-trait-E0277, r=compiler-errors
Suggest derivable trait on E0277 error Closes https://github.com/rust-lang/rust/issues/95099 .
This commit is contained in:
commit
661b0e5b32
61 changed files with 340 additions and 0 deletions
|
@ -540,6 +540,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
);
|
);
|
||||||
self.note_version_mismatch(&mut err, &trait_ref);
|
self.note_version_mismatch(&mut err, &trait_ref);
|
||||||
self.suggest_remove_await(&obligation, &mut err);
|
self.suggest_remove_await(&obligation, &mut err);
|
||||||
|
self.suggest_derive(&obligation, &mut err, trait_predicate);
|
||||||
|
|
||||||
if Some(trait_ref.def_id()) == tcx.lang_items().try_trait() {
|
if Some(trait_ref.def_id()) == tcx.lang_items().try_trait() {
|
||||||
self.suggest_await_before_try(
|
self.suggest_await_before_try(
|
||||||
|
|
|
@ -189,6 +189,13 @@ pub trait InferCtxtExt<'tcx> {
|
||||||
err: &mut Diagnostic,
|
err: &mut Diagnostic,
|
||||||
trait_ref: &ty::PolyTraitRef<'tcx>,
|
trait_ref: &ty::PolyTraitRef<'tcx>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
fn suggest_derive(
|
||||||
|
&self,
|
||||||
|
obligation: &PredicateObligation<'tcx>,
|
||||||
|
err: &mut Diagnostic,
|
||||||
|
trait_pred: ty::PolyTraitPredicate<'tcx>,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn predicate_constraint(generics: &hir::Generics<'_>, pred: String) -> (Span, String) {
|
fn predicate_constraint(generics: &hir::Generics<'_>, pred: String) -> (Span, String) {
|
||||||
|
@ -2651,6 +2658,68 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn suggest_derive(
|
||||||
|
&self,
|
||||||
|
obligation: &PredicateObligation<'tcx>,
|
||||||
|
err: &mut Diagnostic,
|
||||||
|
trait_pred: ty::PolyTraitPredicate<'tcx>,
|
||||||
|
) {
|
||||||
|
let Some(diagnostic_name) = self.tcx.get_diagnostic_name(trait_pred.def_id()) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let (adt, substs) = match trait_pred.skip_binder().self_ty().kind() {
|
||||||
|
ty::Adt(adt, substs) if adt.did().is_local() => (adt, substs),
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
let can_derive = {
|
||||||
|
let is_derivable_trait = match diagnostic_name {
|
||||||
|
sym::Default => !adt.is_enum(),
|
||||||
|
sym::PartialEq | sym::PartialOrd => {
|
||||||
|
let rhs_ty = trait_pred.skip_binder().trait_ref.substs.type_at(1);
|
||||||
|
trait_pred.skip_binder().self_ty() == rhs_ty
|
||||||
|
}
|
||||||
|
sym::Eq | sym::Ord | sym::Clone | sym::Copy | sym::Hash | sym::Debug => true,
|
||||||
|
_ => false,
|
||||||
|
};
|
||||||
|
is_derivable_trait &&
|
||||||
|
// Ensure all fields impl the trait.
|
||||||
|
adt.all_fields().all(|field| {
|
||||||
|
let field_ty = field.ty(self.tcx, substs);
|
||||||
|
let trait_substs = match diagnostic_name {
|
||||||
|
sym::PartialEq | sym::PartialOrd => {
|
||||||
|
self.tcx.mk_substs_trait(field_ty, &[field_ty.into()])
|
||||||
|
}
|
||||||
|
_ => self.tcx.mk_substs_trait(field_ty, &[]),
|
||||||
|
};
|
||||||
|
let trait_pred = trait_pred.map_bound_ref(|tr| ty::TraitPredicate {
|
||||||
|
trait_ref: ty::TraitRef {
|
||||||
|
substs: trait_substs,
|
||||||
|
..trait_pred.skip_binder().trait_ref
|
||||||
|
},
|
||||||
|
..*tr
|
||||||
|
});
|
||||||
|
let field_obl = Obligation::new(
|
||||||
|
obligation.cause.clone(),
|
||||||
|
obligation.param_env,
|
||||||
|
trait_pred.to_predicate(self.tcx),
|
||||||
|
);
|
||||||
|
self.predicate_must_hold_modulo_regions(&field_obl)
|
||||||
|
})
|
||||||
|
};
|
||||||
|
if can_derive {
|
||||||
|
err.span_suggestion_verbose(
|
||||||
|
self.tcx.def_span(adt.did()).shrink_to_lo(),
|
||||||
|
&format!(
|
||||||
|
"consider annotating `{}` with `#[derive({})]`",
|
||||||
|
trait_pred.skip_binder().self_ty(),
|
||||||
|
diagnostic_name.to_string(),
|
||||||
|
),
|
||||||
|
format!("#[derive({})]\n", diagnostic_name.to_string()),
|
||||||
|
Applicability::MaybeIncorrect,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Collect all the returned expressions within the input expression.
|
/// Collect all the returned expressions within the input expression.
|
||||||
|
|
|
@ -5,6 +5,10 @@ LL | let headers = [Header{value: &[]}; 128];
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
|
||||||
|
|
|
|
||||||
= note: the `Copy` trait is required because the repeated element will be copied
|
= note: the `Copy` trait is required because the repeated element will be copied
|
||||||
|
help: consider annotating `Header<'_>` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied
|
error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied
|
||||||
--> $DIR/repeat_empty_ok.rs:13:19
|
--> $DIR/repeat_empty_ok.rs:13:19
|
||||||
|
@ -13,6 +17,10 @@ LL | let headers = [Header{value: &[0]}; 128];
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
|
||||||
|
|
|
|
||||||
= note: the `Copy` trait is required because the repeated element will be copied
|
= note: the `Copy` trait is required because the repeated element will be copied
|
||||||
|
help: consider annotating `Header<'_>` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ note: required by a bound in `Tr::Ty`
|
||||||
|
|
|
|
||||||
LL | type Ty: Clone = NotClone;
|
LL | type Ty: Clone = NotClone;
|
||||||
| ^^^^^ required by this bound in `Tr::Ty`
|
| ^^^^^ required by this bound in `Tr::Ty`
|
||||||
|
help: consider annotating `NotClone` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `NotClone: Clone` is not satisfied
|
error[E0277]: the trait bound `NotClone: Clone` is not satisfied
|
||||||
--> $DIR/defaults-suitability.rs:22:15
|
--> $DIR/defaults-suitability.rs:22:15
|
||||||
|
@ -24,6 +28,10 @@ LL | Self::Ty: Clone,
|
||||||
LL | {
|
LL | {
|
||||||
LL | type Ty = NotClone;
|
LL | type Ty = NotClone;
|
||||||
| -- required by a bound in this
|
| -- required by a bound in this
|
||||||
|
help: consider annotating `NotClone` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `T: Clone` is not satisfied
|
error[E0277]: the trait bound `T: Clone` is not satisfied
|
||||||
--> $DIR/defaults-suitability.rs:28:23
|
--> $DIR/defaults-suitability.rs:28:23
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | x: Error
|
||||||
| ^^^^^^^^ the trait `Clone` is not implemented for `Error`
|
| ^^^^^^^^ the trait `Clone` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | Error
|
||||||
| ^^^^^ the trait `Clone` is not implemented for `Error`
|
| ^^^^^ the trait `Clone` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | x: Error
|
||||||
| ^^^^^^^^ the trait `Clone` is not implemented for `Error`
|
| ^^^^^^^^ the trait `Clone` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | Error
|
||||||
| ^^^^^ the trait `Clone` is not implemented for `Error`
|
| ^^^^^ the trait `Clone` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ LL | x: Error
|
||||||
= help: the trait `Debug` is not implemented for `Error`
|
= help: the trait `Debug` is not implemented for `Error`
|
||||||
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
||||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Debug)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ LL | Error
|
||||||
= help: the trait `Debug` is not implemented for `Error`
|
= help: the trait `Debug` is not implemented for `Error`
|
||||||
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
||||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Debug)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ LL | x: Error
|
||||||
= help: the trait `Debug` is not implemented for `Error`
|
= help: the trait `Debug` is not implemented for `Error`
|
||||||
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
||||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Debug)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ LL | Error
|
||||||
= help: the trait `Debug` is not implemented for `Error`
|
= help: the trait `Debug` is not implemented for `Error`
|
||||||
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
||||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Debug)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | x: Error
|
||||||
| ^^^^^^^^ the trait `Default` is not implemented for `Error`
|
| ^^^^^^^^ the trait `Default` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Default)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Default)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | Error
|
||||||
| ^^^^^ the trait `Default` is not implemented for `Error`
|
| ^^^^^ the trait `Default` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Default)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Default)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ note: required by a bound in `AssertParamIsEq`
|
||||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||||
| ^^ required by this bound in `AssertParamIsEq`
|
| ^^ required by this bound in `AssertParamIsEq`
|
||||||
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Eq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Eq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ note: required by a bound in `AssertParamIsEq`
|
||||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||||
| ^^ required by this bound in `AssertParamIsEq`
|
| ^^ required by this bound in `AssertParamIsEq`
|
||||||
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Eq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Eq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ note: required by a bound in `AssertParamIsEq`
|
||||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||||
| ^^ required by this bound in `AssertParamIsEq`
|
| ^^ required by this bound in `AssertParamIsEq`
|
||||||
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Eq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Eq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ note: required by a bound in `AssertParamIsEq`
|
||||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||||
| ^^ required by this bound in `AssertParamIsEq`
|
| ^^ required by this bound in `AssertParamIsEq`
|
||||||
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Eq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Eq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | x: Error
|
||||||
| ^^^^^^^^ the trait `Hash` is not implemented for `Error`
|
| ^^^^^^^^ the trait `Hash` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Hash)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Hash)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | Error
|
||||||
| ^^^^^ the trait `Hash` is not implemented for `Error`
|
| ^^^^^ the trait `Hash` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Hash)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Hash)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | x: Error
|
||||||
| ^^^^^^^^ the trait `Hash` is not implemented for `Error`
|
| ^^^^^^^^ the trait `Hash` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Hash)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Hash)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | Error
|
||||||
| ^^^^^ the trait `Hash` is not implemented for `Error`
|
| ^^^^^ the trait `Hash` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Hash)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Hash)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | x: Error
|
||||||
| ^^^^^^^^ the trait `Ord` is not implemented for `Error`
|
| ^^^^^^^^ the trait `Ord` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Ord)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Ord)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | Error
|
||||||
| ^^^^^ the trait `Ord` is not implemented for `Error`
|
| ^^^^^ the trait `Ord` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Ord)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Ord)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | x: Error
|
||||||
| ^^^^^^^^ the trait `Ord` is not implemented for `Error`
|
| ^^^^^^^^ the trait `Ord` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Ord)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Ord)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | Error
|
||||||
| ^^^^^ the trait `Ord` is not implemented for `Error`
|
| ^^^^^ the trait `Ord` is not implemented for `Error`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(Ord)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Ord)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ LL | x: Error
|
||||||
|
|
|
|
||||||
= help: the trait `PartialOrd` is not implemented for `Error`
|
= help: the trait `PartialOrd` is not implemented for `Error`
|
||||||
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(PartialOrd)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(PartialOrd)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ LL | Error
|
||||||
|
|
|
|
||||||
= help: the trait `PartialOrd` is not implemented for `Error`
|
= help: the trait `PartialOrd` is not implemented for `Error`
|
||||||
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(PartialOrd)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(PartialOrd)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ LL | x: Error
|
||||||
|
|
|
|
||||||
= help: the trait `PartialOrd` is not implemented for `Error`
|
= help: the trait `PartialOrd` is not implemented for `Error`
|
||||||
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(PartialOrd)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(PartialOrd)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ LL | Error
|
||||||
|
|
|
|
||||||
= help: the trait `PartialOrd` is not implemented for `Error`
|
= help: the trait `PartialOrd` is not implemented for `Error`
|
||||||
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Error` with `#[derive(PartialOrd)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(PartialOrd)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,10 @@ LL | x: NoCloneOrEq
|
||||||
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoCloneOrEq`
|
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoCloneOrEq`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `NoCloneOrEq` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
8
src/test/ui/error-codes/E0277-3.rs
Normal file
8
src/test/ui/error-codes/E0277-3.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fn foo<T: PartialEq>(_: T) {}
|
||||||
|
|
||||||
|
struct S;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
foo(S);
|
||||||
|
//~^ ERROR can't compare `S` with `S`
|
||||||
|
}
|
22
src/test/ui/error-codes/E0277-3.stderr
Normal file
22
src/test/ui/error-codes/E0277-3.stderr
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
error[E0277]: can't compare `S` with `S`
|
||||||
|
--> $DIR/E0277-3.rs:6:9
|
||||||
|
|
|
||||||
|
LL | foo(S);
|
||||||
|
| --- ^ no implementation for `S == S`
|
||||||
|
| |
|
||||||
|
| required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= help: the trait `PartialEq` is not implemented for `S`
|
||||||
|
note: required by a bound in `foo`
|
||||||
|
--> $DIR/E0277-3.rs:1:11
|
||||||
|
|
|
||||||
|
LL | fn foo<T: PartialEq>(_: T) {}
|
||||||
|
| ^^^^^^^^^ required by this bound in `foo`
|
||||||
|
help: consider annotating `S` with `#[derive(PartialEq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(PartialEq)]
|
||||||
|
|
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
|
@ -10,6 +10,10 @@ note: required by a bound in `Family2::Member`
|
||||||
|
|
|
|
||||||
LL | type Member<'a>: for<'b> PartialEq<Self::Member<'b>> = Foo;
|
LL | type Member<'a>: for<'b> PartialEq<Self::Member<'b>> = Foo;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family2::Member`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family2::Member`
|
||||||
|
help: consider annotating `Foo` with `#[derive(PartialEq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(PartialEq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,10 @@ note: required by a bound in `Family::Member`
|
||||||
|
|
|
|
||||||
LL | type Member<'a>: for<'b> PartialEq<Self::Member<'b>>;
|
LL | type Member<'a>: for<'b> PartialEq<Self::Member<'b>>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family::Member`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family::Member`
|
||||||
|
help: consider annotating `Foo` with `#[derive(PartialEq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(PartialEq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to previous error; 1 warning emitted
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ note: required by a bound in `slice::<impl [T]>::sort`
|
||||||
|
|
|
|
||||||
LL | T: Ord,
|
LL | T: Ord,
|
||||||
| ^^^ required by this bound in `slice::<impl [T]>::sort`
|
| ^^^ required by this bound in `slice::<impl [T]>::sort`
|
||||||
|
help: consider annotating `X` with `#[derive(Ord)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Ord)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ LL | struct Foo(Bar);
|
||||||
| ^^^ the trait `Hash` is not implemented for `Bar`
|
| ^^^ the trait `Hash` is not implemented for `Bar`
|
||||||
|
|
|
|
||||||
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Bar` with `#[derive(Hash)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Hash)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable);
|
||||||
|
|
|
|
||||||
= help: the trait `PartialOrd` is not implemented for `Comparable`
|
= help: the trait `PartialOrd` is not implemented for `Comparable`
|
||||||
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Comparable` with `#[derive(PartialOrd)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(PartialEq)] #[derive(PartialOrd)]
|
||||||
|
| +++++++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,10 @@ note: required because of the requirements on the impl of `Gettable<Foo>` for `S
|
||||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||||
| ^^^^^^^^^^^ ^^^^
|
| ^^^^^^^^^^^ ^^^^
|
||||||
= note: required for the cast to the object type `dyn Gettable<Foo>`
|
= note: required for the cast to the object type `dyn Gettable<Foo>`
|
||||||
|
help: consider annotating `Foo` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,10 @@ note: required because of the requirements on the impl of `Gettable<Foo>` for `S
|
||||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||||
| ^^^^^^^^^^^ ^^^^
|
| ^^^^^^^^^^^ ^^^^
|
||||||
= note: required for the cast to the object type `dyn Gettable<Foo>`
|
= note: required for the cast to the object type `dyn Gettable<Foo>`
|
||||||
|
help: consider annotating `Foo` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 7 previous errors
|
error: aborting due to 7 previous errors
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,10 @@ note: required by a bound in `Copy`
|
||||||
LL | pub trait Copy: Clone {
|
LL | pub trait Copy: Clone {
|
||||||
| ^^^^^ required by this bound in `Copy`
|
| ^^^^^ required by this bound in `Copy`
|
||||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Test1` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `Test2: Clone` is not satisfied
|
error[E0277]: the trait bound `Test2: Clone` is not satisfied
|
||||||
--> $DIR/malformed-derive-entry.rs:6:10
|
--> $DIR/malformed-derive-entry.rs:6:10
|
||||||
|
@ -41,6 +45,10 @@ note: required by a bound in `Copy`
|
||||||
LL | pub trait Copy: Clone {
|
LL | pub trait Copy: Clone {
|
||||||
| ^^^^^ required by this bound in `Copy`
|
| ^^^^^ required by this bound in `Copy`
|
||||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Test2` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ note: required by a bound in `Result::<T, E>::unwrap`
|
||||||
|
|
|
|
||||||
LL | E: fmt::Debug,
|
LL | E: fmt::Debug,
|
||||||
| ^^^^^^^^^^ required by this bound in `Result::<T, E>::unwrap`
|
| ^^^^^^^^^^ required by this bound in `Result::<T, E>::unwrap`
|
||||||
|
help: consider annotating `Foo` with `#[derive(Debug)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ LL | let hello = hello.clone();
|
||||||
| ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`, the trait `Clone` is not implemented for `S`
|
| ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`, the trait `Clone` is not implemented for `S`
|
||||||
|
|
|
|
||||||
= note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`
|
= note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`
|
||||||
|
help: consider annotating `S` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ LL | println!("{:?} {:?}", Foo, Bar);
|
||||||
= help: the trait `Debug` is not implemented for `Foo`
|
= help: the trait `Debug` is not implemented for `Foo`
|
||||||
= note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo`
|
= note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo`
|
||||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Foo` with `#[derive(Debug)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
||||||
error[E0277]: `Bar` doesn't implement `Debug`
|
error[E0277]: `Bar` doesn't implement `Debug`
|
||||||
--> $DIR/no-debug.rs:10:32
|
--> $DIR/no-debug.rs:10:32
|
||||||
|
|
|
@ -5,6 +5,10 @@ LL | let _ = [ a; 5 ];
|
||||||
| ^^^^^^^^ the trait `Copy` is not implemented for `Foo`
|
| ^^^^^^^^ the trait `Copy` is not implemented for `Foo`
|
||||||
|
|
|
|
||||||
= note: the `Copy` trait is required because the repeated element will be copied
|
= note: the `Copy` trait is required because the repeated element will be copied
|
||||||
|
help: consider annotating `Foo` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ LL | let _: NotDebug = dbg!(NotDebug);
|
||||||
= help: the trait `Debug` is not implemented for `NotDebug`
|
= help: the trait `Debug` is not implemented for `NotDebug`
|
||||||
= note: add `#[derive(Debug)]` to `NotDebug` or manually `impl Debug for NotDebug`
|
= note: add `#[derive(Debug)]` to `NotDebug` or manually `impl Debug for NotDebug`
|
||||||
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `NotDebug` with `#[derive(Debug)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,10 @@ note: required by a bound in `equals_self`
|
||||||
|
|
|
|
||||||
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
||||||
| ^^^^^^^^^^^^^^^^ required by this bound in `equals_self`
|
| ^^^^^^^^^^^^^^^^ required by this bound in `equals_self`
|
||||||
|
help: consider annotating `S` with `#[derive(PartialEq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(PartialEq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ note: required by a bound in `MyTrait::MyType`
|
||||||
|
|
|
|
||||||
LL | type MyType: Default;
|
LL | type MyType: Default;
|
||||||
| ^^^^^^^ required by this bound in `MyTrait::MyType`
|
| ^^^^^^^ required by this bound in `MyTrait::MyType`
|
||||||
|
help: consider annotating `MyStruct` with `#[derive(Default)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Default)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ note: required by a bound in `S`
|
||||||
|
|
|
|
||||||
LL | struct S<T: Clone> { a: T }
|
LL | struct S<T: Clone> { a: T }
|
||||||
| ^^^^^ required by this bound in `S`
|
| ^^^^^ required by this bound in `S`
|
||||||
|
help: consider annotating `NoClone` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ LL | struct Outer<T>(Inner<T>);
|
||||||
= help: the trait `Debug` is not implemented for `a::Inner<T>`
|
= help: the trait `Debug` is not implemented for `a::Inner<T>`
|
||||||
= note: add `#[derive(Debug)]` to `a::Inner<T>` or manually `impl Debug for a::Inner<T>`
|
= note: add `#[derive(Debug)]` to `a::Inner<T>` or manually `impl Debug for a::Inner<T>`
|
||||||
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `a::Inner<T>` with `#[derive(Debug)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
|
|
||||||
help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
|
help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
|
||||||
|
|
|
|
||||||
LL | struct Outer<T>(Inner<T>) where a::Inner<T>: Debug;
|
LL | struct Outer<T>(Inner<T>) where a::Inner<T>: Debug;
|
||||||
|
|
|
@ -25,6 +25,10 @@ note: required by a bound in `f_clone`
|
||||||
|
|
|
|
||||||
LL | fn f_clone<T: Clone>(t: T) {}
|
LL | fn f_clone<T: Clone>(t: T) {}
|
||||||
| ^^^^^ required by this bound in `f_clone`
|
| ^^^^^ required by this bound in `f_clone`
|
||||||
|
help: consider annotating `S` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:33]` cannot be unpinned
|
error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:33]` cannot be unpinned
|
||||||
--> $DIR/issue-84973-blacklist.rs:17:5
|
--> $DIR/issue-84973-blacklist.rs:17:5
|
||||||
|
|
|
@ -24,6 +24,10 @@ note: required by a bound in `copy`
|
||||||
|
|
|
|
||||||
LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
|
LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
|
||||||
| ^^^^^ required by this bound in `copy`
|
| ^^^^^ required by this bound in `copy`
|
||||||
|
help: consider annotating `NoClone` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ LL | the_foos: Vec<Foo>,
|
||||||
|
|
|
|
||||||
= note: required because of the requirements on the impl of `Clone` for `Vec<Foo>`
|
= note: required because of the requirements on the impl of `Clone` for `Vec<Foo>`
|
||||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `Foo` with `#[derive(Clone)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,10 @@ note: required by a bound in `AssertParamIsCopy`
|
||||||
LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> {
|
LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> {
|
||||||
| ^^^^ required by this bound in `AssertParamIsCopy`
|
| ^^^^ required by this bound in `AssertParamIsCopy`
|
||||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `U1` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,10 @@ note: required by a bound in `AssertParamIsCopy`
|
||||||
LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> {
|
LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> {
|
||||||
| ^^^^ required by this bound in `AssertParamIsCopy`
|
| ^^^^ required by this bound in `AssertParamIsCopy`
|
||||||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `U1` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ note: required by a bound in `AssertParamIsEq`
|
||||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||||
| ^^ required by this bound in `AssertParamIsEq`
|
| ^^ required by this bound in `AssertParamIsEq`
|
||||||
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Eq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ note: required by a bound in `AssertParamIsEq`
|
||||||
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
||||||
| ^^ required by this bound in `AssertParamIsEq`
|
| ^^ required by this bound in `AssertParamIsEq`
|
||||||
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Eq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ note: required by a bound in `IsCopy`
|
||||||
|
|
|
|
||||||
LL | struct IsCopy<T:Copy> { t: T }
|
LL | struct IsCopy<T:Copy> { t: T }
|
||||||
| ^^^^ required by this bound in `IsCopy`
|
| ^^^^ required by this bound in `IsCopy`
|
||||||
|
help: consider annotating `NotCopy` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ note: required by a bound in `IsCopy`
|
||||||
|
|
|
|
||||||
LL | struct IsCopy<T:Copy> { t: T }
|
LL | struct IsCopy<T:Copy> { t: T }
|
||||||
| ^^^^ required by this bound in `IsCopy`
|
| ^^^^ required by this bound in `IsCopy`
|
||||||
|
help: consider annotating `NotCopy` with `#[derive(Copy)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Copy)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ note: required by a bound in `Foo::<T>::equals`
|
||||||
|
|
|
|
||||||
LL | fn equals(&self, u: &Foo<T>) -> bool where T : Eq {
|
LL | fn equals(&self, u: &Foo<T>) -> bool where T : Eq {
|
||||||
| ^^ required by this bound in `Foo::<T>::equals`
|
| ^^ required by this bound in `Foo::<T>::equals`
|
||||||
|
help: consider annotating `Bar` with `#[derive(Eq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Eq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ note: required by a bound in `equal`
|
||||||
|
|
|
|
||||||
LL | fn equal<T>(a: &T, b: &T) -> bool where T : Eq { a == b }
|
LL | fn equal<T>(a: &T, b: &T) -> bool where T : Eq { a == b }
|
||||||
| ^^ required by this bound in `equal`
|
| ^^ required by this bound in `equal`
|
||||||
|
help: consider annotating `Struct` with `#[derive(Eq)]`
|
||||||
|
|
|
||||||
|
LL | #[derive(Eq)]
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue