Skip to content

Commit 7134ad4

Browse files
committed
Move tcx from Typer into ClosureTyper
1 parent e84a719 commit 7134ad4

File tree

6 files changed

+4
-14
lines changed

6 files changed

+4
-14
lines changed

src/librustc/middle/mem_categorization.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ pub type McResult<T> = Result<T, ()>;
281281
/// know that no errors have occurred, so we simply consult the tcx and we
282282
/// can be sure that only `Ok` results will occur.
283283
pub trait Typer<'tcx> : ty::ClosureTyper<'tcx> {
284-
fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx>;
285284
fn node_ty(&self, id: ast::NodeId) -> McResult<Ty<'tcx>>;
286285
fn expr_ty_adjusted(&self, expr: &ast::Expr) -> McResult<Ty<'tcx>>;
287286
fn type_moves_by_default(&self, span: Span, ty: Ty<'tcx>) -> bool;

src/librustc/middle/traits/fulfill.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
use middle::infer::{InferCtxt};
12-
use middle::mem_categorization::Typer;
1312
use middle::ty::{self, RegionEscape, Ty};
1413
use std::collections::HashSet;
1514
use std::collections::hash_map::Entry::{Occupied, Vacant};

src/librustc/middle/traits/select.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use super::object_safety;
3232
use super::{util};
3333

3434
use middle::fast_reject;
35-
use middle::mem_categorization::Typer;
3635
use middle::subst::{Subst, Substs, TypeSpace, VecPerParamSpace};
3736
use middle::ty::{self, RegionEscape, ToPolyTraitRef, Ty};
3837
use middle::infer;

src/librustc/middle/ty.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,6 +2337,10 @@ impl ClosureKind {
23372337
}
23382338

23392339
pub trait ClosureTyper<'tcx> {
2340+
fn tcx(&self) -> &ty::ctxt<'tcx> {
2341+
self.param_env().tcx
2342+
}
2343+
23402344
fn param_env<'a>(&'a self) -> &'a ty::ParameterEnvironment<'a, 'tcx>;
23412345

23422346
/// Is this a `Fn`, `FnMut` or `FnOnce` closure? During typeck,
@@ -6463,10 +6467,6 @@ impl<'tcx> ctxt<'tcx> {
64636467
}
64646468

64656469
impl<'a,'tcx> mc::Typer<'tcx> for ParameterEnvironment<'a,'tcx> {
6466-
fn tcx(&self) -> &ty::ctxt<'tcx> {
6467-
self.tcx
6468-
}
6469-
64706470
fn node_ty(&self, id: ast::NodeId) -> mc::McResult<Ty<'tcx>> {
64716471
Ok(ty::node_id_to_type(self.tcx, id))
64726472
}

src/librustc_trans/trans/common.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,6 @@ impl<'blk, 'tcx> BlockS<'blk, 'tcx> {
637637
}
638638

639639
impl<'blk, 'tcx> mc::Typer<'tcx> for BlockS<'blk, 'tcx> {
640-
fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx> {
641-
self.tcx()
642-
}
643-
644640
fn node_ty(&self, id: ast::NodeId) -> mc::McResult<Ty<'tcx>> {
645641
Ok(node_id_type(self, id))
646642
}

src/librustc_typeck/check/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,6 @@ pub struct FnCtxt<'a, 'tcx: 'a> {
309309
}
310310

311311
impl<'a, 'tcx> mc::Typer<'tcx> for FnCtxt<'a, 'tcx> {
312-
fn tcx(&self) -> &ty::ctxt<'tcx> {
313-
self.ccx.tcx
314-
}
315312
fn node_ty(&self, id: ast::NodeId) -> McResult<Ty<'tcx>> {
316313
let ty = self.node_ty(id);
317314
self.resolve_type_vars_or_error(&ty)

0 commit comments

Comments
 (0)