]> git.lizzy.rs Git - rust.git/commitdiff
Use `PredicateObligation`s instead of `Predicate`s
authorEsteban Küber <esteban@kuber.com.ar>
Tue, 3 Mar 2020 23:07:04 +0000 (15:07 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Wed, 8 Apr 2020 21:40:45 +0000 (14:40 -0700)
Keep more information about trait binding failures.

90 files changed:
src/librustc_infer/infer/outlives/verify.rs
src/librustc_infer/traits/util.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_trait_selection/opaque_types.rs
src/librustc_trait_selection/traits/auto_trait.rs
src/librustc_trait_selection/traits/error_reporting/mod.rs
src/librustc_trait_selection/traits/error_reporting/on_unimplemented.rs
src/librustc_trait_selection/traits/error_reporting/suggestions.rs
src/librustc_trait_selection/traits/mod.rs
src/librustc_trait_selection/traits/object_safety.rs
src/librustc_trait_selection/traits/project.rs
src/librustc_trait_selection/traits/wf.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/method/confirm.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/impl_wf_check/min_specialization.rs
src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr
src/test/ui/associated-types/associated-types-overridden-binding.stderr
src/test/ui/associated-types/defaults-suitability.stderr
src/test/ui/bad/bad-sized.stderr
src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr
src/test/ui/consts/too_generic_eval_ice.stderr
src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr
src/test/ui/derives/derives-span-Eq-enum.stderr
src/test/ui/derives/derives-span-Eq-struct.stderr
src/test/ui/derives/derives-span-Eq-tuple-struct.stderr
src/test/ui/error-codes/E0275.stderr
src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.stderr
src/test/ui/generic-associated-types/iterable.stderr
src/test/ui/issues/issue-18919.rs
src/test/ui/issues/issue-18919.stderr
src/test/ui/issues/issue-20005.stderr
src/test/ui/issues/issue-20413.stderr
src/test/ui/issues/issue-20433.stderr
src/test/ui/issues/issue-21837.stderr
src/test/ui/issues/issue-21974.stderr
src/test/ui/issues/issue-23281.rs
src/test/ui/issues/issue-23281.stderr
src/test/ui/issues/issue-24204.stderr
src/test/ui/issues/issue-24424.stderr
src/test/ui/iterators/bound.stderr
src/test/ui/recursion/recursive-requirements.stderr
src/test/ui/suggestions/missing-assoc-type-bound-restriction.stderr
src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr
src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr
src/test/ui/traits/trait-alias/trait-alias-wf.stderr
src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.stderr
src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.stderr
src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.stderr
src/test/ui/traits/trait-bounds-on-structs-and-enums-static.stderr
src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.stderr
src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.stderr
src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr
src/test/ui/type/type-check-defaults.stderr
src/test/ui/type/type-check/issue-40294.stderr
src/test/ui/union/union-derive-clone.stderr
src/test/ui/union/union-derive-eq.stderr
src/test/ui/unsized/unsized-enum.stderr
src/test/ui/unsized/unsized-inherent-impl-self-type.stderr
src/test/ui/unsized/unsized-struct.stderr
src/test/ui/unsized/unsized-trait-impl-self-type.stderr
src/test/ui/wf/wf-const-type.stderr
src/test/ui/wf/wf-enum-bound.stderr
src/test/ui/wf/wf-enum-fields-struct-variant.stderr
src/test/ui/wf/wf-enum-fields.stderr
src/test/ui/wf/wf-fn-where-clause.rs
src/test/ui/wf/wf-fn-where-clause.stderr
src/test/ui/wf/wf-impl-associated-type-trait.stderr
src/test/ui/wf/wf-in-fn-arg.stderr
src/test/ui/wf/wf-in-fn-ret.stderr
src/test/ui/wf/wf-in-fn-type-arg.stderr
src/test/ui/wf/wf-in-fn-type-ret.stderr
src/test/ui/wf/wf-in-fn-where-clause.stderr
src/test/ui/wf/wf-in-obj-type-trait.stderr
src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr
src/test/ui/wf/wf-inherent-impl-where-clause.stderr
src/test/ui/wf/wf-static-type.stderr
src/test/ui/wf/wf-struct-bound.stderr
src/test/ui/wf/wf-struct-field.stderr
src/test/ui/wf/wf-trait-associated-type-bound.stderr
src/test/ui/wf/wf-trait-associated-type-trait.stderr
src/test/ui/wf/wf-trait-bound.stderr
src/test/ui/wf/wf-trait-default-fn-arg.stderr
src/test/ui/wf/wf-trait-default-fn-ret.stderr
src/test/ui/wf/wf-trait-default-fn-where-clause.stderr
src/test/ui/wf/wf-trait-fn-arg.stderr
src/test/ui/wf/wf-trait-fn-ret.stderr
src/test/ui/wf/wf-trait-fn-where-clause.stderr
src/test/ui/wf/wf-trait-superbound.stderr

index ed967f7ab3a0bac8c146e996bacb3eb345bebf28..5b6db324e6c856dd52fcd413825ccd41dfbef6d1 100644 (file)
@@ -296,7 +296,10 @@ fn region_bounds_declared_on_associated_item(
         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)
     }
