Skip to content

Flatten rustc and rustc_trans module hierarchy slightly. #32432

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

Merged
merged 4 commits into from
Mar 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TARGET_CRATES := libc std term \
RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
rustc_data_structures rustc_front rustc_platform_intrinsics \
rustc_plugin rustc_metadata rustc_passes
rustc_plugin rustc_metadata rustc_passes rustc_save_analysis
HOST_CRATES := syntax syntax_ext $(RUSTC_CRATES) rustdoc fmt_macros \
flate arena graphviz rbml log serialize
TOOLS := compiletest rustdoc rustc rustbook error_index_generator
Expand Down Expand Up @@ -102,7 +102,7 @@ DEPS_rustc_data_structures := std log serialize
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \
rustc_trans rustc_privacy rustc_lint rustc_front rustc_plugin \
rustc_metadata syntax_ext rustc_passes
rustc_metadata syntax_ext rustc_passes rustc_save_analysis
DEPS_rustc_front := std syntax log serialize
DEPS_rustc_lint := rustc log syntax
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
Expand All @@ -116,6 +116,7 @@ DEPS_rustc_privacy := rustc rustc_front log syntax
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back rustc_mir \
log syntax serialize rustc_llvm rustc_front rustc_platform_intrinsics \
rustc_const_eval
DEPS_rustc_save_analysis := rustc log syntax rustc_front
DEPS_rustc_typeck := rustc syntax rustc_front rustc_platform_intrinsics rustc_const_eval

DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
// except according to those terms.

use rustc_data_structures::graph;
use middle::cfg::*;
use cfg::*;
use middle::def::Def;
use middle::pat_util;
use middle::ty::{self, TyCtxt};
use ty::{self, TyCtxt};
use syntax::ast;
use syntax::ptr::P;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use graphviz::IntoCow;
use syntax::ast;

use front::map as ast_map;
use middle::cfg;
use cfg;

pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
pub type Edge<'a> = &'a cfg::CFGEdge;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/cfg/mod.rs → src/librustc/cfg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//! Uses `Graph` as the underlying representation.

use rustc_data_structures::graph;
use middle::ty::TyCtxt;
use ty::TyCtxt;
use syntax::ast;
use rustc_front::hir;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use self::thread::{DepGraphThreadData, DepMessage};
use middle::def_id::DefId;
use syntax::ast::NodeId;
use middle::ty::TyCtxt;
use ty::TyCtxt;
use rustc_front::hir;
use rustc_front::intravisit::Visitor;
use std::rc::Rc;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
use super::combine::{self, CombineFields};
use super::type_variable::{BiTo};

use middle::ty::{self, Ty, TyCtxt};
use middle::ty::TyVar;
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
use ty::{self, Ty, TyCtxt};
use ty::TyVar;
use ty::relate::{Relate, RelateResult, TypeRelation};

pub struct Bivariate<'a, 'tcx: 'a> {
fields: CombineFields<'a, 'tcx>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ use super::{InferCtxt};
use super::{MiscVariable, TypeTrace};
use super::type_variable::{RelationDir, BiTo, EqTo, SubtypeOf, SupertypeOf};

use middle::ty::{IntType, UintType};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::error::TypeError;
use middle::ty::fold::{TypeFolder, TypeFoldable};
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
use ty::{IntType, UintType};
use ty::{self, Ty, TyCtxt};
use ty::error::TypeError;
use ty::fold::{TypeFolder, TypeFoldable};
use ty::relate::{Relate, RelateResult, TypeRelation};

use syntax::ast;
use syntax::codemap::Span;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use super::higher_ranked::HigherRankedRelations;
use super::{Subtype};
use super::type_variable::{EqTo};

use middle::ty::{self, Ty, TyCtxt};
use middle::ty::TyVar;
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
use ty::{self, Ty, TyCtxt};
use ty::TyVar;
use ty::relate::{Relate, RelateResult, TypeRelation};

/// Ensures `a` is made equal to `b`. Returns `a` on success.
pub struct Equate<'a, 'tcx: 'a> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ use rustc_front::print::pprust;
use middle::cstore::CrateStore;
use middle::def::Def;
use middle::def_id::DefId;
use middle::infer::{self, TypeOrigin};
use infer::{self, TypeOrigin};
use middle::region;
use middle::subst;
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use middle::ty::{Region, ReFree};
use middle::ty::error::TypeError;
use ty::subst;
use ty::{self, Ty, TyCtxt, TypeFoldable};
use ty::{Region, ReFree};
use ty::error::TypeError;

