Use PredicateObligation
s instead of Predicate
s
Keep more information about trait binding failures.
This commit is contained in:
parent
485c5fb6e1
commit
bd7ea5441e
90 changed files with 280 additions and 141 deletions
|
@ -296,7 +296,10 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
|
|||
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)
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
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>,
|
||||
|
@ -87,7 +89,7 @@ impl<T: AsRef<ty::Predicate<'tcx>>> Extend<T> for PredicateSet<'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>,
|
||||
}
|
||||
|
||||
|
@ -112,7 +114,29 @@ pub fn elaborate_predicates<'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> {
|
||||
|
@ -120,27 +144,30 @@ 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,
|
||||
|
@ -221,7 +248,8 @@ impl Elaborator<'tcx> {
|
|||
None
|
||||
}
|
||||
})
|
||||
.filter(|p| visited.insert(p)),
|
||||
.filter(|p| visited.insert(p))
|
||||
.map(|p| predicate_obligation(p, None)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -229,17 +257,17 @@ impl Elaborator<'tcx> {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -282,12 +310,12 @@ impl<I> FilterToTraits<I> {
|
|||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
|
|||
.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;
|
||||
|
|
|
@ -1255,8 +1255,8 @@ crate fn required_region_bounds(
|
|||
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(..)
|
||||
|
|
|
@ -366,7 +366,8 @@ impl AutoTraitFinder<'tcx> {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -976,8 +976,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
};
|
||||
|
||||
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.
|
||||
|
@ -1387,7 +1387,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
(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`
|
||||
|
|
|
@ -142,7 +142,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
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.
|
||||
|
|
|
@ -1345,7 +1345,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
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);
|
||||
|
@ -1357,7 +1356,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
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);
|
||||
|
|
|
@ -297,7 +297,9 @@ pub fn normalize_param_env_or_error<'tcx>(
|
|||
);
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
|||
// 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)
|
||||
}
|
||||
|
|
|
@ -900,7 +900,7 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>(
|
|||
// 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,
|
||||
|
@ -1162,7 +1162,7 @@ fn confirm_object_candidate<'cx, 'tcx>(
|
|||
|
||||
// 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)
|
||||
|
|
|
@ -312,19 +312,18 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||
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);
|
||||
}
|
||||
|
@ -613,11 +612,14 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||
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()
|
||||
}
|
||||
|
|
|
@ -1601,12 +1601,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
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())
|
||||
|
|
|
@ -573,13 +573,15 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
|||
};
|
||||
|
||||
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))
|
||||
|
|
|
@ -1226,7 +1226,8 @@ fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, span: Span, id: hir::HirId) {
|
|||
// 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);
|
||||
|
|
|
@ -1650,7 +1650,7 @@ fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
|
|||
// 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(),
|
||||
|
|
|
@ -348,7 +348,10 @@ fn check_predicates<'tcx>(
|
|||
.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) {
|
||||
|
|
|
@ -20,7 +20,10 @@ error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be sent be
|
|||
--> $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`
|
||||
|
@ -33,7 +36,10 @@ error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be shared
|
|||
--> $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`
|
||||
|
@ -46,7 +52,10 @@ error[E0277]: `<_ as Lam<&'a u8>>::App` doesn't implement `std::fmt::Debug`
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0284]: type annotations needed
|
|||
--> $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`
|
||||
|
|
||||
|
@ -12,7 +12,7 @@ error[E0284]: type annotations needed
|
|||
--> $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`
|
||||
|
|
||||
|
|
|
@ -128,10 +128,14 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
|
|||
|
|
||||
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
|
||||
|
||||
|
|
|
@ -14,10 +14,14 @@ error[E0277]: the size for values of type `dyn Trait` cannot be known at compila
|
|||
|
|
||||
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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `F` cannot be sent between threads safely
|
|||
--> $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
|
||||
|
|
|
@ -15,7 +15,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
|
|||
--> $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`
|
||||
|
@ -30,7 +30,7 @@ error[E0277]: the size for values of type `B` cannot be known at compilation tim
|
|||
--> $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`
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
|||
|
|
||||
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
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
|||
|
|
||||
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
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
|||
|
|
||||
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
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
|||
|
|
||||
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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<B
|
|||
--> $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 {}
|
||||
| ^^^
|
||||
|
|
|
@ -2,9 +2,9 @@ error[E0280]: the requirement `for<'a> <Self as Iterator>::Item<'a>: 'a` is not
|
|||
--> $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
|
||||
|
||||
|
|
|
@ -38,7 +38,10 @@ error[E0271]: type mismatch resolving `for<'a> <<std::vec::Vec<T> as Iterable>::
|
|||
--> $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
|
||||
|
@ -52,7 +55,10 @@ error[E0271]: type mismatch resolving `for<'a> <<[T] as Iterable>::Iter<'a> as s
|
|||
--> $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
|
||||
|
|
|
@ -4,4 +4,9 @@ fn ho_func(f: Option<FuncType>) {
|
|||
//~^ ERROR the size for values of type
|
||||
}
|
||||
|
||||
enum Option<T> {
|
||||
Some(T),
|
||||
None,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -3,10 +3,12 @@ error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) -
|
|||
|
|
||||
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
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
|
|||
--> $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`
|
||||
|
|
|
@ -10,7 +10,7 @@ error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<N
|
|||
--> $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 {
|
||||
| ^^^
|
||||
|
@ -148,7 +148,7 @@ error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<N
|
|||
--> $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 {
|
||||
| ^^^
|
||||
|
|
|
@ -3,10 +3,14 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation
|
|||
|
|
||||
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
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Bound` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0283]: type annotations needed
|
|||
--> $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`
|
||||
|
|
|
@ -5,4 +5,8 @@ impl Struct {
|
|||
//~^ ERROR the size for values of type
|
||||
}
|
||||
|
||||
struct Vec<T> {
|
||||
t: T,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -3,10 +3,12 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` canno
|
|||
|
|
||||
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
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@ error[E0271]: type mismatch resolving `<<T as Trait>::A as MultiDispatch<i32>>::
|
|||
--> $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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0283]: type annotations needed
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `u8` is not an iterator
|
|||
--> $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
|
||||
|
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: `*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 Bar` cannot be shared between threads safely
|
||||
|
@ -14,7 +14,7 @@ error[E0277]: `*const Foo` 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
|
||||
|
|
|
@ -2,7 +2,10 @@ error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
|
|||
--> $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>`
|
||||
|
@ -29,7 +32,10 @@ error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
|
|||
--> $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>`
|
||||
|
|
|
@ -12,18 +12,26 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis
|
|||
|
|
||||
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
|
||||
|
|
|
@ -13,7 +13,7 @@ error[E0277]: `dummy::TestType` cannot be sent between threads safely
|
|||
--> $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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Foo` is not satisfied
|
|||
--> $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`
|
||||
|
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
@ -11,7 +11,7 @@ error[E0277]: the trait bound `f32: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `u16: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -3,16 +3,22 @@ error[E0277]: the trait bound `usize: trait_bounds_on_structs_and_enums_xc::Trai
|
|||
|
|
||||
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
|
||||
|
||||
|
|
|
@ -3,8 +3,11 @@ error[E0277]: the trait bound `f64: trait_bounds_on_structs_and_enums_xc::Trait`
|
|||
|
|
||||
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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
@ -16,7 +16,7 @@ error[E0277]: the trait bound `isize: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
@ -25,7 +25,7 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
@ -34,7 +34,7 @@ error[E0277]: the trait bound `U: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
@ -48,7 +48,7 @@ error[E0277]: the trait bound `V: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
@ -62,7 +62,7 @@ error[E0277]: the trait bound `i32: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
@ -71,7 +71,7 @@ error[E0277]: the trait bound `u8: Trait` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: a value of type `i32` cannot be built from an iterator over elemen
|
|||
--> $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>`
|
||||
|
|
||||
|
@ -12,7 +12,7 @@ error[E0277]: a value of type `i32` cannot be built from an iterator over elemen
|
|||
--> $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>`
|
||||
|
@ -50,7 +50,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0283]: type annotations needed
|
|||
--> $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`
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `U1: std::marker::Copy` is not satisfied
|
|||
|
|
||||
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
|
||||
|
|
|
@ -3,8 +3,12 @@ error[E0277]: the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied
|
|||
|
|
||||
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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
|
|||
--> $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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
|
|||
--> $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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
|
|||
--> $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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
|
|||
--> $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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `NotCopy: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -13,5 +13,8 @@ fn bar() where Vec<dyn Copy>:, {}
|
|||
//~^ ERROR E0277
|
||||
//~| ERROR E0038
|
||||
|
||||
struct Vec<T> {
|
||||
t: T,
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
@ -17,10 +17,12 @@ error[E0277]: the size for values of type `(dyn std::marker::Copy + 'static)` ca
|
|||
|
|
||||
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
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: MyHash` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `NotCopy: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `<Self as SomeTrait>::Type1: std::marker::Copy` is
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
|
|||
--> $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`
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
|
|||
--> $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`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue