From f1a2f2098fb1ad72f315558441b2ef26daf2fe42 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 28 Oct 2021 13:38:41 +0000 Subject: [PATCH] Remove dead code. We don't do member constraint checks in regionck anymore. All member constraint checks are done in mir borrowck. --- compiler/rustc_trait_selection/src/opaque_types.rs | 12 +----------- compiler/rustc_typeck/src/check/regionck.rs | 3 --- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index 6c5e6b1cfc3..197226197d3 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -23,8 +23,6 @@ fn instantiate_opaque_types>( value_span: Span, ) -> InferOk<'tcx, T>; - fn constrain_opaque_types(&self); - fn constrain_opaque_type( &self, opaque_type_key: OpaqueTypeKey<'tcx>, @@ -254,14 +252,6 @@ fn instantiate_opaque_types>( /// - `opaque_types` -- the map produced by `instantiate_opaque_types` /// - `free_region_relations` -- something that can be used to relate /// the free regions (`'a`) that appear in the impl trait. - fn constrain_opaque_types(&self) { - let opaque_types = self.inner.borrow().opaque_types.clone(); - for (opaque_type_key, opaque_defn) in opaque_types { - self.constrain_opaque_type(opaque_type_key, &opaque_defn); - } - } - - /// See `constrain_opaque_types` for documentation. #[instrument(level = "debug", skip(self))] fn constrain_opaque_type( &self, @@ -363,7 +353,7 @@ fn generate_member_constraint( /// purpose of this function is to do that translation. /// /// (*) C1 and C2 were introduced in the comments on - /// `constrain_opaque_types`. Read that comment for more context. + /// `constrain_opaque_type`. Read that comment for more context. /// /// # Parameters /// diff --git a/compiler/rustc_typeck/src/check/regionck.rs b/compiler/rustc_typeck/src/check/regionck.rs index f945a2e5063..230a576046a 100644 --- a/compiler/rustc_typeck/src/check/regionck.rs +++ b/compiler/rustc_typeck/src/check/regionck.rs @@ -88,7 +88,6 @@ use rustc_middle::ty::adjustment; use rustc_middle::ty::{self, Ty}; use rustc_span::Span; -use rustc_trait_selection::opaque_types::InferCtxtExt as _; use std::ops::Deref; // a variation on try that just returns unit @@ -340,8 +339,6 @@ fn visit_fn_body( self.link_fn_params(body.params); self.visit_body(body); self.visit_region_obligations(body_id.hir_id); - - self.constrain_opaque_types(); } fn visit_region_obligations(&mut self, hir_id: hir::HirId) {