File tree Expand file tree Collapse file tree 1 file changed +21
-24
lines changed Expand file tree Collapse file tree 1 file changed +21
-24
lines changed Original file line number Diff line number Diff line change @@ -159,28 +159,25 @@ fn suggest_question_mark<'tcx>(
159159 }
160160
161161 let ty = substs. type_at ( 0 ) ;
162- let is_iterator = cx. tcx . infer_ctxt ( ) . enter ( |infcx| {
163- let mut fulfill_cx = <dyn TraitEngine < ' _ > >:: new ( infcx. tcx ) ;
164-
165- let cause = ObligationCause :: new (
166- span,
167- body_id. hir_id ,
168- rustc_infer:: traits:: ObligationCauseCode :: MiscObligation ,
169- ) ;
170- fulfill_cx. register_bound (
171- & infcx,
172- ty:: ParamEnv :: empty ( ) ,
173- // Erase any region vids from the type, which may not be resolved
174- infcx. tcx . erase_regions ( ty) ,
175- into_iterator_did,
176- cause,
177- ) ;
178-
179- // Select all, including ambiguous predicates
180- let errors = fulfill_cx. select_all_or_error ( & infcx) ;
181-
182- errors. is_empty ( )
183- } ) ;
184-
185- is_iterator
162+ let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
163+ let mut fulfill_cx = <dyn TraitEngine < ' _ > >:: new ( infcx. tcx ) ;
164+
165+ let cause = ObligationCause :: new (
166+ span,
167+ body_id. hir_id ,
168+ rustc_infer:: traits:: ObligationCauseCode :: MiscObligation ,
169+ ) ;
170+ fulfill_cx. register_bound (
171+ & infcx,
172+ ty:: ParamEnv :: empty ( ) ,
173+ // Erase any region vids from the type, which may not be resolved
174+ infcx. tcx . erase_regions ( ty) ,
175+ into_iterator_did,
176+ cause,
177+ ) ;
178+
179+ // Select all, including ambiguous predicates
180+ let errors = fulfill_cx. select_all_or_error ( & infcx) ;
181+
182+ errors. is_empty ( )
186183}
You can’t perform that action at this time.
0 commit comments