Skip to content

Commit 9d4edff

Browse files
committed
adopt to building infcx
1 parent 5347c81 commit 9d4edff

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

compiler/rustc_lint/src/for_loops_over_fallibles.rs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)