index 4fa74f93ddcb05675785a46709636f8f78183abb..3f63d25fb4723ad92109f62fb965a6843e75a20c 100644 (file)
@@ -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 @@ fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
 /// 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 @@ pub fn filter_to_traits(self) -> FilterToTraits<Self> {
         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 @@ fn elaborate(&mut self, predicate: &ty::Predicate<'tcx>) {
                                 None
                             }
                         })
-                        .filter(|p| visited.insert(p)),
+                        .filter(|p| visited.insert(p))
+                        .map(|p| predicate_obligation(p, None)),
                 );
             }
         }
@@ -229,17 +257,17 @@ fn elaborate(&mut self, predicate: &ty::Predicate<'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 @@ fn new(base: 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());
             }
         }
index 25719d037f9fc80cea7a7bbb0124329c86878a5d..5a00f206a7646892463e56a32264fda2c7cc1ed6 100644 (file)
@@ -126,7 +126,7 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut BodyAn
             .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;
index 093873c849a92622e3861d1cb146a491b6f5e1c5..0cb26e082280ec4a5e10a80da6b34acd3652646f 100644 (file)
@@ -1255,8 +1255,8 @@ pub fn may_define_opaque_type(tcx: TyCtxt<'_>, def_id: DefId, opaque_hir_id: hir
     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(..)
index e01f5bfbcb3da88392a33bcf079c109a698b7e42..b4c790eebc106242f67d069334f0c182bd803247 100644 (file)
@@ -366,7 +366,8 @@ fn evaluate_predicates(
 
             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);
         }
