diff --git a/compiler/rustc_infer/src/infer/at.rs b/compiler/rustc_infer/src/infer/at.rs index 71ee4f1e76d6d..09b02ba74a8de 100644 --- a/compiler/rustc_infer/src/infer/at.rs +++ b/compiler/rustc_infer/src/infer/at.rs @@ -65,7 +65,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { Self { tcx: self.tcx.clone(), defining_use_anchor: self.defining_use_anchor.clone(), - reveal_defining_opaque_types: self.reveal_defining_opaque_types.clone(), in_progress_typeck_results: self.in_progress_typeck_results.clone(), inner: self.inner.clone(), skip_leak_check: self.skip_leak_check.clone(), diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index a9b4451e77b08..bd59bf4dea883 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -290,10 +290,6 @@ pub struct InferCtxt<'a, 'tcx> { /// to the outside until the end up in an `InferCtxt` for typeck or borrowck. pub defining_use_anchor: Option, - /// Used by WF-checking to not have to figure out hidden types itself, but - /// to just invoke type_of to get the already computed hidden type from typeck. - pub reveal_defining_opaque_types: bool, - /// During type-checking/inference of a body, `in_progress_typeck_results` /// contains a reference to the typeck results being built up, which are /// used for reading closure kinds/signatures as they are inferred, @@ -569,7 +565,6 @@ pub struct InferCtxtBuilder<'tcx> { tcx: TyCtxt<'tcx>, fresh_typeck_results: Option>>, defining_use_anchor: Option, - reveal_defining_opaque_types: bool, } pub trait TyCtxtInferExt<'tcx> { @@ -578,12 +573,7 @@ pub trait TyCtxtInferExt<'tcx> { impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> { fn infer_ctxt(self) -> InferCtxtBuilder<'tcx> { - InferCtxtBuilder { - tcx: self, - defining_use_anchor: None, - fresh_typeck_results: None, - reveal_defining_opaque_types: false, - } + InferCtxtBuilder { tcx: self, defining_use_anchor: None, fresh_typeck_results: None } } } @@ -607,13 +597,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> { self } - /// WF-checking doesn't need to recompute opaque types and can instead use - /// the type_of query to get them from typeck. - pub fn reveal_defining_opaque_types(mut self) -> Self { - self.reveal_defining_opaque_types = true; - self - } - /// Given a canonical value `C` as a starting point, create an /// inference context that contains each of the bound values /// within instantiated as a fresh variable. The `f` closure is @@ -638,17 +621,11 @@ impl<'tcx> InferCtxtBuilder<'tcx> { } pub fn enter(&mut self, f: impl for<'a> FnOnce(InferCtxt<'a, 'tcx>) -> R) -> R { - let InferCtxtBuilder { - tcx, - defining_use_anchor, - reveal_defining_opaque_types, - ref fresh_typeck_results, - } = *self; + let InferCtxtBuilder { tcx, defining_use_anchor, ref fresh_typeck_results } = *self; let in_progress_typeck_results = fresh_typeck_results.as_ref(); f(InferCtxt { tcx, defining_use_anchor, - reveal_defining_opaque_types, in_progress_typeck_results, inner: RefCell::new(InferCtxtInner::new()), lexical_region_resolutions: RefCell::new(None), diff --git a/compiler/rustc_typeck/src/check/inherited.rs b/compiler/rustc_typeck/src/check/inherited.rs index b775f24f8efd8..e7cfa3a7c1493 100644 --- a/compiler/rustc_typeck/src/check/inherited.rs +++ b/compiler/rustc_typeck/src/check/inherited.rs @@ -95,13 +95,6 @@ impl<'tcx> InheritedBuilder<'tcx> { let def_id = self.def_id; self.infcx.enter(|infcx| f(Inherited::new(infcx, def_id))) } - - /// WF-checking doesn't need to recompute opaque types and can instead use - /// the type_of query to get them from typeck. - pub fn reveal_defining_opaque_types(mut self) -> Self { - self.infcx = self.infcx.reveal_defining_opaque_types(); - self - } } impl<'a, 'tcx> Inherited<'a, 'tcx> { diff --git a/compiler/rustc_typeck/src/check/wfcheck.rs b/compiler/rustc_typeck/src/check/wfcheck.rs index 5b3aee7428829..bd08da9529a5f 100644 --- a/compiler/rustc_typeck/src/check/wfcheck.rs +++ b/compiler/rustc_typeck/src/check/wfcheck.rs @@ -968,7 +968,7 @@ fn for_item<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'_>) -> CheckWfFcxBuilder< fn for_id(tcx: TyCtxt<'_>, def_id: LocalDefId, span: Span) -> CheckWfFcxBuilder<'_> { CheckWfFcxBuilder { - inherited: Inherited::build(tcx, def_id).reveal_defining_opaque_types(), + inherited: Inherited::build(tcx, def_id), id: hir::HirId::make_owner(def_id), span, param_env: tcx.param_env(def_id),