@@ -11,7 +11,7 @@ use rustc_errors::Applicability;
1111use rustc_hir:: def:: Res ;
1212use rustc_hir:: {
1313 BoundPolarity , GenericBound , Generics , Item , ItemKind , LangItem , Node , Path , PathSegment , PredicateOrigin , QPath ,
14- TraitBoundModifiers , TraitItem , TraitRef , Ty , TyKind , WherePredicate ,
14+ TraitBoundModifiers , TraitItem , TraitRef , Ty , TyKind , WherePredicateKind ,
1515} ;
1616use rustc_lint:: { LateContext , LateLintPass } ;
1717use rustc_session:: impl_lint_pass;
@@ -124,9 +124,9 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
124124 let mut self_bounds_map = FxHashMap :: default ( ) ;
125125
126126 for predicate in item. generics . predicates {
127- if let WherePredicate :: BoundPredicate ( bound_predicate) = predicate
127+ if let WherePredicateKind :: BoundPredicate ( bound_predicate) = predicate. kind
128128 && bound_predicate. origin != PredicateOrigin :: ImplTrait
129- && !bound_predicate . span . from_expansion ( )
129+ && !predicate . span . from_expansion ( )
130130 && let TyKind :: Path ( QPath :: Resolved ( _, Path { segments, .. } ) ) = bound_predicate. bounded_ty . kind
131131 && let Some ( PathSegment {
132132 res : Res :: SelfTyParam { trait_ : def_id } ,
@@ -268,10 +268,10 @@ impl TraitBounds {
268268 let mut map: UnhashMap < SpanlessTy < ' _ , ' _ > , Vec < & GenericBound < ' _ > > > = UnhashMap :: default ( ) ;
269269 let mut applicability = Applicability :: MaybeIncorrect ;
270270 for bound in generics. predicates {
271- if let WherePredicate :: BoundPredicate ( p) = bound
271+ if let WherePredicateKind :: BoundPredicate ( p) = bound. kind
272272 && p. origin != PredicateOrigin :: ImplTrait
273273 && p. bounds . len ( ) as u64 <= self . max_trait_bounds
274- && !p . span . from_expansion ( )
274+ && !bound . span . from_expansion ( )
275275 && let bounds = p
276276 . bounds
277277 . iter ( )
@@ -295,7 +295,7 @@ impl TraitBounds {
295295 span_lint_and_help (
296296 cx,
297297 TYPE_REPETITION_IN_BOUNDS ,
298- p . span ,
298+ bound . span ,
299299 "this type has already been used as a bound predicate" ,
300300 None ,
301301 hint_string,
@@ -322,8 +322,8 @@ fn check_trait_bound_duplication<'tcx>(cx: &LateContext<'tcx>, generics: &'_ Gen
322322 . predicates
323323 . iter ( )
324324 . filter_map ( |pred| {
325- if pred. in_where_clause ( )
326- && let WherePredicate :: BoundPredicate ( bound_predicate) = pred
325+ if pred. kind . in_where_clause ( )
326+ && let WherePredicateKind :: BoundPredicate ( bound_predicate) = pred. kind
327327 && let TyKind :: Path ( QPath :: Resolved ( _, path) ) = bound_predicate. bounded_ty . kind
328328 {
329329 return Some (
@@ -347,10 +347,10 @@ fn check_trait_bound_duplication<'tcx>(cx: &LateContext<'tcx>, generics: &'_ Gen
347347 // |
348348 // compare trait bounds keyed by generic name and comparable trait to collected where
349349 // predicates eg. (T, Clone)
350- for predicate in generics. predicates . iter ( ) . filter ( |pred| !pred. in_where_clause ( ) ) {
351- if let WherePredicate :: BoundPredicate ( bound_predicate) = predicate
350+ for predicate in generics. predicates . iter ( ) . filter ( |pred| !pred. kind . in_where_clause ( ) ) {
351+ if let WherePredicateKind :: BoundPredicate ( bound_predicate) = predicate. kind
352352 && bound_predicate. origin != PredicateOrigin :: ImplTrait
353- && !bound_predicate . span . from_expansion ( )
353+ && !predicate . span . from_expansion ( )
354354 && let TyKind :: Path ( QPath :: Resolved ( _, path) ) = bound_predicate. bounded_ty . kind
355355 {
356356 let traits = rollup_traits ( cx, bound_predicate. bounds , "these bounds contain repeated elements" ) ;
0 commit comments