index f0a157b377076e82ea1bbad22a3b3524f8e86f22..8cd8f679904de5cfd2339b715b1cee5b9e63fe15 100644 (file)
@@ -976,8 +976,8 @@ fn error_implies(&self, cond: &ty::Predicate<'tcx>, error: &ty::Predicate<'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 @@ fn maybe_report_ambiguity(
                     (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`
index 213769d721d73e680d308392e52cc8212da477a4..1ecc7fdafc442bbfb1fbd38c9b30d3d1d5d0490c 100644 (file)
@@ -142,7 +142,9 @@ fn on_unimplemented_note(
             }
         }
 
-        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.
index a8fc56d8509a01d9b40b130ba77db403d70a18e5..f9149b91b1fc1d91ba284f0608e5394d0e61cd0c 100644 (file)
@@ -1345,7 +1345,6 @@ fn note_obligation_cause_code<T>(
             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 @@ fn note_obligation_cause_code<T>(
                 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);
index 9a853c32eaa26aa528b065e4030544399d6e4166..6d0a3790fb090f68bbcd00c77d9e9133e6e291e6 100644 (file)
@@ -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);
 
index 3cb250891ef934de3f86473ee2be89fc84e45680..117748fd064717d31fd750b16174ac2e9e753e1c 100644 (file)
@@ -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)
         }
index e4ca7d4cde7dc3a97beeec55131cddb348e2f52b..4d02c5eb2301d3a44a9bc3391f2eca7f30cdbf3e 100644 (file)
@@ -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)
index d506ddab909e752b5aa2d2a7ee71ac2be2ae5e7e..63a6720b97dafeaf2889e3a2a585a5f431a32255 100644 (file)
@@ -312,19 +312,18 @@ fn compute_trait_ref(&mut self, trait_ref: &ty::TraitRef<'tcx>, elaborate: Elabo
         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 @@ fn nominal_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()
     }
index ed7ec1c3b10da39e99e72279d0e68aa86fd02265..a7a0564b9b6c9241cb548f860090d0fbac385c7b 100644 (file)
@@ -1601,12 +1601,12 @@ fn conv_object_ty_poly_trait_ref(
         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())
index a16555b3df05635defb63596bd69ecf6fa1ba7d3..210ba92e8117b87cf18a835cca61c673ef65285b 100644 (file)
@@ -573,13 +573,15 @@ fn predicates_require_illegal_sized_bound(
         };
 
         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))
index b0ff17ad56d7c5dd13cd46500cfffa50cb205e53..8508c3510fa0efc206fc73e4e32bee7cf68ce3ad 100644 (file)
@@ -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);
index c5e9a288c9ce89994a7ebea3211cd587f5451736..8c2040719a1c9a23f9f8a6ee97ea9b4bbb5f761f 100644 (file)
@@ -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(),
index 559e478df0604372ac3b9dded4f9665b22b32a7d..ebfb3684eb0d6f22645b8998b853846b9e8a4f22 100644 (file)
@@ -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) {
index efd5a92a4fced8cad745d2ea24b0d750674e765e..d5066e39ebc82a1c932b234e6e74deccf0877b92 100644 (file)
@@ -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`
index 683a2ab21d9c8e3cf258b61ae11c2c4f922adeba..76d00f9e6f2455d780025c1389697b3896250d28 100644 (file)
@@ -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`
    |
index 54e39c4367d103a176d16f2f1a2b60b33ea6d89f..3f6702da2a4a2bf4f8a0a12867f7fa1d3234a3b7 100644 (file)
@@ -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
 
index e9ded557281a445c69632749b607d8b04ec05a89..5c169af4eb8ae33380ac6e6a6543b29516b851c3 100644 (file)
@@ -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
index f565948f479c3e8e17de4769bfea67ee32b14c42..06eca0f692d6ddc8b0d2ec159b4e7fce5024f657 100644 (file)
@@ -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
index ffa28225b79c65ca7250af558a61e8ae118fcfd2..e188d9810100c0075d3188fe69193027f4dfb692 100644 (file)
@@ -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`
index 704825c7b3844bb6ba6c0a7d6a58a94a184b0024..3d7487a4d92a3623836cf55c1ddb834d7ece57d9 100644 (file)
@@ -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
index 8d2499614d89feed89c2f7068526c9e7ae52b30d..00345243cac5d15a2b62e487a43b249930e77b4c 100644 (file)
@@ -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
index 22db0bf08b7bd8304d3a16551380ac94ee9a4707..3d0efa1d147ee3d31e2192af94aa4843d4803f6b 100644 (file)
@@ -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
index eaf14691ff056201da819b6eb587b1a60403cb14..2aec8ffdbe7ec9e56ee461ea8c5b17d41b6a1daa 100644 (file)
@@ -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
index c551a00096e23f65aab054eb800995def1198d0d..a9fd0564ff548f93d03497abfa30972d7e669357 100644 (file)
@@ -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 {}
    |                                 ^^^
index 687423962361bf04c193a801b2a9e1fafe3e6e0b..88b5c6a0a013c870bcb42129f6245e19d6543d07 100644 (file)
@@ -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
 
index b5bc0c76c2fc56e46f6426276e39cc38c1ae04cb..dc62ee53c06307aafd725e047a2075236f2eba9e 100644 (file)
@@ -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
index 91fbb13cd69885253925aa8a8c79d47efa9e1b5b..f06771e9ea59d543171758f64a28a54c6be1f059 100644 (file)
@@ -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() {}
index c8b9045efe6a0343c3f2651181f3b86ca44e20d7..db94d00b60c67277fc087814b6aa6033a2ea8484 100644 (file)
@@ -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
 
index 529571a6b74dd0feae782d5d7274ac99c0f14b21..bcdebb2fa342622160fd0a2fdbb64d170cdc6585 100644 (file)
@@ -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`
index 84e64ff74ae96c2e72d0e9d63f06b8a69e42a45d..ad33eef07cba5f5102765b7c4c9982272630a0bd 100644 (file)
@@ -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 {
    |                                    ^^^
index abd2290952baf498732d458b2a8e0f02e4bac5d0..1dab637e489db29d2fbb7980ae53808d41c3201e 100644 (file)
@@ -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
 
index ff0c1ca64e2cc6530facfbb3c391e57117c570d0..42a61995ad9b7bb44a298758cb29a7d4c16003dd 100644 (file)
@@ -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`
index d36d0dad4a196c7fc03bd2692e4932305ddeeec1..fea2c7d5d26d720e7097d273c1c2bcaebe8607f0 100644 (file)
@@ -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`
index d5f747288627323b0127f557df0c85c05790f5fc..72716896426e4a146143426445d52678788ccd9d 100644 (file)
@@ -5,4 +5,8 @@ pub fn function(funs: Vec<dyn Fn() -> ()>) {}
     //~^ ERROR the size for values of type
 }
 
+struct Vec<T> {
+    t: T,
+}
+
 fn main() {}
index 68a90c6d80f3ba05ce409b5e47ad5e00a7689c7a..6aa6051f98aed86b1afa9cd915cad75080caed68 100644 (file)
@@ -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
 
index 2a714861da1fdb9ab49566d3fac3c0d79d8366bf..64d1b68cbed7f3df411a05e53768cda3567059a6 100644 (file)
@@ -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
index f9338981408b743bb7f291cdd2c1880d6c67f58f..9f5e934295b87f9a892b4370aad4cee40d9df704 100644 (file)
@@ -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`
index 92a91ff4cb1ba1e2ae9df5c8bc70ad9ad81f8269..db5949b692c7d7f7fb371300abcbe470ac51f5b8 100644 (file)
@@ -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
    |
index 9846c938ba90b5e4ec5e39592b0fb29b83c2acf6..5a1ef37f734478e8d523fccc944896b1f3a42cd8 100644 (file)
@@ -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
index 31d974ed43d99fea902229b4329a2452278655ce..6b985edae9e28a92feaad365ac68a7b9f81b54b4 100644 (file)
@@ -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>`
index 57a389cbb49b5cc840228813bfc2f06d20c2ac2e..9ccddda45e2bb1f1029dc6a29a198807daab928d 100644 (file)
@@ -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
index 69a91b09e3ee00ce6cd28565f7a0601eabde0d93..ffed905eff2cdc86a2631b7df584180ce8f629db 100644 (file)
@@ -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
index ca4980ca305294c814cbc55e896e58608b184a86..84cde07ed897b64ed073ae577fa849cee860d8bb 100644 (file)
@@ -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`
    |
index a2253021a7f1fc9aa5593ac948203c415467fa47..1b2511be6d0c8ef61d20a89de78301f29c8f96d1 100644 (file)
@@ -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`
index 7e8db610fe2332ce3b0496542e976ba5227d9e44..58dd68c176823c4ddca21e9bd79d7ef462be473d 100644 (file)
@@ -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`
index 070b7b013e5cce5e84a62cdaad33b2d731dff922..f364fd1e14ca83b8f478bf4fdc4ca64c03397ec4 100644 (file)
@@ -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`
index 722f01750cb66e0cb5aacef8f235a6ba2939a43e..17b1288bc6a1fc7feb50d483bf0405128c975b74 100644 (file)
@@ -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`
index c5a7746afdfdb802e32396a7a12997b3a2bb1aa2..d2fa211b487de42f89a18070d130f2f6c38ddcec 100644 (file)
@@ -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
 
index 57db65df5f331ab25b693dd3430ce081081e5bc6..ee3e755c95318b016a28d851f7146cbddb41458f 100644 (file)
@@ -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
index 9e8e5e08145022a3f8c97927098382deb99845de..16dba294b6c4c8f901eb344eb7f0345729fc52ad 100644 (file)
@@ -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`
index ca9b85bacba399705992a3555b1ba8e6fafa7cb7..4109bd700741df224878909853ff11eac5886ce0 100644 (file)
@@ -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`
    |
index 7d81e0ce10c709f7f1d5a9747ab725fa7c252081..ea7771a9c227089959c901ddbcdb12d8bc41f6f3 100644 (file)
@@ -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`
index 66437611872dfe366f539e66e346e4b2b5d2afb3..b536325810a3b1d18d0d5b3ed606a732eaefb68e 100644 (file)
@@ -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
index 0955c161871d28c68a27584a7f9ddddb55b3b024..ae0cd5af4b05335980d1513532b658320f954348 100644 (file)
@@ -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
index 88f7b1f77aee011e6ef5dfc2ff07c77d3171c289..7f5ce5d02a582f10ee375995dc22544a2184f0e0 100644 (file)
@@ -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
index 5688ae5b89a0409559d0a6d41191188f523f3a36..990cea97723e2e115c44a96d1881521f479b0569 100644 (file)
@@ -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
index 653fb5c1ae8dca6431058ae548e2d8c2fb85c8d3..b9e226ccbf1cdd5f0fdcbf6213c37bf227bbe166 100644 (file)
@@ -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
index 3597073e7e6c632ef62a0c0759f85a0e9f606b28..08ceabecb274339710403ccb9b8eaa9336e1536c 100644 (file)
@@ -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
index 531aadc25dd2ad1909d822838e03e7bb48dcbe34..22f31c9f79f84eba8805e0e1fddf55f4f0cf2e65 100644 (file)
@@ -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`
index f70f67d414fc316af30052d0d42f9fb65f0821e0..88d8c5990224bff9109d0606e4c3ffc8391784ed 100644 (file)
@@ -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`
index 8634b7dba5c36297d473598830024328e9b9705e..d45ab9529873cc51e56c2626c1ee4073244a9732 100644 (file)
@@ -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`
index a22b2d11a91cb6c60dbe892d2454b04079dae046..013407bcc6826448fb266a765d42e2d7a4be902a 100644 (file)
@@ -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`
index 5fd567bd32d049d8d6feff2359ea37aafe699186..adae536138b6023c98ad705e0b7b8b3ff9a3002b 100644 (file)
@@ -13,5 +13,8 @@ fn bar() where Vec<dyn Copy>:, {}
 //~^ ERROR E0277
 //~| ERROR E0038
 
+struct Vec<T> {
+    t: T,
+}
 
 fn main() { }
index cf1aeac7e3e4142284877c7e1ec7bd8e3f4ae6e3..c5a7a5b06116705eab335f686b14fef33a14e759 100644 (file)
@@ -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
index d44a6f01a47f68661809b65a865409c6c6d28fd2..7312233aa542ef89ab8c1e960cd548d22ab0ae22 100644 (file)
@@ -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`
index 907701440aad5c3eaf5577e002757d3e39e064d5..67a5562b6bc5deb73fe32d237f18059758c165f6 100644 (file)
@@ -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`
index 2ed4eecefe1351fa5419233413cd4d10fe734ec7..545ee559b3fe3e1f4f5ebcc0d79bd68f32c501be 100644 (file)
@@ -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`
index 0c699838abd2a73aa00d58638fc86a6b8e1f3886..0d8c6b14c56e0ce55394b7d8375b5c624301566c 100644 (file)
@@ -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`
index 3429ab89ffbac3132a5859a88d0ed8cfcc1ad525..b7c8bf303f34c588c7d825e1c8b77af701299577 100644 (file)
@@ -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`
index d33749d795c599e513670b3846d27996aa3c7007..e54cc17ccbef5bd8b236b2a02052aa3d1dc18123 100644 (file)
@@ -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`
index 605dc49784954163d1bcaf30ef4bb09596583285..699c3fe1a6316a481e010fec07104b09ec22d2fa 100644 (file)
@@ -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`
index da2f8085a8a9e139627d647844ce127a97bf4565..172e763650a2f40b4e7d2e8c008c70a8c96cb054 100644 (file)
@@ -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`
index 28d5bc62556abc47c9a0a056b653d8bdd834d3d3..1ac5aba3cad3bf73b8522425a245af0c08957a6c 100644 (file)
@@ -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`
index 05a628d7c3e196396feaba3942f2ee97f54b5c97..ec31710e86123786eb229b8d3c5ba38ced9d7623 100644 (file)
@@ -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`
index 07e569ddac11d0f6cd4557eb9ff51435cfe82a90..848a2eb8beef6722c7426b38d6111737557b963e 100644 (file)
@@ -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`
index f3bce24eace07683537ada5efc152b48ceb5bbab..a748a1c9c39541f987b3d8ba9d2c6fb3dc5d2d5d 100644 (file)
@@ -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`
index 6cf7f2069b6b745e84476ee500180b894d1dcaf6..e568acabcd00c675ca572e42713af21c866636da 100644 (file)
@@ -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`
index 93cb948cdbfcb0674080e6729f698e8c582110b7..915f660f54d155ee2cf9bfd5f7bddd484e247837 100644 (file)
@@ -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`
index b8ffad6d1802bfa3d00e4ca63c1f37faa2ad7da5..0db29621e312234ab853b1544e58c473dfaa8990 100644 (file)
@@ -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`
index 6a97d31cf3e653b4d6f908726597c773c0514a5c..55fc202ca51291766ff3a9e813ff8bdc7fe33b2a 100644 (file)
@@ -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`
index 36c1e486269f6f70c96a4a9659a8de941065aaf6..00b153317abccda2c744b006289af26d6b1af38f 100644 (file)
@@ -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`
index 6b63feaba89a3c58c8c0b06c4575d745c8d295dd..97210a8aa6ad225d52c927f2f0a7a6e9a1c9c78c 100644 (file)
@@ -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`
index 69e2ab72912d4baaa279768c1b1f3bce93208f79..190721492a277ca3b780f5775bbdb7758893f870 100644 (file)
@@ -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`
index bfc6265662e48eee4c9ea1cda39bb10b759c628f..b8d10f4f396cf99a0504cd9eae6dd3daef18176f 100644 (file)
@@ -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`
index ec8f02c9c4feda7561a126255288ac063bbf48cf..c138da032ce204864ba38ad17143416c30e1602c 100644 (file)
@@ -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`
index 88b4bec0451790efcb78bec79301b1f5dd90d8f6..5310939af9c3db7abff453bf3a202cfc9a47e654 100644 (file)
@@ -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`