Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate typeck/trans into distinct crates. #19362

Merged
merged 15 commits into from
Dec 5, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move infer out of middle::typeck and into just middle.
  • Loading branch information
nikomatsakis committed Dec 4, 2014
commit db75f8aa91a8757725a84db2345236f887b2ffec
1 change: 1 addition & 0 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub mod middle {
pub mod fast_reject;
pub mod graph;
pub mod intrinsicck;
pub mod infer;
pub mod lang_items;
pub mod liveness;
pub mod mem_categorization;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ use self::MethodContext::*;

use metadata::csearch;
use middle::def::*;
use middle::infer;
use middle::ty::{mod, Ty};
use middle::typeck::astconv::ast_ty_to_ty;
use middle::typeck::infer;
use middle::{def, pat_util, stability};
use middle::const_eval::{eval_const_expr_partial, const_int, const_uint};
use util::ppaux::{ty_to_string};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
//! for all lint attributes.
use self::TargetLint::*;

use middle::infer;
use middle::privacy::ExportedItems;
use middle::subst;
use middle::ty::{mod, Ty};
use middle::typeck::astconv::AstConv;
use middle::typeck::infer;
use session::{early_error, Session};
use lint::{Level, LevelSource, Lint, LintId, LintArray, LintPass, LintPassObject};
use lint::{Default, CommandLine, Node, Allow, Warn, Deny, Forbid};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/check_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use self::Mode::*;

use middle::ty;
use middle::def;
use middle::typeck;
use middle::infer;
use middle::traits;
use middle::mem_categorization as mc;
use middle::expr_use_visitor as euv;
Expand Down Expand Up @@ -113,7 +113,7 @@ impl<'a, 'tcx> CheckStaticVisitor<'a, 'tcx> {

fn check_static_type(&self, e: &ast::Expr) {
let ty = ty::node_id_to_type(self.tcx, e.id);
let infcx = typeck::infer::new_infer_ctxt(self.tcx);
let infcx = infer::new_infer_ctxt(self.tcx);
let mut fulfill_cx = traits::FulfillmentContext::new();
let cause = traits::ObligationCause::misc(DUMMY_SP);
let obligation = traits::obligation_for_builtin_bound(self.tcx, cause, ty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@
//! sort of a minor point so I've opted to leave it for later---after all
//! we may want to adjust precisely when coercions occur.

use super::{CoerceResult, resolve_type, Coercion};
use super::combine::{CombineFields, Combine};
use super::sub::Sub;
use super::resolve::try_resolve_tvar_shallow;

use middle::subst;
use middle::ty::{AutoPtr, AutoDerefRef, AdjustDerefRef, AutoUnsize, AutoUnsafe};
use middle::ty::{mt};
use middle::ty::{mod, Ty};
use middle::typeck::infer::{CoerceResult, resolve_type, Coercion};
use middle::typeck::infer::combine::{CombineFields, Combine};
use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::resolve::try_resolve_tvar_shallow;
use util::ppaux;
use util::ppaux::Repr;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
// is also useful to track which value is the "expected" value in
// terms of error reporting.

use super::equate::Equate;
use super::glb::Glb;
use super::lub::Lub;
use super::sub::Sub;
use super::unify::InferCtxtMethodsForSimplyUnifiableTypes;
use super::{InferCtxt, cres};
use super::{MiscVariable, TypeTrace};
use super::type_variable::{RelationDir, EqTo, SubtypeOf, SupertypeOf};

use middle::subst;
use middle::subst::{ErasedRegions, NonerasedRegions, Substs};
Expand All @@ -40,15 +48,6 @@ use middle::ty::{IntType, UintType};
use middle::ty::{BuiltinBounds};
use middle::ty::{mod, Ty};
use middle::ty_fold;
use middle::typeck::infer::equate::Equate;
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::lub::Lub;
use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::unify::InferCtxtMethodsForSimplyUnifiableTypes;
use middle::typeck::infer::{InferCtxt, cres};
use middle::typeck::infer::{MiscVariable, TypeTrace};
use middle::typeck::infer::type_variable::{RelationDir, EqTo,
SubtypeOf, SupertypeOf};
use middle::ty_fold::{TypeFoldable};
use util::ppaux::Repr;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
use middle::ty::{BuiltinBounds};
use middle::ty::{mod, Ty};
use middle::ty::TyVar;
use middle::typeck::infer::combine::*;
use middle::typeck::infer::{cres};
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::InferCtxt;
use middle::typeck::infer::lub::Lub;
use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::{TypeTrace, Subtype};
use middle::typeck::infer::type_variable::{EqTo};
use middle::infer::combine::*;
use middle::infer::{cres};
use middle::infer::glb::Glb;
use middle::infer::InferCtxt;
use middle::infer::lub::Lub;
use middle::infer::sub::Sub;
use middle::infer::{TypeTrace, Subtype};
use middle::infer::type_variable::{EqTo};
use util::ppaux::{Repr};

use syntax::ast::{Onceness, FnStyle};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,25 @@

use self::FreshOrKept::*;

use super::InferCtxt;
use super::TypeTrace;
use super::SubregionOrigin;
use super::RegionVariableOrigin;
use super::ValuePairs;
use super::region_inference::RegionResolutionError;
use super::region_inference::ConcreteFailure;
use super::region_inference::SubSupConflict;
use super::region_inference::SupSupConflict;
use super::region_inference::ParamBoundFailure;
use super::region_inference::ProcessedErrors;
use super::region_inference::SameRegions;

use std::collections::HashSet;
use middle::def;
use middle::infer;
use middle::subst;
use middle::ty::{mod, Ty};
use middle::ty::{Region, ReFree};
use middle::typeck::infer;
use middle::typeck::infer::InferCtxt;
use middle::typeck::infer::TypeTrace;
use middle::typeck::infer::SubregionOrigin;
use middle::typeck::infer::RegionVariableOrigin;
use middle::typeck::infer::ValuePairs;
use middle::typeck::infer::region_inference::RegionResolutionError;
use middle::typeck::infer::region_inference::ConcreteFailure;
use middle::typeck::infer::region_inference::SubSupConflict;
use middle::typeck::infer::region_inference::SupSupConflict;
use middle::typeck::infer::region_inference::ParamBoundFailure;
use middle::typeck::infer::region_inference::ProcessedErrors;
use middle::typeck::infer::region_inference::SameRegions;
use std::cell::{Cell, RefCell};
use std::char::from_u32;
use std::rc::Rc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::combine::*;
use super::lattice::*;
use super::equate::Equate;
use super::higher_ranked::HigherRankedRelations;
use super::lub::Lub;
use super::sub::Sub;
use super::{cres, InferCtxt};
use super::{TypeTrace, Subtype};

use middle::ty::{BuiltinBounds};
use middle::ty::{mod, Ty};
use middle::typeck::infer::combine::*;
use middle::typeck::infer::lattice::*;
use middle::typeck::infer::equate::Equate;
use middle::typeck::infer::higher_ranked::HigherRankedRelations;
use middle::typeck::infer::lub::Lub;
use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::{cres, InferCtxt};
use middle::typeck::infer::{TypeTrace, Subtype};
use syntax::ast::{Many, Once, MutImmutable, MutMutable};
use syntax::ast::{NormalFn, UnsafeFn};
use syntax::ast::{Onceness, FnStyle};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
//! Helper routines for higher-ranked things. See the `doc` module at
//! the end of the file for details.

use super::{combine, cres, InferCtxt, HigherRankedType};
use super::combine::Combine;
use super::region_inference::{RegionMark};

use middle::ty::{mod, Ty, replace_late_bound_regions};
use middle::typeck::infer::{mod, combine, cres, InferCtxt};
use middle::typeck::infer::combine::Combine;
use middle::typeck::infer::region_inference::{RegionMark};
use middle::ty_fold::{mod, HigherRankedFoldable, TypeFoldable};
use syntax::codemap::Span;
use util::nodemap::FnvHashMap;
Expand Down Expand Up @@ -62,7 +63,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
let (a_prime, _) =
self.infcx().replace_late_bound_regions_with_fresh_var(
self.trace().origin.span(),
infer::HigherRankedType,
HigherRankedType,
a);

// Second, we instantiate each bound region in the supertype with a
Expand Down Expand Up @@ -131,10 +132,10 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
let span = self.trace().origin.span();
let (a_with_fresh, a_map) =
self.infcx().replace_late_bound_regions_with_fresh_var(
span, infer::HigherRankedType, a);
span, HigherRankedType, a);
let (b_with_fresh, _) =
self.infcx().replace_late_bound_regions_with_fresh_var(
span, infer::HigherRankedType, b);
span, HigherRankedType, b);

// Collect constraints.
let result0 =
Expand Down Expand Up @@ -221,10 +222,10 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
// Instantiate each bound region with a fresh region variable.
let (a_with_fresh, a_map) =
self.infcx().replace_late_bound_regions_with_fresh_var(
self.trace().origin.span(), infer::HigherRankedType, a);
self.trace().origin.span(), HigherRankedType, a);
let (b_with_fresh, b_map) =
self.infcx().replace_late_bound_regions_with_fresh_var(
self.trace().origin.span(), infer::HigherRankedType, b);
self.trace().origin.span(), HigherRankedType, b);
let a_vars = var_ids(self, &a_map);
let b_vars = var_ids(self, &b_map);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
//! over a `LatticeValue`, which is a value defined with respect to
//! a lattice.

