@@ -25,17 +25,17 @@ use crate::hir_ty_lowering::{
2525#[ derive( Debug , Default ) ]
2626struct CollectedBound {
2727 /// `Trait`
28- positive : bool ,
28+ positive : Option < Span > ,
2929 /// `?Trait`
30- maybe : bool ,
30+ maybe : Option < Span > ,
3131 /// `!Trait`
32- negative : bool ,
32+ negative : Option < Span > ,
3333}
3434
3535impl CollectedBound {
3636 /// Returns `true` if any of `Trait`, `?Trait` or `!Trait` were encountered.
3737 fn any ( & self ) -> bool {
38- self . positive || self . maybe || self . negative
38+ self . positive . is_some ( ) || self . maybe . is_some ( ) || self . negative . is_some ( )
3939 }
4040}
4141
@@ -96,9 +96,9 @@ fn collect_bounds<'a, 'tcx>(
9696 }
9797
9898 match ptr. modifiers . polarity {
99- hir:: BoundPolarity :: Maybe ( _) => collect_into. maybe = true ,
100- hir:: BoundPolarity :: Negative ( _) => collect_into. negative = true ,
101- hir:: BoundPolarity :: Positive => collect_into. positive = true ,
99+ hir:: BoundPolarity :: Maybe ( _) => collect_into. maybe = Some ( ptr . span ) ,
100+ hir:: BoundPolarity :: Negative ( _) => collect_into. negative = Some ( ptr . span ) ,
101+ hir:: BoundPolarity :: Positive => collect_into. positive = Some ( ptr . span ) ,
102102 }
103103 } ) ;
104104 collect_into
@@ -180,10 +180,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
180180 ImpliedBoundsContext :: TyParam ( ..) | ImpliedBoundsContext :: AssociatedTypeOrImplTrait => {
181181 }
182182 }
183-
184183 let collected = collect_sizedness_bounds ( tcx, hir_bounds, context, span) ;
185- if ( collected. sized . maybe || collected. sized . negative )
186- && ! collected. sized . positive
184+ if let Some ( span ) = collected. sized . maybe . or ( collected. sized . negative )
185+ && collected. sized . positive . is_none ( )
187186 && !collected. meta_sized . any ( )
188187 && !collected. pointee_sized . any ( )
189188 {
0 commit comments