From db75f8aa91a8757725a84db2345236f887b2ffec Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 25 Nov 2014 16:59:02 -0500 Subject: [PATCH] Move infer out of `middle::typeck` and into just `middle`. --- src/librustc/lib.rs | 1 + src/librustc/lint/builtin.rs | 2 +- src/librustc/lint/context.rs | 2 +- src/librustc/middle/check_static.rs | 4 +-- .../middle/{typeck => }/infer/coercion.rs | 9 ++++--- .../middle/{typeck => }/infer/combine.rs | 17 ++++++------ src/librustc/middle/{typeck => }/infer/doc.rs | 0 .../middle/{typeck => }/infer/equate.rs | 16 +++++------ .../{typeck => }/infer/error_reporting.rs | 27 ++++++++++--------- src/librustc/middle/{typeck => }/infer/glb.rs | 16 +++++------ .../{typeck => }/infer/higher_ranked/doc.rs | 0 .../{typeck => }/infer/higher_ranked/mod.rs | 17 ++++++------ .../middle/{typeck => }/infer/lattice.rs | 9 ++++--- src/librustc/middle/{typeck => }/infer/lub.rs | 17 ++++++------ src/librustc/middle/{typeck => }/infer/mod.rs | 0 .../infer/region_inference/doc.rs | 0 .../infer/region_inference/mod.rs | 8 +++--- .../middle/{typeck => }/infer/resolve.rs | 5 ++-- .../middle/{typeck => }/infer/skolemize.rs | 0 src/librustc/middle/{typeck => }/infer/sub.rs | 18 ++++++------- .../{typeck => }/infer/type_variable.rs | 0 .../middle/{typeck => }/infer/unify.rs | 4 +-- src/librustc/middle/traits/coherence.rs | 2 +- src/librustc/middle/traits/fulfill.rs | 2 +- src/librustc/middle/traits/mod.rs | 2 +- src/librustc/middle/traits/select.rs | 4 +-- src/librustc/middle/traits/util.rs | 2 +- src/librustc/middle/typeck/check/_match.rs | 2 +- src/librustc/middle/typeck/check/closure.rs | 2 +- src/librustc/middle/typeck/check/demand.rs | 6 ++--- .../middle/typeck/check/method/confirm.rs | 3 ++- .../middle/typeck/check/method/mod.rs | 2 +- .../middle/typeck/check/method/probe.rs | 4 +-- src/librustc/middle/typeck/check/mod.rs | 3 ++- src/librustc/middle/typeck/check/regionck.rs | 6 ++--- src/librustc/middle/typeck/check/vtable.rs | 2 +- src/librustc/middle/typeck/check/writeback.rs | 6 ++--- src/librustc/middle/typeck/coherence/mod.rs | 6 ++--- .../middle/typeck/coherence/overlap.rs | 3 +-- src/librustc/middle/typeck/collect.rs | 2 +- src/librustc/middle/typeck/mod.rs | 2 +- src/librustc_trans/save/mod.rs | 2 +- src/librustc_trans/test.rs | 8 +++--- src/librustc_trans/trans/common.rs | 2 +- src/librustc_trans/trans/expr.rs | 1 - 45 files changed, 126 insertions(+), 120 deletions(-) rename src/librustc/middle/{typeck => }/infer/coercion.rs (99%) rename src/librustc/middle/{typeck => }/infer/combine.rs (98%) rename src/librustc/middle/{typeck => }/infer/doc.rs (100%) rename src/librustc/middle/{typeck => }/infer/equate.rs (93%) rename src/librustc/middle/{typeck => }/infer/error_reporting.rs (99%) rename src/librustc/middle/{typeck => }/infer/glb.rs (92%) rename src/librustc/middle/{typeck => }/infer/higher_ranked/doc.rs (100%) rename src/librustc/middle/{typeck => }/infer/higher_ranked/mod.rs (97%) rename src/librustc/middle/{typeck => }/infer/lattice.rs (96%) rename src/librustc/middle/{typeck => }/infer/lub.rs (91%) rename src/librustc/middle/{typeck => }/infer/mod.rs (100%) rename src/librustc/middle/{typeck => }/infer/region_inference/doc.rs (100%) rename src/librustc/middle/{typeck => }/infer/region_inference/mod.rs (99%) rename src/librustc/middle/{typeck => }/infer/resolve.rs (98%) rename src/librustc/middle/{typeck => }/infer/skolemize.rs (100%) rename src/librustc/middle/{typeck => }/infer/sub.rs (92%) rename src/librustc/middle/{typeck => }/infer/type_variable.rs (100%) rename src/librustc/middle/{typeck => }/infer/unify.rs (99%) diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index a83f8afd396..d8da4df08bc 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -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; diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index cb617b169a0..8469f477edb 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -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}; diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index c7bed838eb9..8014673f759 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -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}; diff --git a/src/librustc/middle/check_static.rs b/src/librustc/middle/check_static.rs index d3c7ccf65dd..2fc85afd393 100644 --- a/src/librustc/middle/check_static.rs +++ b/src/librustc/middle/check_static.rs @@ -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; @@ -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, diff --git a/src/librustc/middle/typeck/infer/coercion.rs b/src/librustc/middle/infer/coercion.rs similarity index 99% rename from src/librustc/middle/typeck/infer/coercion.rs rename to src/librustc/middle/infer/coercion.rs index 51f8668692e..f04c519badc 100644 --- a/src/librustc/middle/typeck/infer/coercion.rs +++ b/src/librustc/middle/infer/coercion.rs @@ -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; diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/infer/combine.rs similarity index 98% rename from src/librustc/middle/typeck/infer/combine.rs rename to src/librustc/middle/infer/combine.rs index ba6ae00b667..ab9c5b86aeb 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/infer/combine.rs @@ -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}; @@ -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; diff --git a/src/librustc/middle/typeck/infer/doc.rs b/src/librustc/middle/infer/doc.rs similarity index 100% rename from src/librustc/middle/typeck/infer/doc.rs rename to src/librustc/middle/infer/doc.rs diff --git a/src/librustc/middle/typeck/infer/equate.rs b/src/librustc/middle/infer/equate.rs similarity index 93% rename from src/librustc/middle/typeck/infer/equate.rs rename to src/librustc/middle/infer/equate.rs index 356081c199a..a79a50b1781 100644 --- a/src/librustc/middle/typeck/infer/equate.rs +++ b/src/librustc/middle/infer/equate.rs @@ -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}; diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs similarity index 99% rename from src/librustc/middle/typeck/infer/error_reporting.rs rename to src/librustc/middle/infer/error_reporting.rs index 0607ccdc595..657ee088758 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/infer/error_reporting.rs @@ -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; diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/infer/glb.rs similarity index 92% rename from src/librustc/middle/typeck/infer/glb.rs rename to src/librustc/middle/infer/glb.rs index 671d2e3837c..4237a7af32f 100644 --- a/src/librustc/middle/typeck/infer/glb.rs +++ b/src/librustc/middle/infer/glb.rs @@ -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}; diff --git a/src/librustc/middle/typeck/infer/higher_ranked/doc.rs b/src/librustc/middle/infer/higher_ranked/doc.rs similarity index 100% rename from src/librustc/middle/typeck/infer/higher_ranked/doc.rs rename to src/librustc/middle/infer/higher_ranked/doc.rs diff --git a/src/librustc/middle/typeck/infer/higher_ranked/mod.rs b/src/librustc/middle/infer/higher_ranked/mod.rs similarity index 97% rename from src/librustc/middle/typeck/infer/higher_ranked/mod.rs rename to src/librustc/middle/infer/higher_ranked/mod.rs index 2f80a574bb1..95805ef8b94 100644 --- a/src/librustc/middle/typeck/infer/higher_ranked/mod.rs +++ b/src/librustc/middle/infer/higher_ranked/mod.rs @@ -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; @@ -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 @@ -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 = @@ -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); diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/infer/lattice.rs similarity index 96% rename from src/librustc/middle/typeck/infer/lattice.rs rename to src/librustc/middle/infer/lattice.rs index daec959d11c..dd514ebee52 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/infer/lattice.rs @@ -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> { diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/infer/lub.rs similarity index 91% rename from src/librustc/middle/typeck/infer/lub.rs rename to src/librustc/middle/infer/lub.rs index e7bd1f3716c..f53ba571062 100644 --- a/src/librustc/middle/typeck/infer/lub.rs +++ b/src/librustc/middle/infer/lub.rs @@ -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}; diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/infer/mod.rs similarity index 100% rename from src/librustc/middle/typeck/infer/mod.rs rename to src/librustc/middle/infer/mod.rs diff --git a/src/librustc/middle/typeck/infer/region_inference/doc.rs b/src/librustc/middle/infer/region_inference/doc.rs similarity index 100% rename from src/librustc/middle/typeck/infer/region_inference/doc.rs rename to src/librustc/middle/infer/region_inference/doc.rs diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/infer/region_inference/mod.rs similarity index 99% rename from src/librustc/middle/typeck/infer/region_inference/mod.rs rename to src/librustc/middle/infer/region_inference/mod.rs index e39fbe105dc..9155c18cb3b 100644 --- a/src/librustc/middle/typeck/infer/region_inference/mod.rs +++ b/src/librustc/middle/infer/region_inference/mod.rs @@ -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; @@ -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)); diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/infer/resolve.rs similarity index 98% rename from src/librustc/middle/typeck/infer/resolve.rs rename to src/librustc/middle/infer/resolve.rs index cf5efd188ed..eaf363ffc74 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/infer/resolve.rs @@ -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}; diff --git a/src/librustc/middle/typeck/infer/skolemize.rs b/src/librustc/middle/infer/skolemize.rs similarity index 100% rename from src/librustc/middle/typeck/infer/skolemize.rs rename to src/librustc/middle/infer/skolemize.rs diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/infer/sub.rs similarity index 92% rename from src/librustc/middle/typeck/infer/sub.rs rename to src/librustc/middle/infer/sub.rs index 65d2a513393..c470b248827 100644 --- a/src/librustc/middle/typeck/infer/sub.rs +++ b/src/librustc/middle/infer/sub.rs @@ -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}; diff --git a/src/librustc/middle/typeck/infer/type_variable.rs b/src/librustc/middle/infer/type_variable.rs similarity index 100% rename from src/librustc/middle/typeck/infer/type_variable.rs rename to src/librustc/middle/infer/type_variable.rs diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/infer/unify.rs similarity index 99% rename from src/librustc/middle/typeck/infer/unify.rs rename to src/librustc/middle/infer/unify.rs index 1b3413bfb01..6f6adb84a75 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/infer/unify.rs @@ -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; diff --git a/src/librustc/middle/traits/coherence.rs b/src/librustc/middle/traits/coherence.rs index 048f394224c..1bce353cb0c 100644 --- a/src/librustc/middle/traits/coherence.rs +++ b/src/librustc/middle/traits/coherence.rs @@ -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; diff --git a/src/librustc/middle/traits/fulfill.rs b/src/librustc/middle/traits/fulfill.rs index 25c86be993f..653c686ab19 100644 --- a/src/librustc/middle/traits/fulfill.rs +++ b/src/librustc/middle/traits/fulfill.rs @@ -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; diff --git a/src/librustc/middle/traits/mod.rs b/src/librustc/middle/traits/mod.rs index b8d915c06e0..e12ec44ad87 100644 --- a/src/librustc/middle/traits/mod.rs +++ b/src/librustc/middle/traits/mod.rs @@ -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; diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index 2604204d9e6..0e6a0c19f70 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -30,8 +30,8 @@ use middle::fast_reject; use middle::mem_categorization::Typer; use middle::subst::{Subst, Substs, VecPerParamSpace}; use middle::ty::{mod, Ty}; -use middle::typeck::infer; -use middle::typeck::infer::{InferCtxt, TypeSkolemizer}; +use middle::infer; +use middle::infer::{InferCtxt, TypeSkolemizer}; use middle::ty_fold::TypeFoldable; use std::cell::RefCell; use std::collections::hash_map::HashMap; diff --git a/src/librustc/middle/traits/util.rs b/src/librustc/middle/traits/util.rs index 1084807ef4a..1b7998a9263 100644 --- a/src/librustc/middle/traits/util.rs +++ b/src/librustc/middle/traits/util.rs @@ -11,7 +11,7 @@ use middle::subst; use middle::subst::{ParamSpace, Substs, VecPerParamSpace}; -use middle::typeck::infer::InferCtxt; +use middle::infer::InferCtxt; use middle::ty::{mod, Ty}; use std::collections::HashSet; use std::fmt; diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index cdfd607d067..6af36225364 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -14,7 +14,7 @@ use middle::subst::{Subst, Substs}; use middle::ty::{mod, Ty}; use middle::typeck::check::{check_expr, check_expr_has_type, demand, FnCtxt}; use middle::typeck::check::{instantiate_path, structurally_resolved_type, valid_range_bounds}; -use middle::typeck::infer::{mod, resolve}; +use middle::infer::{mod, resolve}; use middle::typeck::require_same_types; use util::nodemap::FnvHashMap; diff --git a/src/librustc/middle/typeck/check/closure.rs b/src/librustc/middle/typeck/check/closure.rs index 0a93b3a5ec7..252d0b09c95 100644 --- a/src/librustc/middle/typeck/check/closure.rs +++ b/src/librustc/middle/typeck/check/closure.rs @@ -14,10 +14,10 @@ use super::check_fn; use super::{Expectation, ExpectCastableToType, ExpectHasType, NoExpectation}; use super::FnCtxt; +use middle::infer; use middle::subst; use middle::ty::{mod, Ty}; use middle::typeck::astconv; -use middle::typeck::infer; use middle::typeck::rscope::RegionScope; use syntax::abi; use syntax::ast; diff --git a/src/librustc/middle/typeck/check/demand.rs b/src/librustc/middle/typeck/check/demand.rs index 1e45d059b84..df5b4a6c66a 100644 --- a/src/librustc/middle/typeck/check/demand.rs +++ b/src/librustc/middle/typeck/check/demand.rs @@ -11,9 +11,9 @@ use middle::ty::{mod, Ty}; use middle::typeck::check::FnCtxt; -use middle::typeck::infer; -use middle::typeck::infer::resolve_type; -use middle::typeck::infer::resolve::try_resolve_tvar_shallow; +use middle::infer; +use middle::infer::resolve_type; +use middle::infer::resolve::try_resolve_tvar_shallow; use std::result::{Err, Ok}; use std::result; diff --git a/src/librustc/middle/typeck/check/method/confirm.rs b/src/librustc/middle/typeck/check/method/confirm.rs index 4e541f120ab..291b0231213 100644 --- a/src/librustc/middle/typeck/check/method/confirm.rs +++ b/src/librustc/middle/typeck/check/method/confirm.rs @@ -16,7 +16,8 @@ use middle::ty::{mod, Ty}; use middle::ty::{MethodCall, MethodCallee, MethodObject, MethodOrigin, MethodParam, MethodStatic, MethodTraitObject, MethodTypeParam}; use middle::typeck::check::{mod, FnCtxt, NoPreference, PreferMutLvalue}; -use middle::typeck::infer::{mod, InferCtxt}; +use middle::infer; +use middle::infer::InferCtxt; use middle::ty_fold::HigherRankedFoldable; use syntax::ast; use syntax::codemap::Span; diff --git a/src/librustc/middle/typeck/check/method/mod.rs b/src/librustc/middle/typeck/check/method/mod.rs index 001f5be69a1..df0df7f47a5 100644 --- a/src/librustc/middle/typeck/check/method/mod.rs +++ b/src/librustc/middle/typeck/check/method/mod.rs @@ -20,7 +20,7 @@ use middle::typeck::check::{FnCtxt}; use middle::typeck::check::{impl_self_ty}; use middle::typeck::check::vtable; use middle::typeck::check::vtable::select_new_fcx_obligations; -use middle::typeck::infer; +use middle::infer; use util::ppaux::{Repr, UserString}; use std::rc::Rc; diff --git a/src/librustc/middle/typeck/check/method/probe.rs b/src/librustc/middle/typeck/check/method/probe.rs index 689071b77e4..6abc3a7ca57 100644 --- a/src/librustc/middle/typeck/check/method/probe.rs +++ b/src/librustc/middle/typeck/check/method/probe.rs @@ -21,8 +21,8 @@ use middle::ty::{MethodObject}; use middle::ty_fold::HigherRankedFoldable; use middle::typeck::check; use middle::typeck::check::{FnCtxt, NoPreference}; -use middle::typeck::infer; -use middle::typeck::infer::InferCtxt; +use middle::infer; +use middle::infer::InferCtxt; use syntax::ast; use syntax::codemap::{Span, DUMMY_SP}; use std::collections::HashSet; diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 0033613d9c6..02106f25304 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -84,6 +84,7 @@ use self::TupleArgumentsFlag::*; use session::Session; use middle::{const_eval, def, traits}; +use middle::infer; use middle::lang_items::IteratorItem; use middle::mem_categorization::{mod, McResult}; use middle::pat_util::{mod, pat_id_map}; @@ -98,7 +99,7 @@ use middle::ty_fold::TypeFolder; use middle::typeck::astconv::{mod, ast_region_to_region, ast_ty_to_ty, AstConv}; use middle::typeck::check::_match::pat_ctxt; use middle::typeck::rscope::RegionScope; -use middle::typeck::{CrateCtxt, infer, lookup_def_ccx, no_params, require_same_types}; +use middle::typeck::{CrateCtxt, lookup_def_ccx, no_params, require_same_types}; use middle::typeck::TypeAndSubsts; use middle::lang_items::TypeIdLangItem; use lint; diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index 1c938bc1e1f..b466e258945 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -124,9 +124,9 @@ use middle::typeck::astconv::AstConv; use middle::typeck::check::FnCtxt; use middle::typeck::check::regionmanip; use middle::typeck::check::vtable; -use middle::typeck::infer::resolve_and_force_all_but_regions; -use middle::typeck::infer::resolve_type; -use middle::typeck::infer; +use middle::infer::resolve_and_force_all_but_regions; +use middle::infer::resolve_type; +use middle::infer; use middle::pat_util; use util::nodemap::{DefIdMap, NodeMap, FnvHashMap}; use util::ppaux::{ty_to_string, Repr}; diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 84cb74b4de2..5d6093c21e6 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -17,7 +17,7 @@ use middle::traits::{ObligationCause}; use middle::ty::{mod, Ty}; use middle::typeck::check::{FnCtxt, structurally_resolved_type}; -use middle::typeck::infer; +use middle::infer; use std::rc::Rc; use syntax::ast; use syntax::codemap::Span; diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index 8205e83fb05..e2eee66387f 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -19,9 +19,9 @@ use middle::ty::{mod, Ty, MethodCall, MethodCallee}; use middle::ty_fold::{TypeFolder,TypeFoldable}; use middle::typeck::astconv::AstConv; use middle::typeck::check::FnCtxt; -use middle::typeck::infer::{force_all, resolve_all, resolve_region}; -use middle::typeck::infer::resolve_type; -use middle::typeck::infer; +use middle::infer::{force_all, resolve_all, resolve_region}; +use middle::infer::resolve_type; +use middle::infer; use middle::typeck::write_substs_to_tcx; use middle::typeck::write_ty_to_tcx; use util::ppaux::Repr; diff --git a/src/librustc/middle/typeck/coherence/mod.rs b/src/librustc/middle/typeck/coherence/mod.rs index 758608b79c2..4e1bcec5eea 100644 --- a/src/librustc/middle/typeck/coherence/mod.rs +++ b/src/librustc/middle/typeck/coherence/mod.rs @@ -32,9 +32,9 @@ use middle::ty::type_is_ty_var; use middle::subst::Subst; use middle::ty; use middle::typeck::CrateCtxt; -use middle::typeck::infer::combine::Combine; -use middle::typeck::infer::InferCtxt; -use middle::typeck::infer::{new_infer_ctxt, resolve_ivar, resolve_type}; +use middle::infer::combine::Combine; +use middle::infer::InferCtxt; +use middle::infer::{new_infer_ctxt, resolve_ivar, resolve_type}; use std::collections::{HashSet}; use std::cell::RefCell; use std::rc::Rc; diff --git a/src/librustc/middle/typeck/coherence/overlap.rs b/src/librustc/middle/typeck/coherence/overlap.rs index 9f10a58f458..0e74d4578d9 100644 --- a/src/librustc/middle/typeck/coherence/overlap.rs +++ b/src/librustc/middle/typeck/coherence/overlap.rs @@ -13,8 +13,7 @@ use middle::traits; use middle::ty; -use middle::typeck::infer::{new_infer_ctxt}; -use middle::typeck::infer; +use middle::infer::{mod, new_infer_ctxt}; use syntax::ast::{DefId}; use syntax::ast::{LOCAL_CRATE}; use syntax::ast; diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 6e989dd73db..5e1dbe16e3c 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -46,7 +46,7 @@ use middle::ty_fold::TypeFolder; use middle::typeck::astconv::{AstConv, ty_of_arg}; use middle::typeck::astconv::{ast_ty_to_ty, ast_region_to_region}; use middle::typeck::astconv; -use middle::typeck::infer; +use middle::infer; use middle::typeck::rscope::*; use middle::typeck::{CrateCtxt, lookup_def_tcx, no_params, write_ty_to_tcx}; use middle::typeck; diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index a95849e083d..dbec92d02df 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -63,6 +63,7 @@ independently: use middle::def; use middle::resolve; +use middle::infer; use middle::subst; use middle::subst::VecPerParamSpace; use middle::ty::{mod, Ty}; @@ -78,7 +79,6 @@ use syntax::{ast, ast_map, abi}; pub mod check; pub mod rscope; pub mod astconv; -pub mod infer; pub mod collect; pub mod coherence; pub mod variance; diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs index 481ee679dbd..59bbeb2dbc4 100644 --- a/src/librustc_trans/save/mod.rs +++ b/src/librustc_trans/save/mod.rs @@ -30,7 +30,7 @@ use driver::driver::CrateAnalysis; use session::Session; -use middle::{def, typeck}; +use middle::def; use middle::ty::{mod, Ty}; use std::cell::Cell; diff --git a/src/librustc_trans/test.rs b/src/librustc_trans/test.rs index 41fbe855769..9244e6909e8 100644 --- a/src/librustc_trans/test.rs +++ b/src/librustc_trans/test.rs @@ -21,10 +21,10 @@ use middle::stability; use middle::subst; use middle::subst::Subst; use middle::ty::{mod, Ty}; -use middle::typeck::infer::combine::Combine; -use middle::typeck::infer; -use middle::typeck::infer::lub::Lub; -use middle::typeck::infer::glb::Glb; +use middle::infer::combine::Combine; +use middle::infer; +use middle::infer::lub::Lub; +use middle::infer::glb::Glb; use session::{mod,config}; use syntax::{abi, ast, ast_map, ast_util}; use syntax::codemap; diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs index 6bd86cf5aa4..be3780facaa 100644 --- a/src/librustc_trans/trans/common.rs +++ b/src/librustc_trans/trans/common.rs @@ -19,6 +19,7 @@ use llvm; use llvm::{ValueRef, BasicBlockRef, BuilderRef, ContextRef}; use llvm::{True, False, Bool}; use middle::def; +use middle::infer; use middle::lang_items::LangItem; use middle::mem_categorization as mc; use middle::region; @@ -36,7 +37,6 @@ use middle::traits; use middle::ty::{mod, Ty}; use middle::ty_fold; use middle::ty_fold::TypeFoldable; -use middle::typeck::infer; use util::ppaux::Repr; use util::nodemap::{DefIdMap, FnvHashMap, NodeMap}; diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index f538a73329b..d130dc0a55b 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/trans/expr.rs @@ -41,7 +41,6 @@ use middle::def; use middle::mem_categorization::Typer; use middle::subst::{mod, Subst}; use trans::{_match, adt, asm, base, callee, closure, consts, controlflow}; -use trans::{debuginfo, glue, machine, meth, inline, tvec, type_of}; use trans::base::*; use trans::build::*; use trans::cleanup::{mod, CleanupMethods};