use std::cell::{Cell, RefCell};
use std::char::from_u32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
//! variable only once, and it does so as soon as it can, so it is reasonable to ask what the type
//! inferencer knows "so far".

use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use middle::ty::fold::TypeFolder;
use ty::{self, Ty, TyCtxt, TypeFoldable};
use ty::fold::TypeFolder;
use std::collections::hash_map::{self, Entry};

use super::InferCtxt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use super::InferCtxt;
use super::lattice::{self, LatticeDir};
use super::Subtype;

use middle::ty::{self, Ty, TyCtxt};
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
use ty::{self, Ty, TyCtxt};
use ty::relate::{Relate, RelateResult, TypeRelation};

/// "Greatest lower bound" (common subtype)
pub struct Glb<'a, 'tcx: 'a> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use super::{CombinedSnapshot, InferCtxt, HigherRankedType, SkolemizationMap};
use super::combine::CombineFields;

use middle::ty::{self, TyCtxt, Binder, TypeFoldable};
use middle::ty::error::TypeError;
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
use ty::{self, TyCtxt, Binder, TypeFoldable};
use ty::error::TypeError;
use ty::relate::{Relate, RelateResult, TypeRelation};
use syntax::codemap::Span;
use util::nodemap::{FnvHashMap, FnvHashSet};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
use super::combine;
use super::InferCtxt;

use middle::ty::TyVar;
use middle::ty::{self, Ty};
use middle::ty::relate::{RelateResult, TypeRelation};
use ty::TyVar;
use ty::{self, Ty};
use ty::relate::{RelateResult, TypeRelation};

pub trait LatticeDir<'f,'tcx> : TypeRelation<'f,'tcx> {
fn infcx(&self) -> &'f InferCtxt<'f, 'tcx>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use super::InferCtxt;
use super::lattice::{self, LatticeDir};
use super::Subtype;

use middle::ty::{self, Ty, TyCtxt};
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
use ty::{self, Ty, TyCtxt};
use ty::relate::{Relate, RelateResult, TypeRelation};

/// "Least upper bound" (common supertype)
pub struct Lub<'a, 'tcx: 'a> {
Expand Down
26 changes: 13 additions & 13 deletions src/librustc/middle/infer/mod.rs → src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub use self::LateBoundRegionConversionTime::*;
pub use self::RegionVariableOrigin::*;
pub use self::SubregionOrigin::*;
pub use self::ValuePairs::*;
pub use middle::ty::IntVarValue;
pub use ty::IntVarValue;
pub use self::freshen::TypeFreshener;
pub use self::region_inference::{GenericKind, VerifyBound};

Expand All @@ -24,16 +24,16 @@ use middle::free_region::FreeRegionMap;
use middle::mem_categorization as mc;
use middle::mem_categorization::McResult;
use middle::region::CodeExtent;
use middle::subst;
use middle::subst::Substs;
use middle::subst::Subst;
use middle::traits::{self, ProjectionMode};
use middle::ty::adjustment;
use middle::ty::{TyVid, IntVid, FloatVid};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
use middle::ty::fold::{TypeFolder, TypeFoldable};
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
use ty::subst;
use ty::subst::Substs;
use ty::subst::Subst;
use traits::{self, ProjectionMode};
use ty::adjustment;
use ty::{TyVid, IntVid, FloatVid};
use ty::{self, Ty, TyCtxt};
use ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
use ty::fold::{TypeFolder, TypeFoldable};
use ty::relate::{Relate, RelateResult, TypeRelation};
use rustc_data_structures::unify::{self, UnificationTable};
use std::cell::{RefCell, Ref};
use std::fmt;
Expand Down Expand Up @@ -622,8 +622,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}

