Skip to content

Commit 9faae6a

Browse files
committed
Remove Typer and ClosureTyper
This commit finalizes the work of the past commits by fully moving the fulfillment context into the InferCtxt, cleaning up related context interfaces, removing the Typer and ClosureTyper traits and cleaning up related intefaces
1 parent 05c57e0 commit 9faae6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+194
-304
lines changed

src/librustc/middle/astencode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use metadata::tydecode::{RegionParameter, ClosureSource};
2626
use metadata::tyencode;
2727
use middle::cast;
2828
use middle::check_const::ConstQualif;
29-
use middle::mem_categorization::Typer;
3029
use middle::privacy::{AllPublic, LastMod};
3130
use middle::subst;
3231
use middle::subst::VecPerParamSpace;

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
289289
let cause = traits::ObligationCause::new(e.span, e.id, traits::SharedStatic);
290290
let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
291291
fulfill_cx.register_builtin_bound(&infcx, ty, ty::BoundSync, cause);
292-
match fulfill_cx.select_all_or_error(&infcx, &infcx) {
292+
match fulfill_cx.select_all_or_error(&infcx) {
293293
Ok(()) => { },
294294
Err(ref errors) => {
295295
traits::report_fulfillment_errors(&infcx, errors);

src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use middle::expr_use_visitor::{JustWrite, LoanCause, MutateMode};
2121
use middle::expr_use_visitor::WriteAndRead;
2222
use middle::expr_use_visitor as euv;
2323
use middle::infer;
24-
use middle::mem_categorization::{cmt, Typer};
24+
use middle::mem_categorization::{cmt};
2525
use middle::pat_util::*;
2626
use middle::ty::*;
2727
use middle::ty;

src/librustc/middle/const_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
10331033
tcx.populate_implementations_for_trait_if_necessary(trait_ref.def_id());
10341034
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None, false);
10351035

1036-
let mut selcx = traits::SelectionContext::new(&infcx, &infcx);
1036+
let mut selcx = traits::SelectionContext::new(&infcx);
10371037
let obligation = traits::Obligation::new(traits::ObligationCause::dummy(),
10381038
trait_ref.to_poly_trait_predicate());
10391039
let selection = match selcx.select(&obligation) {

src/librustc/middle/expr_use_visitor.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ use self::OverloadedCallType::*;
2323
use middle::{def, region, pat_util};
2424
use middle::infer;
2525
use middle::mem_categorization as mc;
26-
use middle::mem_categorization::Typer;
27-
use middle::ty::{self, ClosureTyper};
26+
use middle::ty::{self};
2827
use middle::ty::{MethodCall, MethodObject, MethodTraitObject};
2928
use middle::ty::{MethodOrigin, MethodParam, MethodTypeParam};
3029
use middle::ty::{MethodStatic, MethodStaticClosure};
@@ -356,7 +355,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
356355
}
357356

358357
fn tcx(&self) -> &'t ty::ctxt<'tcx> {
359-
self.typer.tcx()
358+
self.typer.tcx
360359
}
361360

362361
fn delegate_consume(&mut self,
@@ -691,7 +690,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
691690
match local.init {
692691
None => {
693692
let delegate = &mut self.delegate;
694-
pat_util::pat_bindings(&self.typer.tcx().def_map, &*local.pat,
693+
pat_util::pat_bindings(&self.typer.tcx.def_map, &*local.pat,
695694
|_, id, span, _| {
696695
delegate.decl_without_init(id, span);
697696
})
@@ -1053,7 +1052,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
10531052
let delegate = &mut self.delegate;
10541053
return_if_err!(mc.cat_pattern(cmt_discr.clone(), pat, |mc, cmt_pat, pat| {
10551054
if pat_util::pat_is_binding(def_map, pat) {
1056-
let tcx = typer.tcx();
1055+
let tcx = typer.tcx;
10571056

10581057
debug!("binding cmt_pat={:?} pat={:?} match_mode={:?}",
10591058
cmt_pat,
@@ -1140,7 +1139,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
11401139
// the leaves of the pattern tree structure.
11411140
return_if_err!(mc.cat_pattern(cmt_discr, pat, |mc, cmt_pat, pat| {
11421141
let def_map = def_map.borrow();
1143-
let tcx = typer.tcx();
1142+
let tcx = typer.tcx;
11441143

11451144
match pat.node {
11461145
ast::PatEnum(_, _) | ast::PatQPath(..) |
@@ -1279,7 +1278,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
12791278
}
12801279
}
12811280

1282-
fn copy_or_move<'tcx>(typer: &mc::Typer<'tcx>,
1281+
fn copy_or_move<'a, 'tcx>(typer: &infer::InferCtxt<'a, 'tcx>,
12831282
cmt: &mc::cmt<'tcx>,
12841283
move_reason: MoveReason)
12851284
-> ConsumeMode

src/librustc/middle/implicator.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub enum Implication<'tcx> {
3434

3535
struct Implicator<'a, 'tcx: 'a> {
3636
infcx: &'a InferCtxt<'a,'tcx>,
37-
closure_typer: &'a (ty::ClosureTyper<'tcx>+'a),
3837
body_id: ast::NodeId,
3938
stack: Vec<(ty::Region, Option<Ty<'tcx>>)>,
4039
span: Span,
@@ -46,7 +45,6 @@ struct Implicator<'a, 'tcx: 'a> {
4645
/// appear in a context with lifetime `outer_region`
4746
pub fn implications<'a,'tcx>(
4847
infcx: &'a InferCtxt<'a,'tcx>,
49-
closure_typer: &ty::ClosureTyper<'tcx>,
5048
body_id: ast::NodeId,
5149
ty: Ty<'tcx>,
5250
outer_region: ty::Region,
@@ -60,8 +58,7 @@ pub fn implications<'a,'tcx>(
6058

6159
let mut stack = Vec::new();
6260
stack.push((outer_region, None));
63-
let mut wf = Implicator { closure_typer: closure_typer,
64-
infcx: infcx,
61+
let mut wf = Implicator { infcx: infcx,
6562
body_id: body_id,
6663
span: span,
6764
stack: stack,
@@ -404,7 +401,6 @@ impl<'a, 'tcx> Implicator<'a, 'tcx> {
404401
{
405402
let value =
406403
traits::fully_normalize(self.infcx,
407-
self.closure_typer,
408404
traits::ObligationCause::misc(self.span, self.body_id),
409405
value);
410406
match value {

0 commit comments

Comments
 (0)