about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2022-09-09 15:25:29 -0500
committerCameron Steffen <cam.steffen94@gmail.com>2022-10-07 07:06:19 -0500
commit91269fa5b8a7272a2a45b0b5e8a6fa4be24fe96a (patch)
tree93266633b5b510e98e97e13c7a4b5ca95189c1a2
parent349415d1c67df81e18519a7d2c6375901ec31b3d (diff)
downloadrust-91269fa5b8a7272a2a45b0b5e8a6fa4be24fe96a.tar.gz
rust-91269fa5b8a7272a2a45b0b5e8a6fa4be24fe96a.zip
Remove a reference from Inherited
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs2
-rw-r--r--compiler/rustc_hir_analysis/src/check/fn_ctxt/mod.rs6
-rw-r--r--compiler/rustc_hir_analysis/src/check/inherited.rs18
3 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index b079ddde056..48b06898065 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -78,7 +78,7 @@ pub(super) fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Ab
 /// * inherited: other fields inherited from the enclosing fn (if any)
 #[instrument(skip(inherited, body), level = "debug")]
 pub(super) fn check_fn<'a, 'tcx>(
-    inherited: &'a Inherited<'a, 'tcx>,
+    inherited: &'a Inherited<'tcx>,
     param_env: ty::ParamEnv<'tcx>,
     fn_sig: ty::FnSig<'tcx>,
     decl: &'tcx hir::FnDecl<'tcx>,
diff --git a/compiler/rustc_hir_analysis/src/check/fn_ctxt/mod.rs b/compiler/rustc_hir_analysis/src/check/fn_ctxt/mod.rs
index 42ec2f41886..51f4cb7e0eb 100644
--- a/compiler/rustc_hir_analysis/src/check/fn_ctxt/mod.rs
+++ b/compiler/rustc_hir_analysis/src/check/fn_ctxt/mod.rs
@@ -118,7 +118,7 @@ pub struct FnCtxt<'a, 'tcx> {
 
     pub(super) enclosing_breakables: RefCell<EnclosingBreakables<'tcx>>,
 
-    pub(super) inh: &'a Inherited<'a, 'tcx>,
+    pub(super) inh: &'a Inherited<'tcx>,
 
     /// True if the function or closure's return type is known before
     /// entering the function/closure, i.e. if the return type is
@@ -132,7 +132,7 @@ pub struct FnCtxt<'a, 'tcx> {
 
 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
     pub fn new(
-        inh: &'a Inherited<'a, 'tcx>,
+        inh: &'a Inherited<'tcx>,
         param_env: ty::ParamEnv<'tcx>,
         body_id: hir::HirId,
     ) -> FnCtxt<'a, 'tcx> {
@@ -184,7 +184,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 }
 
 impl<'a, 'tcx> Deref for FnCtxt<'a, 'tcx> {
-    type Target = Inherited<'a, 'tcx>;
+    type Target = Inherited<'tcx>;
     fn deref(&self) -> &Self::Target {
         &self.inh
     }
diff --git a/compiler/rustc_hir_analysis/src/check/inherited.rs b/compiler/rustc_hir_analysis/src/check/inherited.rs
index e273571edbd..7930377abaa 100644
--- a/compiler/rustc_hir_analysis/src/check/inherited.rs
+++ b/compiler/rustc_hir_analysis/src/check/inherited.rs
@@ -29,10 +29,10 @@ use std::ops::Deref;
 /// Here, the function `foo()` and the closure passed to
 /// `bar()` will each have their own `FnCtxt`, but they will
 /// share the inherited fields.
-pub struct Inherited<'a, 'tcx> {
+pub struct Inherited<'tcx> {
     pub(super) infcx: InferCtxt<'tcx>,
 
-    pub(super) typeck_results: &'a RefCell<ty::TypeckResults<'tcx>>,
+    pub(super) typeck_results: RefCell<ty::TypeckResults<'tcx>>,
 
     pub(super) locals: RefCell<HirIdMap<super::LocalTy<'tcx>>>,
 
@@ -70,7 +70,7 @@ pub struct Inherited<'a, 'tcx> {
     pub(super) diverging_type_vars: RefCell<FxHashSet<Ty<'tcx>>>,
 }
 
-impl<'a, 'tcx> Deref for Inherited<'a, 'tcx> {
+impl<'tcx> Deref for Inherited<'tcx> {
     type Target = InferCtxt<'tcx>;
     fn deref(&self) -> &Self::Target {
         &self.infcx
@@ -86,7 +86,7 @@ pub struct InheritedBuilder<'tcx> {
     typeck_results: RefCell<ty::TypeckResults<'tcx>>,
 }
 
-impl<'tcx> Inherited<'_, 'tcx> {
+impl<'tcx> Inherited<'tcx> {
     pub fn build(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> InheritedBuilder<'tcx> {
         let hir_owner = tcx.hir().local_def_id_to_hir_id(def_id).owner;
 
@@ -124,20 +124,20 @@ impl<'tcx> Inherited<'_, 'tcx> {
 }
 
 impl<'tcx> InheritedBuilder<'tcx> {
-    pub fn enter<F, R>(&mut self, f: F) -> R
+    pub fn enter<F, R>(mut self, f: F) -> R
     where
-        F: for<'a> FnOnce(Inherited<'a, 'tcx>) -> R,
+        F: FnOnce(&Inherited<'tcx>) -> R,
     {
         let def_id = self.def_id;
-        self.infcx.enter(|infcx| f(Inherited::new(infcx, def_id, &self.typeck_results)))
+        self.infcx.enter(|infcx| f(&Inherited::new(infcx, def_id, self.typeck_results)))
     }
 }
 
-impl<'a, 'tcx> Inherited<'a, 'tcx> {
+impl<'tcx> Inherited<'tcx> {
     fn new(
         infcx: InferCtxt<'tcx>,
         def_id: LocalDefId,
-        typeck_results: &'a RefCell<ty::TypeckResults<'tcx>>,
+        typeck_results: RefCell<ty::TypeckResults<'tcx>>,
     ) -> Self {
         let tcx = infcx.tcx;
         let body_id = tcx.hir().maybe_body_owned_by(def_id);