use super::*;
use super::combine::*;
use super::glb::Glb;
use super::lub::Lub;

use middle::ty::{TyVar};
use middle::ty::{mod, Ty};
use middle::typeck::infer::*;
use middle::typeck::infer::combine::*;
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::lub::Lub;
use util::ppaux::Repr;

pub trait LatticeDir<'tcx> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::combine::*;
use super::equate::Equate;
use super::glb::Glb;
use super::higher_ranked::HigherRankedRelations;
use super::lattice::*;
use super::sub::Sub;
use super::{cres, InferCtxt};
use super::{TypeTrace, Subtype};

use middle::ty::{BuiltinBounds};
use middle::ty::{mod, Ty};
use middle::typeck::infer::combine::*;
use middle::typeck::infer::equate::Equate;
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::higher_ranked::HigherRankedRelations;
use middle::typeck::infer::lattice::*;
use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::{cres, InferCtxt};
use middle::typeck::infer::{TypeTrace, Subtype};
use syntax::ast::{Many, Once};
use syntax::ast::{NormalFn, UnsafeFn};
use syntax::ast::{Onceness, FnStyle};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ pub use self::RegionResolutionError::*;
pub use self::VarValue::*;
use self::Classification::*;

use super::cres;
use super::{RegionVariableOrigin, SubregionOrigin, TypeTrace, MiscVariable};

