Keep more information about trait binding failures.
let identity_proj = tcx.mk_projection(assoc_item_def_id, identity_substs);
self.collect_outlives_from_predicate_list(
move |ty| ty == identity_proj,
- traits::elaborate_predicates(tcx, trait_predicates),
+ traits::elaborate_predicates(tcx, trait_predicates)
+ .into_iter()
+ .map(|o| o.predicate)
+ .collect::<Vec<_>>(),
)
.map(|b| b.1)
}
use smallvec::smallvec;
+use crate::traits::{Obligation, ObligationCause, PredicateObligation};
use rustc_data_structures::fx::FxHashSet;
use rustc_middle::ty::outlives::Component;
use rustc_middle::ty::{self, ToPolyTraitRef, ToPredicate, TyCtxt, WithConstness};
+use rustc_span::Span;
pub fn anonymize_predicate<'tcx>(
tcx: TyCtxt<'tcx>,
/// holds as well. Similarly, if we have `trait Foo: 'static`, and we know that
/// `T: Foo`, then we know that `T: 'static`.
pub struct Elaborator<'tcx> {
- stack: Vec<ty::Predicate<'tcx>>,
+ stack: Vec<PredicateObligation<'tcx>>,
visited: PredicateSet<'tcx>,
}
) -> Elaborator<'tcx> {
let mut visited = PredicateSet::new(tcx);
predicates.retain(|pred| visited.insert(pred));
- Elaborator { stack: predicates, visited }
+ let obligations: Vec<_> =
+ predicates.into_iter().map(|predicate| predicate_obligation(predicate, None)).collect();
+ elaborate_obligations(tcx, obligations)
+}
+
+pub fn elaborate_obligations<'tcx>(
+ tcx: TyCtxt<'tcx>,
+ mut obligations: Vec<PredicateObligation<'tcx>>,
+) -> Elaborator<'tcx> {
+ let mut visited = PredicateSet::new(tcx);
+ obligations.retain(|obligation| visited.insert(&obligation.predicate));
+ Elaborator { stack: obligations, visited }
+}
+
+fn predicate_obligation<'tcx>(
+ predicate: ty::Predicate<'tcx>,
+ span: Option<Span>,
+) -> PredicateObligation<'tcx> {
+ let mut cause = ObligationCause::dummy();
+ if let Some(span) = span {
+ cause.span = span;
+ }
+ Obligation { cause, param_env: ty::ParamEnv::empty(), recursion_depth: 0, predicate }
}
impl Elaborator<'tcx> {
FilterToTraits::new(self)
}
- fn elaborate(&mut self, predicate: &ty::Predicate<'tcx>) {
+ fn elaborate(&mut self, obligation: &PredicateObligation<'tcx>) {
let tcx = self.visited.tcx;
- match *predicate {
+ match obligation.predicate {
ty::Predicate::Trait(ref data, _) => {
// Get predicates declared on the trait.
let predicates = tcx.super_predicates_of(data.def_id());
- let predicates = predicates
- .predicates
- .iter()
- .map(|(pred, _)| pred.subst_supertrait(tcx, &data.to_poly_trait_ref()));
- debug!("super_predicates: data={:?} predicates={:?}", data, predicates.clone());
+ let obligations = predicates.predicates.iter().map(|(pred, span)| {
+ predicate_obligation(
+ pred.subst_supertrait(tcx, &data.to_poly_trait_ref()),
+ Some(*span),
+ )
+ });
+ debug!("super_predicates: data={:?} predicates={:?}", data, &obligations);
// Only keep those bounds that we haven't already seen.
// This is necessary to prevent infinite recursion in some
// cases. One common case is when people define
// `trait Sized: Sized { }` rather than `trait Sized { }`.
let visited = &mut self.visited;
- let predicates = predicates.filter(|pred| visited.insert(pred));
+ let obligations =
+ obligations.filter(|obligation| visited.insert(&obligation.predicate));
- self.stack.extend(predicates);
+ self.stack.extend(obligations);
}
ty::Predicate::WellFormed(..) => {
// Currently, we do not elaborate WF predicates,
None
}
})
- .filter(|p| visited.insert(p)),
+ .filter(|p| visited.insert(p))
+ .map(|p| predicate_obligation(p, None)),
);
}
}
}
impl Iterator for Elaborator<'tcx> {
- type Item = ty::Predicate<'tcx>;
+ type Item = PredicateObligation<'tcx>;
fn size_hint(&self) -> (usize, Option<usize>) {
(self.stack.len(), None)
}
- fn next(&mut self) -> Option<ty::Predicate<'tcx>> {
+ fn next(&mut self) -> Option<Self::Item> {
// Extract next item from top-most stack frame, if any.
- if let Some(pred) = self.stack.pop() {
- self.elaborate(&pred);
- Some(pred)
+ if let Some(obligation) = self.stack.pop() {
+ self.elaborate(&obligation);
+ Some(obligation)
} else {
None
}
}
}
-impl<'tcx, I: Iterator<Item = ty::Predicate<'tcx>>> Iterator for FilterToTraits<I> {
+impl<'tcx, I: Iterator<Item = PredicateObligation<'tcx>>> Iterator for FilterToTraits<I> {
type Item = ty::PolyTraitRef<'tcx>;
fn next(&mut self) -> Option<ty::PolyTraitRef<'tcx>> {
- while let Some(pred) = self.base_iterator.next() {
- if let ty::Predicate::Trait(data, _) = pred {
+ while let Some(obligation) = self.base_iterator.next() {
+ if let ty::Predicate::Trait(data, _) = obligation.predicate {
return Some(data.to_poly_trait_ref());
}
}
.collect();
if !traits::normalize_and_test_predicates(
tcx,
- traits::elaborate_predicates(tcx, predicates).collect(),
+ traits::elaborate_predicates(tcx, predicates).map(|o| o.predicate).collect(),
) {
trace!("ConstProp skipped for {:?}: found unsatisfiable predicates", source.def_id());
return;
assert!(!erased_self_ty.has_escaping_bound_vars());
traits::elaborate_predicates(tcx, predicates)
- .filter_map(|predicate| {
- match predicate {
+ .filter_map(|obligation| {
+ match obligation.predicate {
ty::Predicate::Projection(..)
| ty::Predicate::Trait(..)
| ty::Predicate::Subtype(..)
computed_preds.extend(user_computed_preds.iter().cloned());
let normalized_preds =
- elaborate_predicates(tcx, computed_preds.iter().cloned().collect());
+ elaborate_predicates(tcx, computed_preds.iter().cloned().collect())
+ .map(|o| o.predicate);
new_env =
ty::ParamEnv::new(tcx.mk_predicates(normalized_preds), param_env.reveal, None);
}
}
};
- for implication in super::elaborate_predicates(self.tcx, vec![*cond]) {
- if let ty::Predicate::Trait(implication, _) = implication {
+ for obligation in super::elaborate_predicates(self.tcx, vec![*cond]) {
+ if let ty::Predicate::Trait(implication, _) = obligation.predicate {
let error = error.to_poly_trait_ref();
let implication = implication.to_poly_trait_ref();
// FIXME: I'm just not taking associated types at all here.
(self.tcx.sess.source_map().span_to_snippet(span), &obligation.cause.code)
{
let generics = self.tcx.generics_of(*def_id);
- if !generics.params.is_empty() && !snippet.ends_with('>') {
+ if generics.params.iter().filter(|p| p.name.as_str() != "Self").next().is_some() && !snippet.ends_with('>') {
// FIXME: To avoid spurious suggestions in functions where type arguments
// where already supplied, we check the snippet to make sure it doesn't
// end with a turbofish. Ideally we would have access to a `PathSegment`
}
}
- if let ObligationCauseCode::ItemObligation(item) = obligation.cause.code {
+ if let ObligationCauseCode::ItemObligation(item)
+ | ObligationCauseCode::BindingObligation(item, _) = obligation.cause.code
+ {
// FIXME: maybe also have some way of handling methods
// from other traits? That would require name resolution,
// which we might want to be some sort of hygienic.
ObligationCauseCode::ItemObligation(item_def_id) => {
let item_name = tcx.def_path_str(item_def_id);
let msg = format!("required by `{}`", item_name);
-
if let Some(sp) = tcx.hir().span_if_local(item_def_id) {
let sp = tcx.sess.source_map().guess_head_span(sp);
err.span_label(sp, &msg);
let item_name = tcx.def_path_str(item_def_id);
let msg = format!("required by this bound in `{}`", item_name);
if let Some(ident) = tcx.opt_item_name(item_def_id) {
- err.span_label(ident.span, "");
+ if !ident.span.overlaps(span) {
+ err.span_label(ident.span, "");
+ }
}
if span != DUMMY_SP {
err.span_label(span, &msg);
);
let mut predicates: Vec<_> =
- util::elaborate_predicates(tcx, unnormalized_env.caller_bounds.to_vec()).collect();
+ util::elaborate_predicates(tcx, unnormalized_env.caller_bounds.to_vec())
+ .map(|obligation| obligation.predicate)
+ .collect();
debug!("normalize_param_env_or_error: elaborated-predicates={:?}", predicates);
// Search for a predicate like `Self : Sized` amongst the trait bounds.
let predicates = tcx.predicates_of(def_id);
let predicates = predicates.instantiate_identity(tcx).predicates;
- elaborate_predicates(tcx, predicates).any(|predicate| match predicate {
+ elaborate_predicates(tcx, predicates).any(|obligation| match obligation.predicate {
ty::Predicate::Trait(ref trait_pred, _) => {
trait_pred.def_id() == sized_def_id && trait_pred.skip_binder().self_ty().is_param(0)
}
// If so, extract what we know from the trait and try to come up with a good answer.
let trait_predicates = tcx.predicates_of(def_id);
let bounds = trait_predicates.instantiate(tcx, substs);
- let bounds = elaborate_predicates(tcx, bounds.predicates);
+ let bounds = elaborate_predicates(tcx, bounds.predicates).map(|o| o.predicate);
assemble_candidates_from_predicates(
selcx,
obligation,
// select only those projections that are actually projecting an
// item with the correct name
- let env_predicates = env_predicates.filter_map(|p| match p {
+ let env_predicates = env_predicates.filter_map(|o| match o.predicate {
ty::Predicate::Projection(data) => {
if data.projection_def_id() == obligation.predicate.item_def_id {
Some(data)
let item = self.item;
if let Elaborate::All = elaborate {
- let predicates = obligations.iter().map(|obligation| obligation.predicate).collect();
- let implied_obligations = traits::elaborate_predicates(tcx, predicates);
- let implied_obligations = implied_obligations.map(|pred| {
+ let implied_obligations = traits::util::elaborate_obligations(tcx, obligations.clone());
+ let implied_obligations = implied_obligations.map(|obligation| {
let mut cause = cause.clone();
extend_cause_with_original_assoc_item_obligation(
tcx,
trait_ref,
item,
&mut cause,
- &pred,
+ &obligation.predicate,
tcx.associated_items(trait_ref.def_id).in_definition_order().copied(),
);
- traits::Obligation::new(cause, param_env, pred)
+ traits::Obligation::new(cause, param_env, obligation.predicate)
});
self.out.extend(implied_obligations);
}
substs: SubstsRef<'tcx>,
) -> Vec<traits::PredicateObligation<'tcx>> {
let predicates = self.infcx.tcx.predicates_of(def_id).instantiate(self.infcx.tcx, substs);
- let cause = self.cause(traits::ItemObligation(def_id));
predicates
.predicates
.into_iter()
- .map(|pred| traits::Obligation::new(cause.clone(), self.param_env, pred))
+ .zip(predicates.spans.into_iter())
+ .map(|(pred, span)| {
+ let cause = self.cause(traits::BindingObligation(def_id, span));
+ traits::Obligation::new(cause, self.param_env, pred)
+ })
.filter(|pred| !pred.has_escaping_bound_vars())
.collect()
}
for (base_trait_ref, span, constness) in regular_traits_refs_spans {
assert_eq!(constness, Constness::NotConst);
- for trait_ref in traits::elaborate_trait_ref(tcx, base_trait_ref) {
+ for obligation in traits::elaborate_trait_ref(tcx, base_trait_ref) {
debug!(
"conv_object_ty_poly_trait_ref: observing object predicate `{:?}`",
- trait_ref
+ obligation.predicate
);
- match trait_ref {
+ match obligation.predicate {
ty::Predicate::Trait(pred, _) => {
associated_types.entry(span).or_default().extend(
tcx.associated_items(pred.def_id())
};
traits::elaborate_predicates(self.tcx, predicates.predicates.clone())
- .filter_map(|predicate| match predicate {
+ .filter_map(|obligation| match obligation.predicate {
ty::Predicate::Trait(trait_pred, _) if trait_pred.def_id() == sized_def_id => {
let span = predicates
.predicates
.iter()
.zip(predicates.spans.iter())
- .filter_map(|(p, span)| if *p == predicate { Some(*span) } else { None })
+ .filter_map(
+ |(p, span)| if *p == obligation.predicate { Some(*span) } else { None },
+ )
.next()
.unwrap_or(rustc_span::DUMMY_SP);
Some((trait_pred, span))
// Check elaborated bounds.
let implied_obligations = traits::elaborate_predicates(fcx.tcx, predicates);
- for pred in implied_obligations {
+ for obligation in implied_obligations {
+ let pred = obligation.predicate;
// Match the existing behavior.
if pred.is_global() && !pred.has_late_bound_regions() {
let pred = fcx.normalize_associated_types_in(span, &pred);
// prove that the trait applies to the types that were
// used, and adding the predicate into this list ensures
// that this is done.
- let span = tcx.def_span(def_id);
+ let span = tcx.sess.source_map().guess_head_span(tcx.def_span(def_id));
result.predicates =
tcx.arena.alloc_from_iter(result.predicates.iter().copied().chain(std::iter::once((
ty::TraitRef::identity(tcx, def_id).without_const().to_predicate(),
.extend(obligations.into_iter().map(|obligation| obligation.predicate))
}
}
- impl2_predicates.predicates.extend(traits::elaborate_predicates(tcx, always_applicable_traits));
+ impl2_predicates.predicates.extend(
+ traits::elaborate_predicates(tcx, always_applicable_traits)
+ .map(|obligation| obligation.predicate),
+ );
for predicate in impl1_predicates.predicates {
if !impl2_predicates.predicates.contains(&predicate) {
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
LL | trait Case1 {
- | ----------- required by `Case1`
+ | -----
+LL | type C: Clone + Iterator<Item:
+LL | Send + Iterator<Item:
+ | ---- required by this bound in `Case1`
...
LL | fn assume_case1<T: Case1>() {
| ^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Send`
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
LL | trait Case1 {
- | ----------- required by `Case1`
+ | -----
+...
+LL | > + Sync>;
+ | ---- required by this bound in `Case1`
...
LL | fn assume_case1<T: Case1>() {
| ^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Sync`
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
LL | trait Case1 {
- | ----------- required by `Case1`
+ | -----
+...
+LL | Debug
+ | ----- required by this bound in `Case1`
...
LL | fn assume_case1<T: Case1>() {
| ^^^^^ `<_ as Lam<&'a u8>>::App` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
--> $DIR/associated-types-overridden-binding.rs:4:12
|
LL | trait Foo: Iterator<Item = i32> {}
- | ------------------------------- required by `Foo`
+ | --- ---------- required by this bound in `Foo`
LL | trait Bar: Foo<Item = u32> {}
| ^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self`
|
--> $DIR/associated-types-overridden-binding.rs:7:21
|
LL | trait I32Iterator = Iterator<Item = i32>;
- | ----------------------------------------- required by `I32Iterator`
+ | ----------- ---------- required by this bound in `I32Iterator`
LL | trait U32Iterator = I32Iterator<Item = u32>;
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self`
|
|
LL | type Ty = Vec<[u8]>;
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ ::: $SRC_DIR/liballoc/vec.rs:LL:COL
+ |
+LL | pub struct Vec<T> {
+ | - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
- = note: required by `std::vec::Vec`
error: aborting due to 11 previous errors
|
LL | let x: Vec<dyn Trait + Sized> = Vec::new();
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ ::: $SRC_DIR/liballoc/vec.rs:LL:COL
+ |
+LL | pub struct Vec<T> {
+ | - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
- = note: required by `std::vec::Vec`
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
--> $DIR/bad-sized.rs:4:37
--> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:22
|
LL | struct X<F> where F: FnOnce() + 'static + Send {
- | ---------------------------------------------- required by `X`
+ | - ---- required by this bound in `X`
...
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
| ^^^^ `F` cannot be sent between threads safely
--> $DIR/too_generic_eval_ice.rs:7:13
|
LL | pub struct Foo<A, B>(A, B);
- | --------------------------- required by `Foo`
+ | --- - required by this bound in `Foo`
LL |
LL | impl<A, B> Foo<A, B> {
| - this type parameter needs to be `std::marker::Sized`
--> $DIR/too_generic_eval_ice.rs:7:13
|
LL | pub struct Foo<A, B>(A, B);
- | --------------------------- required by `Foo`
+ | --- - required by this bound in `Foo`
LL |
LL | impl<A, B> Foo<A, B> {
| - this type parameter needs to be `std::marker::Sized`
|
LL | x: Error
| ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
+ |
+ ::: $SRC_DIR/libcore/cmp.rs:LL:COL
+ |
+LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
+ | -- required by this bound in `std::cmp::AssertParamIsEq`
|
- = note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
LL | Error
| ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
+ |
+ ::: $SRC_DIR/libcore/cmp.rs:LL:COL
+ |
+LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
+ | -- required by this bound in `std::cmp::AssertParamIsEq`
|
- = note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
LL | x: Error
| ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
+ |
+ ::: $SRC_DIR/libcore/cmp.rs:LL:COL
+ |
+LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
+ | -- required by this bound in `std::cmp::AssertParamIsEq`
|
- = note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
|
LL | Error
| ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
+ |
+ ::: $SRC_DIR/libcore/cmp.rs:LL:COL
+ |
+LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
+ | -- required by this bound in `std::cmp::AssertParamIsEq`
|
- = note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
--> $DIR/E0275.rs:5:33
|
LL | trait Foo {}
- | --------- required by `Foo`
+ | --------- required by this bound in `Foo`
...
LL | impl<T> Foo for T where Bar<T>: Foo {}
| ^^^
--> $DIR/issue-62326-parameter-out-of-range.rs:7:20
|
LL | trait Iterator {
- | -------------- required by `Iterator`
+ | --------
LL | type Item<'a>: 'a;
- | ^^
+ | ^^ required by this bound in `Iterator`
error: aborting due to previous error
--> $DIR/iterable.rs:19:30
|
LL | trait Iterable {
- | -------------- required by `Iterable`
+ | --------
+LL | type Item<'a> where Self: 'a;
+LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a;
+ | --------------------- required by this bound in `Iterable`
...
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^^^^^^^^^^^^^ expected associated type, found reference
--> $DIR/iterable.rs:31:30
|
LL | trait Iterable {
- | -------------- required by `Iterable`
+ | --------
+LL | type Item<'a> where Self: 'a;
+LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a;
+ | --------------------- required by this bound in `Iterable`
...
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^^^^^^^^^^^^^ expected associated type, found reference
//~^ ERROR the size for values of type
}
+enum Option<T> {
+ Some(T),
+ None,
+}
+
fn main() {}
|
LL | fn ho_func(f: Option<FuncType>) {
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+...
+LL | enum Option<T> {
+ | ------ - required by this bound in `Option`
|
= help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
- = note: required by `std::option::Option`
error: aborting due to previous error
--> $DIR/issue-20005.rs:10:49
|
LL | trait From<Src> {
- | --------------- required by `From`
+ | ---- --- required by this bound in `From`
...
LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
| ^^^^^^^^^^- help: consider further restricting `Self`: `, Self: std::marker::Sized`
--> $DIR/issue-20413.rs:8:36
|
LL | trait Foo {
- | --------- required by `Foo`
+ | --------- required by this bound in `Foo`
...
LL | impl<T> Foo for T where NoData<T>: Foo {
| ^^^
--> $DIR/issue-20413.rs:8:36
|
LL | trait Foo {
- | --------- required by `Foo`
+ | --------- required by this bound in `Foo`
...
LL | impl<T> Foo for T where NoData<T>: Foo {
| ^^^
|
LL | fn iceman(c: Vec<[i32]>) {}
| ^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ ::: $SRC_DIR/liballoc/vec.rs:LL:COL
+ |
+LL | pub struct Vec<T> {
+ | - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `[i32]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
- = note: required by `std::vec::Vec`
error: aborting due to previous error
--> $DIR/issue-21837.rs:8:9
|
LL | pub struct Foo<T: Bound>(T);
- | ---------------------------- required by `Foo`
+ | --- ----- required by this bound in `Foo`
...
LL | impl<T> Trait2 for Foo<T> {}
| ^^^^^^ the trait `Bound` is not implemented for `T`
--> $DIR/issue-21974.rs:11:19
|
LL | trait Foo {
- | --------- required by `Foo`
+ | --------- required by this bound in `Foo`
...
LL | where &'a T : Foo,
| ^^^ cannot infer type for reference `&'a T`
//~^ ERROR the size for values of type
}
+struct Vec<T> {
+ t: T,
+}
+
fn main() {}
|
LL | pub fn function(funs: Vec<dyn Fn() -> ()>) {}
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+...
+LL | struct Vec<T> {
+ | --- - required by this bound in `Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
- = note: required by `std::vec::Vec`
error: aborting due to previous error
--> $DIR/issue-24204.rs:14:12
|
LL | trait Trait: Sized {
- | ------------------ required by `Trait`
+ | -----
+LL | type A: MultiDispatch<Self::B, O = Self>;
+ | -------- required by this bound in `Trait`
...
LL | fn test<T: Trait<B=i32>>(b: i32) -> T where T::A: MultiDispatch<i32> { T::new(b) }
| ^^^^^^^^^^^^ expected type parameter `T`, found associated type
--> $DIR/issue-24424.rs:4:57
|
LL | trait Trait0<'l0> {}
- | ----------------- required by `Trait0`
+ | ----------------- required by this bound in `Trait0`
LL |
LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {}
| ^^^^^^^^^^^ cannot infer type for type parameter `T0`
--> $DIR/bound.rs:2:10
|
LL | struct S<I: Iterator>(I);
- | ------------------------- required by `S`
+ | - -------- required by this bound in `S`
LL | struct T(S<u8>);
| ^^^^^ `u8` is not an iterator
|
--> $DIR/recursive-requirements.rs:16:12
|
LL | struct AssertSync<T: Sync>(PhantomData<T>);
- | ------------------------------------------- required by `AssertSync`
+ | ---------- ---- required by this bound in `AssertSync`
...
LL | let _: AssertSync<Foo> = unimplemented!();
| ^^^^^^^^^^^^^^^ `*const Bar` cannot be shared between threads safely
--> $DIR/recursive-requirements.rs:16:12
|
LL | struct AssertSync<T: Sync>(PhantomData<T>);
- | ------------------------------------------- required by `AssertSync`
+ | ---------- ---- required by this bound in `AssertSync`
...
LL | let _: AssertSync<Foo> = unimplemented!();
| ^^^^^^^^^^^^^^^ `*const Foo` cannot be shared between threads safely
--> $DIR/missing-assoc-type-bound-restriction.rs:17:19
|
LL | trait Parent {
- | ------------ required by `Parent`
+ | ------
+LL | type Ty;
+LL | type Assoc: Child<Self::Ty>;
+ | --------------- required by this bound in `Parent`
...
LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
| ^^^^^^ - help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
--> $DIR/missing-assoc-type-bound-restriction.rs:20:5
|
LL | trait Parent {
- | ------------ required by `Parent`
+ | ------
+LL | type Ty;
+LL | type Assoc: Child<Self::Ty>;
+ | --------------- required by this bound in `Parent`
...
LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
| - help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
|
LL | let fp = BufWriter::new(fp);
| ^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
+ |
+ ::: $SRC_DIR/libstd/io/buffered.rs:LL:COL
+ |
+LL | pub struct BufWriter<W: Write> {
+ | ----- required by this bound in `std::io::BufWriter`
|
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
- = note: required by `std::io::BufWriter`
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
|
LL | let fp = BufWriter::new(fp);
| ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
+ |
+ ::: $SRC_DIR/libstd/io/buffered.rs:LL:COL
+ |
+LL | pub struct BufWriter<W: Write> {
+ | ----- required by this bound in `std::io::BufWriter`
|
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
- = note: required by `std::io::BufWriter`
error[E0599]: no method named `write_fmt` found for struct `std::io::BufWriter<&dyn std::io::Write>` in the current scope
--> $DIR/mut-borrow-needed-by-trait.rs:22:5
--> $DIR/negated-auto-traits-error.rs:23:5
|
LL | struct Outer<T: Send>(T);
- | ------------------------- required by `Outer`
+ | ----- ---- required by this bound in `Outer`
...
LL | Outer(TestType);
| ^^^^^^^^^^^^^^^ `dummy::TestType` cannot be sent between threads safely
--> $DIR/trait-alias-wf.rs:5:14
|
LL | trait A<T: Foo> {}
- | --------------- required by `A`
+ | - --- required by this bound in `A`
LL | trait B<T> = A<T>;
| ^^^^ the trait `Foo` is not implemented for `T`
|
--> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:13:15
|
LL | struct Foo<T:Trait> {
- | ------------------- required by `Foo`
+ | --- ----- required by this bound in `Foo`
...
LL | fn explode(x: Foo<u32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `u32`
--> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:16:14
|
LL | enum Bar<T:Trait> {
- | ----------------- required by `Bar`
+ | --- ----- required by this bound in `Bar`
...
LL | fn kaboom(y: Bar<f32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `f32`
--> $DIR/trait-bounds-on-structs-and-enums-in-impls.rs:20:6
|
LL | struct Foo<T:Trait> {
- | ------------------- required by `Foo`
+ | --- ----- required by this bound in `Foo`
...
LL | impl PolyTrait<Foo<u16>> for Struct {
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u16`
--> $DIR/trait-bounds-on-structs-and-enums-locals.rs:15:14
|
LL | struct Foo<T:Trait> {
- | ------------------- required by `Foo`
+ | --- ----- required by this bound in `Foo`
...
LL | let baz: Foo<usize> = loop { };
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
--> $DIR/trait-bounds-on-structs-and-enums-static.rs:9:11
|
LL | struct Foo<T:Trait> {
- | ------------------- required by `Foo`
+ | --- ----- required by this bound in `Foo`
...
LL | static X: Foo<usize> = Foo {
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
|
LL | fn explode(x: Foo<usize>) {}
| ^^^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `usize`
+ |
+ ::: $DIR/auxiliary/trait_bounds_on_structs_and_enums_xc.rs:5:18
|
- = note: required by `trait_bounds_on_structs_and_enums_xc::Foo`
+LL | pub struct Foo<T:Trait> {
+ | ----- required by this bound in `trait_bounds_on_structs_and_enums_xc::Foo`
error[E0277]: the trait bound `f32: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-xc.rs:10:14
|
LL | fn kaboom(y: Bar<f32>) {}
| ^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `f32`
+ |
+ ::: $DIR/auxiliary/trait_bounds_on_structs_and_enums_xc.rs:9:16
|
- = note: required by `trait_bounds_on_structs_and_enums_xc::Bar`
+LL | pub enum Bar<T:Trait> {
+ | ----- required by this bound in `trait_bounds_on_structs_and_enums_xc::Bar`
error: aborting due to 2 previous errors
|
LL | let bar: Bar<f64> = return;
| ^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `f64`
+ |
+ ::: $DIR/auxiliary/trait_bounds_on_structs_and_enums_xc.rs:9:16
|
- = note: required by `trait_bounds_on_structs_and_enums_xc::Bar`
+LL | pub enum Bar<T:Trait> {
+ | ----- required by this bound in `trait_bounds_on_structs_and_enums_xc::Bar`
error[E0277]: the trait bound `{integer}: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:8:15
--> $DIR/trait-bounds-on-structs-and-enums.rs:13:9
|
LL | struct Foo<T:Trait> {
- | ------------------- required by `Foo`
+ | --- ----- required by this bound in `Foo`
...
LL | impl<T> Foo<T> {
| ^^^^^^ the trait `Trait` is not implemented for `T`
--> $DIR/trait-bounds-on-structs-and-enums.rs:19:5
|
LL | struct Foo<T:Trait> {
- | ------------------- required by `Foo`
+ | --- ----- required by this bound in `Foo`
...
LL | a: Foo<isize>,
| ^^^^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
--> $DIR/trait-bounds-on-structs-and-enums.rs:23:10
|
LL | enum Bar<T:Trait> {
- | ----------------- required by `Bar`
+ | --- ----- required by this bound in `Bar`
...
LL | Quux(Bar<usize>),
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
--> $DIR/trait-bounds-on-structs-and-enums.rs:27:5
|
LL | struct Foo<T:Trait> {
- | ------------------- required by `Foo`
+ | --- ----- required by this bound in `Foo`
...
LL | b: Foo<U>,
| ^^^^^^^^^ the trait `Trait` is not implemented for `U`
--> $DIR/trait-bounds-on-structs-and-enums.rs:31:21
|
LL | enum Bar<T:Trait> {
- | ----------------- required by `Bar`
+ | --- ----- required by this bound in `Bar`
...
LL | EvenMoreBadness(Bar<V>),
| ^^^^^^ the trait `Trait` is not implemented for `V`
--> $DIR/trait-bounds-on-structs-and-enums.rs:35:5
|
LL | struct Foo<T:Trait> {
- | ------------------- required by `Foo`
+ | --- ----- required by this bound in `Foo`
...
LL | Foo<i32>,
| ^^^^^^^^ the trait `Trait` is not implemented for `i32`
--> $DIR/trait-bounds-on-structs-and-enums.rs:39:22
|
LL | enum Bar<T:Trait> {
- | ----------------- required by `Bar`
+ | --- ----- required by this bound in `Bar`
...
LL | DictionaryLike { field: Bar<u8> },
| ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u8`
--> $DIR/type-check-defaults.rs:6:19
|
LL | struct Foo<T, U: FromIterator<T>>(T, U);
- | ---------------------------------------- required by `Foo`
+ | --- --------------- required by this bound in `Foo`
LL | struct WellFormed<Z = Foo<i32, i32>>(Z);
| ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
|
--> $DIR/type-check-defaults.rs:8:27
|
LL | struct Foo<T, U: FromIterator<T>>(T, U);
- | ---------------------------------------- required by `Foo`
+ | --- --------------- required by this bound in `Foo`
...
LL | struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z);
| ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
--> $DIR/type-check-defaults.rs:21:25
|
LL | trait Super<T: Copy> { }
- | -------------------- required by `Super`
+ | ----- ---- required by this bound in `Super`
LL | trait Base<T = String>: Super<T> { }
| ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
|
--> $DIR/issue-40294.rs:6:19
|
LL | trait Foo: Sized {
- | ---------------- required by `Foo`
+ | ---------------- required by this bound in `Foo`
...
LL | where &'a T : Foo,
| ^^^ cannot infer type for reference `&'a T`
|
LL | #[derive(Clone)]
| ^^^^^ the trait `std::marker::Copy` is not implemented for `U1`
+ |
+ ::: $SRC_DIR/libcore/clone.rs:LL:COL
+ |
+LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> {
+ | ---- required by this bound in `std::clone::AssertParamIsCopy`
|
- = note: required by `std::clone::AssertParamIsCopy`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: no method named `clone` found for union `U5<CloneNoCopy>` in the current scope
|
LL | a: PartialEqNotEq,
| ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `PartialEqNotEq`
+ |
+ ::: $SRC_DIR/libcore/cmp.rs:LL:COL
+ |
+LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
+ | -- required by this bound in `std::cmp::AssertParamIsEq`
|
- = note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
--> $DIR/unsized-enum.rs:6:36
|
LL | enum Foo<U> { FooSome(U), FooNone }
- | ----------- required by `Foo`
+ | --- - required by this bound in `Foo`
LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
| - ^^^^^^ doesn't have a size known at compile-time
--> $DIR/unsized-inherent-impl-self-type.rs:7:17
|
LL | struct S5<Y>(Y);
- | ---------------- required by `S5`
+ | -- - required by this bound in `S5`
LL |
LL | impl<X: ?Sized> S5<X> {
| - ^^^^^ doesn't have a size known at compile-time
--> $DIR/unsized-struct.rs:6:36
|
LL | struct Foo<T> { data: T }
- | ------------- required by `Foo`
+ | --- - required by this bound in `Foo`
LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
| - ^^^^^^ doesn't have a size known at compile-time
--> $DIR/unsized-trait-impl-self-type.rs:10:17
|
LL | struct S5<Y>(Y);
- | ---------------- required by `S5`
+ | -- - required by this bound in `S5`
LL |
LL | impl<X: ?Sized> T3<X> for S5<X> {
| - ^^^^^ doesn't have a size known at compile-time
--> $DIR/wf-const-type.rs:10:12
|
LL | struct IsCopy<T:Copy> { t: T }
- | --------------------- required by `IsCopy`
+ | ------ ---- required by this bound in `IsCopy`
...
LL | const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `NotCopy`
--> $DIR/wf-enum-bound.rs:10:14
|
LL | trait ExtraCopy<T:Copy> { }
- | ----------------------- required by `ExtraCopy`
+ | --------- ---- required by this bound in `ExtraCopy`
...
LL | where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`
--> $DIR/wf-enum-fields-struct-variant.rs:13:9
|
LL | struct IsCopy<T:Copy> {
- | --------------------- required by `IsCopy`
+ | ------ ---- required by this bound in `IsCopy`
...
LL | f: IsCopy<A>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
--> $DIR/wf-enum-fields.rs:12:17
|
LL | struct IsCopy<T:Copy> {
- | --------------------- required by `IsCopy`
+ | ------ ---- required by this bound in `IsCopy`
...
LL | SomeVariant(IsCopy<A>)
| ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
//~^ ERROR E0277
//~| ERROR E0038
+struct Vec<T> {
+ t: T,
+}
fn main() { }
--> $DIR/wf-fn-where-clause.rs:8:24
|
LL | trait ExtraCopy<T:Copy> { }
- | ----------------------- required by `ExtraCopy`
+ | --------- ---- required by this bound in `ExtraCopy`
LL |
LL | fn foo<T,U>() where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`
|
LL | fn bar() where Vec<dyn Copy>:, {}
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
+...
+LL | struct Vec<T> {
+ | --- - required by this bound in `Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
- = note: required by `std::vec::Vec`
error[E0038]: the trait `std::marker::Copy` cannot be made into an object
--> $DIR/wf-fn-where-clause.rs:12:16
--> $DIR/wf-impl-associated-type-trait.rs:17:5
|
LL | pub struct MySet<T:MyHash> {
- | -------------------------- required by `MySet`
+ | ----- ------ required by this bound in `MySet`
...
LL | type Bar = MySet<T>;
| ^^^^^^^^^^^^^^^^^^^^ the trait `MyHash` is not implemented for `T`
--> $DIR/wf-in-fn-arg.rs:10:14
|
LL | struct MustBeCopy<T:Copy> {
- | ------------------------- required by `MustBeCopy`
+ | ---------- ---- required by this bound in `MustBeCopy`
...
LL | fn bar<T>(_: &MustBeCopy<T>)
| ^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
--> $DIR/wf-in-fn-ret.rs:10:16
|
LL | struct MustBeCopy<T:Copy> {
- | ------------------------- required by `MustBeCopy`
+ | ---------- ---- required by this bound in `MustBeCopy`
...
LL | fn bar<T>() -> MustBeCopy<T>
| ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
--> $DIR/wf-in-fn-type-arg.rs:9:5
|
LL | struct MustBeCopy<T:Copy> {
- | ------------------------- required by `MustBeCopy`
+ | ---------- ---- required by this bound in `MustBeCopy`
...
LL | x: fn(MustBeCopy<T>)
| ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
--> $DIR/wf-in-fn-type-ret.rs:9:5
|
LL | struct MustBeCopy<T:Copy> {
- | ------------------------- required by `MustBeCopy`
+ | ---------- ---- required by this bound in `MustBeCopy`
...
LL | x: fn() -> MustBeCopy<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
--> $DIR/wf-in-fn-where-clause.rs:10:14
|
LL | trait MustBeCopy<T:Copy> {
- | ------------------------ required by `MustBeCopy`
+ | ---------- ---- required by this bound in `MustBeCopy`
...
LL | where T: MustBeCopy<U>
| ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`
--> $DIR/wf-in-obj-type-trait.rs:11:5
|
LL | struct MustBeCopy<T:Copy> {
- | ------------------------- required by `MustBeCopy`
+ | ---------- ---- required by this bound in `MustBeCopy`
...
LL | x: dyn Object<MustBeCopy<T>>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
--> $DIR/wf-inherent-impl-method-where-clause.rs:12:27
|
LL | trait ExtraCopy<T:Copy> { }
- | ----------------------- required by `ExtraCopy`
+ | --------- ---- required by this bound in `ExtraCopy`
...
LL | fn foo(self) where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`
--> $DIR/wf-inherent-impl-where-clause.rs:11:29
|
LL | trait ExtraCopy<T:Copy> { }
- | ----------------------- required by `ExtraCopy`
+ | --------- ---- required by this bound in `ExtraCopy`
...
LL | impl<T,U> Foo<T,U> where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`
--> $DIR/wf-static-type.rs:10:13
|
LL | struct IsCopy<T:Copy> { t: T }
- | --------------------- required by `IsCopy`
+ | ------ ---- required by this bound in `IsCopy`
...
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `NotCopy`
--> $DIR/wf-struct-bound.rs:10:14
|
LL | trait ExtraCopy<T:Copy> { }
- | ----------------------- required by `ExtraCopy`
+ | --------- ---- required by this bound in `ExtraCopy`
...
LL | where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`
--> $DIR/wf-struct-field.rs:12:5
|
LL | struct IsCopy<T:Copy> {
- | --------------------- required by `IsCopy`
+ | ------ ---- required by this bound in `IsCopy`
...
LL | data: IsCopy<A>
| ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
--> $DIR/wf-trait-associated-type-bound.rs:10:17
|
LL | trait ExtraCopy<T:Copy> { }
- | ----------------------- required by `ExtraCopy`
+ | --------- ---- required by this bound in `ExtraCopy`
...
LL | type Type1: ExtraCopy<T>;
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
--> $DIR/wf-trait-associated-type-trait.rs:11:5
|
LL | struct IsCopy<T:Copy> { x: T }
- | --------------------- required by `IsCopy`
+ | ------ ---- required by this bound in `IsCopy`
LL |
LL | trait SomeTrait {
| - help: consider further restricting the associated type: `where <Self as SomeTrait>::Type1: std::marker::Copy`
--> $DIR/wf-trait-bound.rs:10:14
|
LL | trait ExtraCopy<T:Copy> { }
- | ----------------------- required by `ExtraCopy`
+ | --------- ---- required by this bound in `ExtraCopy`
...
LL | where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`
--> $DIR/wf-trait-default-fn-arg.rs:11:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
- | ----------------------- required by `Bar`
+ | --- -- required by this bound in `Bar`
...
LL | fn bar(&self, x: &Bar<Self>) {
| ^^^^^^^^^^ - help: consider further restricting `Self`: `where Self: std::cmp::Eq`
--> $DIR/wf-trait-default-fn-ret.rs:11:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
- | ----------------------- required by `Bar`
+ | --- -- required by this bound in `Bar`
...
LL | fn bar(&self) -> Bar<Self> {
| ^^^^^^^^^- help: consider further restricting `Self`: `where Self: std::cmp::Eq`
--> $DIR/wf-trait-default-fn-where-clause.rs:11:31
|
LL | trait Bar<T:Eq+?Sized> { }
- | ---------------------- required by `Bar`
+ | --- -- required by this bound in `Bar`
...
LL | fn bar<A>(&self) where A: Bar<Self> {
| ^^^^^^^^^- help: consider further restricting `Self`: `, Self: std::cmp::Eq`
--> $DIR/wf-trait-fn-arg.rs:10:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
- | ----------------------- required by `Bar`
+ | --- -- required by this bound in `Bar`
...
LL | fn bar(&self, x: &Bar<Self>);
| ^^^^^^^^^^ - help: consider further restricting `Self`: `where Self: std::cmp::Eq`
--> $DIR/wf-trait-fn-ret.rs:10:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
- | ----------------------- required by `Bar`
+ | --- -- required by this bound in `Bar`
...
LL | fn bar(&self) -> &Bar<Self>;
| ^^^^^^^^^^- help: consider further restricting `Self`: `where Self: std::cmp::Eq`
--> $DIR/wf-trait-fn-where-clause.rs:10:49
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
- | ----------------------- required by `Bar`
+ | --- -- required by this bound in `Bar`
...
LL | fn bar(&self) where Self: Sized, Bar<Self>: Copy;
| ^^^^- help: consider further restricting `Self`: `, Self: std::cmp::Eq`
--> $DIR/wf-trait-superbound.rs:9:21
|
LL | trait ExtraCopy<T:Copy> { }
- | ----------------------- required by `ExtraCopy`
+ | --------- ---- required by this bound in `ExtraCopy`
LL |
LL | trait SomeTrait<T>: ExtraCopy<T> {
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`