diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2022-09-19 22:03:59 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2022-10-07 07:10:40 -0500 |
| commit | 283abbf0e7d20176f76006825b5c52e9a4234e4c (patch) | |
| tree | 169a55f89da9def5accb58df926ef0efd1cdf46d /compiler/rustc_infer/src | |
| parent | 91269fa5b8a7272a2a45b0b5e8a6fa4be24fe96a (diff) | |
| download | rust-283abbf0e7d20176f76006825b5c52e9a4234e4c.tar.gz rust-283abbf0e7d20176f76006825b5c52e9a4234e4c.zip | |
Change InferCtxtBuilder from enter to build
Diffstat (limited to 'compiler/rustc_infer/src')
| -rw-r--r-- | compiler/rustc_infer/src/infer/mod.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 8e0c153b642..441dc3c7e88 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -602,30 +602,27 @@ impl<'tcx> InferCtxtBuilder<'tcx> { /// `V` and a substitution `S`. This substitution `S` maps from /// the bound values in `C` to their instantiated values in `V` /// (in other words, `S(C) = V`). - pub fn enter_with_canonical<T, R>( + pub fn build_with_canonical<T>( &mut self, span: Span, canonical: &Canonical<'tcx, T>, - f: impl FnOnce(InferCtxt<'tcx>, T, CanonicalVarValues<'tcx>) -> R, - ) -> R + ) -> (InferCtxt<'tcx>, T, CanonicalVarValues<'tcx>) where T: TypeFoldable<'tcx>, { - self.enter(|infcx| { - let (value, subst) = - infcx.instantiate_canonical_with_fresh_inference_vars(span, canonical); - f(infcx, value, subst) - }) + let infcx = self.build(); + let (value, subst) = infcx.instantiate_canonical_with_fresh_inference_vars(span, canonical); + (infcx, value, subst) } - pub fn enter<R>(&mut self, f: impl FnOnce(InferCtxt<'tcx>) -> R) -> R { + pub fn build(&mut self) -> InferCtxt<'tcx> { let InferCtxtBuilder { tcx, defining_use_anchor, considering_regions, ref normalize_fn_sig_for_diagnostic, } = *self; - f(InferCtxt { + InferCtxt { tcx, defining_use_anchor, considering_regions, @@ -643,7 +640,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> { normalize_fn_sig_for_diagnostic: normalize_fn_sig_for_diagnostic .as_ref() .map(|f| f.clone()), - }) + } } } |