use middle::region;
use middle::ty;
use middle::ty::{BoundRegion, FreeRegion, Region, RegionVid};
use middle::ty::{ReEmpty, ReStatic, ReInfer, ReFree, ReEarlyBound};
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
use middle::typeck::infer::cres;
use middle::typeck::infer::{RegionVariableOrigin, SubregionOrigin, TypeTrace};
use middle::typeck::infer;
use middle::graph;
use middle::graph::{Direction, NodeIndex};
use util::common::indenter;
Expand Down Expand Up @@ -573,7 +573,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
}
None => {}
}
let c = self.new_region_var(infer::MiscVariable(origin.span()));
let c = self.new_region_var(MiscVariable(origin.span()));
self.combine_map(t).borrow_mut().insert(vars, c);
if self.in_snapshot() {
self.undo_log.borrow_mut().push(AddCombination(t, vars));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@

#![allow(non_upper_case_globals)]

use super::{fixup_err, fres, InferCtxt};
use super::{unresolved_int_ty,unresolved_float_ty,unresolved_ty};

use middle::ty::{FloatVar, FloatVid, IntVar, IntVid, RegionVid, TyVar, TyVid};
use middle::ty::{IntType, UintType};
use middle::ty::{mod, Ty};
use middle::ty_fold;
use middle::typeck::infer::{fixup_err, fres, InferCtxt};
use middle::typeck::infer::{unresolved_int_ty,unresolved_float_ty,unresolved_ty};
use syntax::codemap::Span;
use util::ppaux::{Repr, ty_to_string};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::combine::*;
use super::{cres, CresCompare};
use super::equate::Equate;
use super::glb::Glb;
use super::higher_ranked::HigherRankedRelations;
use super::InferCtxt;
use super::lub::Lub;
use super::{TypeTrace, Subtype};
use super::type_variable::{SubtypeOf, SupertypeOf};

use middle::ty::{BuiltinBounds};
use middle::ty::{mod, Ty};
use middle::ty::TyVar;
use middle::typeck::infer::combine::*;
use middle::typeck::infer::{cres, CresCompare};
use middle::typeck::infer::equate::Equate;
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::higher_ranked::HigherRankedRelations;
use middle::typeck::infer::InferCtxt;
use middle::typeck::infer::lub::Lub;
use middle::typeck::infer::{TypeTrace, Subtype};
use middle::typeck::infer::type_variable::{SubtypeOf, SupertypeOf};
use util::ppaux::{Repr};

use syntax::ast::{Onceness, FnStyle, MutImmutable, MutMutable};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use std::kinds::marker;

use middle::ty::{expected_found, IntVarValue};
use middle::ty::{mod, Ty};
use middle::typeck::infer::{uok, ures};
use middle::typeck::infer::InferCtxt;
use middle::infer::{uok, ures};
use middle::infer::InferCtxt;
use std::cell::RefCell;
use std::fmt::Show;
use syntax::ast;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/traits/coherence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::util;
use middle::subst;
use middle::subst::Subst;
use middle::ty::{mod, Ty};
use middle::typeck::infer::{mod, InferCtxt};
use middle::infer::{mod, InferCtxt};
use syntax::ast;
use syntax::codemap::DUMMY_SP;
use util::ppaux::Repr;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/traits/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use middle::mem_categorization::Typer;
use middle::ty;
use middle::typeck::infer::InferCtxt;
use middle::infer::InferCtxt;
use std::collections::HashSet;
use std::rc::Rc;
use util::ppaux::Repr;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub use self::ObligationCauseCode::*;
use middle::mem_categorization::Typer;
use middle::subst;
use middle::ty::{mod, Ty};
use middle::typeck::infer::InferCtxt;
use middle::infer::InferCtxt;
use std::rc::Rc;
use std::slice::Items;
use syntax::ast;
Expand Down
Loading