pub fn type_is_unconstrained_numeric(&'a self, ty: Ty) -> UnconstrainedNumeric {
use middle::ty::error::UnconstrainedNumeric::Neither;
use middle::ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
use ty::error::UnconstrainedNumeric::Neither;
use ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
match ty.sty {
ty::TyInfer(ty::IntVar(vid)) => {
if self.int_unification_table.borrow_mut().has_value(vid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
/// For clarity, rename the graphviz crate locally to dot.
use graphviz as dot;

use middle::ty::{self, TyCtxt};
use ty::{self, TyCtxt};
use middle::region::CodeExtent;
use super::Constraint;
use middle::infer::SubregionOrigin;
use middle::infer::region_inference::RegionVarBindings;
use infer::SubregionOrigin;
use infer::region_inference::RegionVarBindings;
use util::nodemap::{FnvHashMap, FnvHashSet};

use std::borrow::Cow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ use super::unify_key;
use rustc_data_structures::graph::{self, Direction, NodeIndex};
use rustc_data_structures::unify::{self, UnificationTable};
use middle::free_region::FreeRegionMap;
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::{BoundRegion, Region, RegionVid};
use middle::ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
use ty::{self, Ty, TyCtxt};
use ty::{BoundRegion, Region, RegionVid};
use ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
use ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
use util::common::indenter;
use util::nodemap::{FnvHashMap, FnvHashSet};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

use super::{InferCtxt, FixupError, FixupResult};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use ty::{self, Ty, TyCtxt, TypeFoldable};

///////////////////////////////////////////////////////////////////////////
// OPPORTUNISTIC TYPE RESOLVER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use super::higher_ranked::HigherRankedRelations;
use super::SubregionOrigin;
use super::type_variable::{SubtypeOf, SupertypeOf};

use middle::ty::{self, Ty, TyCtxt};
use middle::ty::TyVar;
use middle::ty::relate::{Cause, Relate, RelateResult, TypeRelation};
use ty::{self, Ty, TyCtxt};
use ty::TyVar;
use ty::relate::{Cause, Relate, RelateResult, TypeRelation};
use std::mem;

/// Ensures `a` is made a subtype of `b`. Returns `a` on success.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use self::RelationDir::*;
use self::TypeVariableValue::*;
use self::UndoEntry::*;
use middle::def_id::{DefId};
use middle::ty::{self, Ty};
use ty::{self, Ty};
use syntax::codemap::Span;

use std::cmp::min;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

use syntax::ast;
use middle::ty::{self, IntVarValue, Ty, TyCtxt};
use ty::{self, IntVarValue, Ty, TyCtxt};
use rustc_data_structures::unify::{Combine, UnifyKey};

pub trait ToType<'tcx> {
Expand Down
13 changes: 6 additions & 7 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,20 @@ pub mod back {
pub use rustc_back::svh;
}

pub mod cfg;
pub mod dep_graph;

pub mod front {
pub mod check_attr;
pub mod map;
}

pub mod infer;
pub mod lint;

pub mod middle {
pub mod astconv_util;
pub mod expr_use_visitor; // STAGE0: increase glitch immunity
pub mod cfg;
pub mod check_match;
pub mod const_eval;
pub mod const_qualif;
Expand All @@ -102,7 +105,6 @@ pub mod middle {
pub mod entry;
pub mod free_region;
pub mod intrinsicck;
pub mod infer;
pub mod lang_items;
pub mod liveness;
pub mod mem_categorization;
Expand All @@ -113,9 +115,6 @@ pub mod middle {
pub mod recursion_limit;
pub mod resolve_lifetime;
pub mod stability;
pub mod subst;
pub mod traits;
pub mod ty;
pub mod weak_lang_items;
}

Expand All @@ -128,8 +127,8 @@ pub mod mir {
}

pub mod session;

pub mod lint;
pub mod traits;
pub mod ty;

pub mod util {
pub use rustc_back::sha2;
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 @@ -27,7 +27,7 @@ use self::TargetLint::*;

use dep_graph::DepNode;
use middle::privacy::AccessLevels;
use middle::ty::TyCtxt;
use ty::TyCtxt;
use session::{config, early_error, Session};
use lint::{Level, LevelSource, Lint, LintId, LintArray, LintPass};
use lint::{EarlyLintPass, EarlyLintPassObject, LateLintPass, LateLintPassObject};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/astconv_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

use middle::def::Def;
use middle::ty::{Ty, TyCtxt};
use ty::{Ty, TyCtxt};

use syntax::codemap::Span;
use rustc_front::hir as ast;
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ use middle::def_id::{DefId};
use middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor};
use middle::expr_use_visitor::{LoanCause, MutateMode};
use middle::expr_use_visitor as euv;
use middle::infer;
use infer;
use middle::mem_categorization::{cmt};
use middle::pat_util::*;
use middle::traits::ProjectionMode;
use middle::ty::*;
use middle::ty;
use traits::ProjectionMode;
use ty::*;
use ty;
use std::cmp::Ordering;
use std::fmt;
use std::iter::{FromIterator, IntoIterator, repeat};
Expand Down
Loading