File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -115,13 +115,15 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
115
115
. filter ( |p| !p. is_global ( ) )
116
116
. filter_map ( |obligation| {
117
117
// Note that we do not want to deal with qualified predicates here.
118
- if let ty:: PredicateKind :: Atom ( ty:: PredicateAtom :: Trait ( pred, _) ) = obligation. predicate . kind ( ) {
119
- if pred. def_id ( ) == sized_trait {
120
- return None ;
118
+ let ty:: PredicateKind :: ForAll ( binder) = obligation. predicate . kind ( ) ;
119
+ match binder. skip_binder ( ) {
120
+ ty:: PredicateAtom :: Trait ( pred, _) if !binder. has_escaping_bound_vars ( ) => {
121
+ if pred. def_id ( ) == sized_trait {
122
+ return None ;
123
+ }
124
+ Some ( pred)
121
125
}
122
- Some ( pred)
123
- } else {
124
- None
126
+ _ => None ,
125
127
}
126
128
} )
127
129
. collect :: < Vec < _ > > ( ) ;
You can’t perform that action at this time.
0 commit comments