]> git.lizzy.rs Git - rust.git/commitdiff
Move `tcx` from `Typer` into `ClosureTyper`
authorNiko Matsakis <niko@alum.mit.edu>
Fri, 13 Feb 2015 22:31:44 +0000 (17:31 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Wed, 18 Feb 2015 20:23:34 +0000 (15:23 -0500)
src/librustc/middle/mem_categorization.rs
src/librustc/middle/traits/fulfill.rs
src/librustc/middle/traits/select.rs
src/librustc/middle/ty.rs
src/librustc_trans/trans/common.rs
src/librustc_typeck/check/mod.rs

index 6ce5fd073419835fbf51652ddc16a67ed3d6a3f9..4be7bb9c365a16d57d846ac70a178dfda6f944ff 100644 (file)
@@ -281,7 +281,6 @@ impl<'t,TYPER:'t> Copy for MemCategorizationContext<'t,TYPER> {}
 /// know that no errors have occurred, so we simply consult the tcx and we
 /// can be sure that only `Ok` results will occur.
 pub trait Typer<'tcx> : ty::ClosureTyper<'tcx> {
-    fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx>;
     fn node_ty(&self, id: ast::NodeId) -> McResult<Ty<'tcx>>;
     fn expr_ty_adjusted(&self, expr: &ast::Expr) -> McResult<Ty<'tcx>>;
     fn type_moves_by_default(&self, span: Span, ty: Ty<'tcx>) -> bool;
index 07c7453783d9561ccef45ca8d3f12612968b9629..a9cac4be3e368026e319a32b890df4a6f36263fb 100644 (file)
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 use middle::infer::{InferCtxt};
-use middle::mem_categorization::Typer;
 use middle::ty::{self, RegionEscape, Ty};
 use std::collections::HashSet;
 use std::collections::hash_map::Entry::{Occupied, Vacant};
index 061557eb7dccd2311c51584170c41c308ade61d6..0df59c917edea88f5e6a1f72cfc466b03a99f0d6 100644 (file)
@@ -32,7 +32,6 @@
 use super::{util};
 
 use middle::fast_reject;
-use middle::mem_categorization::Typer;
 use middle::subst::{Subst, Substs, TypeSpace, VecPerParamSpace};
 use middle::ty::{self, RegionEscape, ToPolyTraitRef, Ty};
 use middle::infer;
index db8a6eef67079a3e2c698f14060e135b63913970..e3eda02b0a8429a0e7283995f4534e756cd89291 100644 (file)
@@ -2337,6 +2337,10 @@ pub fn trait_did(&self, cx: &ctxt) -> ast::DefId {
 }
 
 pub trait ClosureTyper<'tcx> {
+    fn tcx(&self) -> &ty::ctxt<'tcx> {
+        self.param_env().tcx
+    }
+
     fn param_env<'a>(&'a self) -> &'a ty::ParameterEnvironment<'a, 'tcx>;
 
     /// Is this a `Fn`, `FnMut` or `FnOnce` closure? During typeck,
@@ -6463,10 +6467,6 @@ pub fn upvar_capture(&self, upvar_id: ty::UpvarId) -> Option<ty::UpvarCapture> {
 }
 
 impl<'a,'tcx> mc::Typer<'tcx> for ParameterEnvironment<'a,'tcx> {
-    fn tcx(&self) -> &ty::ctxt<'tcx> {
-        self.tcx
-    }
-
     fn node_ty(&self, id: ast::NodeId) -> mc::McResult<Ty<'tcx>> {
         Ok(ty::node_id_to_type(self.tcx, id))
     }
index d658003702dcaabbb90924dd1e326774dbad7a8e..3709490d8dad796121c83ad626222ebb2a023708 100644 (file)
@@ -637,10 +637,6 @@ pub fn monomorphize<T>(&self, value: &T) -> T
 }
 
 impl<'blk, 'tcx> mc::Typer<'tcx> for BlockS<'blk, 'tcx> {
-    fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx> {
-        self.tcx()
-    }
-
     fn node_ty(&self, id: ast::NodeId) -> mc::McResult<Ty<'tcx>> {
         Ok(node_id_type(self, id))
     }
index ee8bf8b76276c4e283fac517b5b40f39a3e348ce..7bb2af606f5a145657b7325ae403146b942c7338 100644 (file)
@@ -309,9 +309,6 @@ pub struct FnCtxt<'a, 'tcx: 'a> {
 }
 
 impl<'a, 'tcx> mc::Typer<'tcx> for FnCtxt<'a, 'tcx> {
-    fn tcx(&self) -> &ty::ctxt<'tcx> {
-        self.ccx.tcx
-    }
     fn node_ty(&self, id: ast::NodeId) -> McResult<Ty<'tcx>> {
         let ty = self.node_ty(id);
         self.resolve_type_vars_or_error(&ty)