adopt to building infcx
This commit is contained in:
parent
5347c81924
commit
9d4edff1b0
1 changed files with 18 additions and 21 deletions
|
@ -159,28 +159,25 @@ fn suggest_question_mark<'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
let ty = substs.type_at(0);
|
let ty = substs.type_at(0);
|
||||||
let is_iterator = cx.tcx.infer_ctxt().enter(|infcx| {
|
let infcx = cx.tcx.infer_ctxt().build();
|
||||||
let mut fulfill_cx = <dyn TraitEngine<'_>>::new(infcx.tcx);
|
let mut fulfill_cx = <dyn TraitEngine<'_>>::new(infcx.tcx);
|
||||||
|
|
||||||
let cause = ObligationCause::new(
|
let cause = ObligationCause::new(
|
||||||
span,
|
span,
|
||||||
body_id.hir_id,
|
body_id.hir_id,
|
||||||
rustc_infer::traits::ObligationCauseCode::MiscObligation,
|
rustc_infer::traits::ObligationCauseCode::MiscObligation,
|
||||||
);
|
);
|
||||||
fulfill_cx.register_bound(
|
fulfill_cx.register_bound(
|
||||||
&infcx,
|
&infcx,
|
||||||
ty::ParamEnv::empty(),
|
ty::ParamEnv::empty(),
|
||||||
// Erase any region vids from the type, which may not be resolved
|
// Erase any region vids from the type, which may not be resolved
|
||||||
infcx.tcx.erase_regions(ty),
|
infcx.tcx.erase_regions(ty),
|
||||||
into_iterator_did,
|
into_iterator_did,
|
||||||
cause,
|
cause,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Select all, including ambiguous predicates
|
// Select all, including ambiguous predicates
|
||||||
let errors = fulfill_cx.select_all_or_error(&infcx);
|
let errors = fulfill_cx.select_all_or_error(&infcx);
|
||||||
|
|
||||||
errors.is_empty()
|
errors.is_empty()
|
||||||
});
|
|
||||||
|
|
||||||
is_iterator
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue