Skip to content

Commit d5a91e6

Browse files
committed
Auto merge of #32432 - eddyb:dock-service, r=nikomatsakis
Flatten rustc and rustc_trans module hierarchy slightly. The following moves were made, in the name of sanity/simplicity: * `rustc::middle::{cfg, infer, traits, ty}` to `rustc::{cfg, infer, traits, ty}` * `rustc::middle::subst` to `rustc::ty::subst` * `rustc_trans::trans::*` to `rustc_trans::*` * `rustc_trans::save` to `rustc_save_analysis` (cc @nrc) I've rebased a larger WIP branch on top of this and the only conflicts were in imports, but YMMV.
2 parents 97ec69f + 035a645 commit d5a91e6

File tree

255 files changed

+1204
-1192
lines changed

Some content is hidden

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

255 files changed

+1204
-1192
lines changed

mk/crates.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ TARGET_CRATES := libc std term \
5757
RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \
5858
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
5959
rustc_data_structures rustc_front rustc_platform_intrinsics \
60-
rustc_plugin rustc_metadata rustc_passes
60+
rustc_plugin rustc_metadata rustc_passes rustc_save_analysis
6161
HOST_CRATES := syntax syntax_ext $(RUSTC_CRATES) rustdoc fmt_macros \
6262
flate arena graphviz rbml log serialize
6363
TOOLS := compiletest rustdoc rustc rustbook error_index_generator
@@ -102,7 +102,7 @@ DEPS_rustc_data_structures := std log serialize
102102
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
103103
rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \
104104
rustc_trans rustc_privacy rustc_lint rustc_front rustc_plugin \
105-
rustc_metadata syntax_ext rustc_passes
105+
rustc_metadata syntax_ext rustc_passes rustc_save_analysis
106106
DEPS_rustc_front := std syntax log serialize
107107
DEPS_rustc_lint := rustc log syntax
108108
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
@@ -116,6 +116,7 @@ DEPS_rustc_privacy := rustc rustc_front log syntax
116116
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back rustc_mir \
117117
log syntax serialize rustc_llvm rustc_front rustc_platform_intrinsics \
118118
rustc_const_eval
119+
DEPS_rustc_save_analysis := rustc log syntax rustc_front
119120
DEPS_rustc_typeck := rustc syntax rustc_front rustc_platform_intrinsics rustc_const_eval
120121

121122
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \

src/librustc/middle/cfg/construct.rs renamed to src/librustc/cfg/construct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// except according to those terms.
1010

1111
use rustc_data_structures::graph;
12-
use middle::cfg::*;
12+
use cfg::*;
1313
use middle::def::Def;
1414
use middle::pat_util;
15-
use middle::ty::{self, TyCtxt};
15+
use ty::{self, TyCtxt};
1616
use syntax::ast;
1717
use syntax::ptr::P;
1818

src/librustc/middle/cfg/graphviz.rs renamed to src/librustc/cfg/graphviz.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use graphviz::IntoCow;
1818
use syntax::ast;
1919

2020
use front::map as ast_map;
21-
use middle::cfg;
21+
use cfg;
2222

2323
pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
2424
pub type Edge<'a> = &'a cfg::CFGEdge;

src/librustc/middle/cfg/mod.rs renamed to src/librustc/cfg/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! Uses `Graph` as the underlying representation.
1313
1414
use rustc_data_structures::graph;
15-
use middle::ty::TyCtxt;
15+
use ty::TyCtxt;
1616
use syntax::ast;
1717
use rustc_front::hir;
1818

src/librustc/dep_graph/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use self::thread::{DepGraphThreadData, DepMessage};
1212
use middle::def_id::DefId;
1313
use syntax::ast::NodeId;
14-
use middle::ty::TyCtxt;
14+
use ty::TyCtxt;
1515
use rustc_front::hir;
1616
use rustc_front::intravisit::Visitor;
1717
use std::rc::Rc;
File renamed without changes.

src/librustc/middle/infer/bivariate.rs renamed to src/librustc/infer/bivariate.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
use super::combine::{self, CombineFields};
2929
use super::type_variable::{BiTo};
3030

31-
use middle::ty::{self, Ty, TyCtxt};
32-
use middle::ty::TyVar;
33-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
31+
use ty::{self, Ty, TyCtxt};
32+
use ty::TyVar;
33+
use ty::relate::{Relate, RelateResult, TypeRelation};
3434

3535
pub struct Bivariate<'a, 'tcx: 'a> {
3636
fields: CombineFields<'a, 'tcx>

src/librustc/middle/infer/combine.rs renamed to src/librustc/infer/combine.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ use super::{InferCtxt};
4141
use super::{MiscVariable, TypeTrace};
4242
use super::type_variable::{RelationDir, BiTo, EqTo, SubtypeOf, SupertypeOf};
4343

44-
use middle::ty::{IntType, UintType};
45-
use middle::ty::{self, Ty, TyCtxt};
46-
use middle::ty::error::TypeError;
47-
use middle::ty::fold::{TypeFolder, TypeFoldable};
48-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
44+
use ty::{IntType, UintType};
45+
use ty::{self, Ty, TyCtxt};
46+
use ty::error::TypeError;
47+
use ty::fold::{TypeFolder, TypeFoldable};
48+
use ty::relate::{Relate, RelateResult, TypeRelation};
4949

5050
use syntax::ast;
5151
use syntax::codemap::Span;

src/librustc/middle/infer/equate.rs renamed to src/librustc/infer/equate.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use super::higher_ranked::HigherRankedRelations;
1313
use super::{Subtype};
1414
use super::type_variable::{EqTo};
1515

16-
use middle::ty::{self, Ty, TyCtxt};
17-
use middle::ty::TyVar;
18-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
16+
use ty::{self, Ty, TyCtxt};
17+
use ty::TyVar;
18+
use ty::relate::{Relate, RelateResult, TypeRelation};
1919

2020
/// Ensures `a` is made equal to `b`. Returns `a` on success.
2121
pub struct Equate<'a, 'tcx: 'a> {

src/librustc/middle/infer/error_reporting.rs renamed to src/librustc/infer/error_reporting.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ use rustc_front::print::pprust;
8080
use middle::cstore::CrateStore;
8181
use middle::def::Def;
8282
use middle::def_id::DefId;
83-
use middle::infer::{self, TypeOrigin};
83+
use infer::{self, TypeOrigin};
8484
use middle::region;
85-
use middle::subst;
86-
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
87-
use middle::ty::{Region, ReFree};
88-
use middle::ty::error::TypeError;
85+
use ty::subst;
86+
use ty::{self, Ty, TyCtxt, TypeFoldable};
87+
use ty::{Region, ReFree};
88+
use ty::error::TypeError;
8989

9090
use std::cell::{Cell, RefCell};
9191
use std::char::from_u32;

src/librustc/middle/infer/freshen.rs renamed to src/librustc/infer/freshen.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
//! variable only once, and it does so as soon as it can, so it is reasonable to ask what the type
3131
//! inferencer knows "so far".
3232
33-
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
34-
use middle::ty::fold::TypeFolder;
33+
use ty::{self, Ty, TyCtxt, TypeFoldable};
34+
use ty::fold::TypeFolder;
3535
use std::collections::hash_map::{self, Entry};
3636

3737
use super::InferCtxt;

src/librustc/middle/infer/glb.rs renamed to src/librustc/infer/glb.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use super::InferCtxt;
1414
use super::lattice::{self, LatticeDir};
1515
use super::Subtype;
1616

17-
use middle::ty::{self, Ty, TyCtxt};
18-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
17+
use ty::{self, Ty, TyCtxt};
18+
use ty::relate::{Relate, RelateResult, TypeRelation};
1919

2020
/// "Greatest lower bound" (common subtype)
2121
pub struct Glb<'a, 'tcx: 'a> {

src/librustc/middle/infer/higher_ranked/mod.rs renamed to src/librustc/infer/higher_ranked/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
use super::{CombinedSnapshot, InferCtxt, HigherRankedType, SkolemizationMap};
1515
use super::combine::CombineFields;
1616

17-
use middle::ty::{self, TyCtxt, Binder, TypeFoldable};
18-
use middle::ty::error::TypeError;
19-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
17+
use ty::{self, TyCtxt, Binder, TypeFoldable};
18+
use ty::error::TypeError;
19+
use ty::relate::{Relate, RelateResult, TypeRelation};
2020
use syntax::codemap::Span;
2121
use util::nodemap::{FnvHashMap, FnvHashSet};
2222

src/librustc/middle/infer/lattice.rs renamed to src/librustc/infer/lattice.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
use super::combine;
3333
use super::InferCtxt;
3434

35-
use middle::ty::TyVar;
36-
use middle::ty::{self, Ty};
37-
use middle::ty::relate::{RelateResult, TypeRelation};
35+
use ty::TyVar;
36+
use ty::{self, Ty};
37+
use ty::relate::{RelateResult, TypeRelation};
3838

3939
pub trait LatticeDir<'f,'tcx> : TypeRelation<'f,'tcx> {
4040
fn infcx(&self) -> &'f InferCtxt<'f, 'tcx>;

src/librustc/middle/infer/lub.rs renamed to src/librustc/infer/lub.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use super::InferCtxt;
1414
use super::lattice::{self, LatticeDir};
1515
use super::Subtype;
1616

17-
use middle::ty::{self, Ty, TyCtxt};
18-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
17+
use ty::{self, Ty, TyCtxt};
18+
use ty::relate::{Relate, RelateResult, TypeRelation};
1919

2020
/// "Least upper bound" (common supertype)
2121
pub struct Lub<'a, 'tcx: 'a> {

src/librustc/middle/infer/mod.rs renamed to src/librustc/infer/mod.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub use self::LateBoundRegionConversionTime::*;
1414
pub use self::RegionVariableOrigin::*;
1515
pub use self::SubregionOrigin::*;
1616
pub use self::ValuePairs::*;
17-
pub use middle::ty::IntVarValue;
17+
pub use ty::IntVarValue;
1818
pub use self::freshen::TypeFreshener;
1919
pub use self::region_inference::{GenericKind, VerifyBound};
2020

@@ -24,16 +24,16 @@ use middle::free_region::FreeRegionMap;
2424
use middle::mem_categorization as mc;
2525
use middle::mem_categorization::McResult;
2626
use middle::region::CodeExtent;
27-
use middle::subst;
28-
use middle::subst::Substs;
29-
use middle::subst::Subst;
30-
use middle::traits::{self, ProjectionMode};
31-
use middle::ty::adjustment;
32-
use middle::ty::{TyVid, IntVid, FloatVid};
33-
use middle::ty::{self, Ty, TyCtxt};
34-
use middle::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
35-
use middle::ty::fold::{TypeFolder, TypeFoldable};
36-
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
27+
use ty::subst;
28+
use ty::subst::Substs;
29+
use ty::subst::Subst;
30+
use traits::{self, ProjectionMode};
31+
use ty::adjustment;
32+
use ty::{TyVid, IntVid, FloatVid};
33+
use ty::{self, Ty, TyCtxt};
34+
use ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
35+
use ty::fold::{TypeFolder, TypeFoldable};
36+
use ty::relate::{Relate, RelateResult, TypeRelation};
3737
use rustc_data_structures::unify::{self, UnificationTable};
3838
use std::cell::{RefCell, Ref};
3939
use std::fmt;
@@ -622,8 +622,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
622622
}
623623

624624
pub fn type_is_unconstrained_numeric(&'a self, ty: Ty) -> UnconstrainedNumeric {
625-
use middle::ty::error::UnconstrainedNumeric::Neither;
626-
use middle::ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
625+
use ty::error::UnconstrainedNumeric::Neither;
626+
use ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
627627
match ty.sty {
628628
ty::TyInfer(ty::IntVar(vid)) => {
629629
if self.int_unification_table.borrow_mut().has_value(vid) {

src/librustc/middle/infer/region_inference/graphviz.rs renamed to src/librustc/infer/region_inference/graphviz.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
/// For clarity, rename the graphviz crate locally to dot.
1919
use graphviz as dot;
2020

21-
use middle::ty::{self, TyCtxt};
21+
use ty::{self, TyCtxt};
2222
use middle::region::CodeExtent;
2323
use super::Constraint;
24-
use middle::infer::SubregionOrigin;
25-
use middle::infer::region_inference::RegionVarBindings;
24+
use infer::SubregionOrigin;
25+
use infer::region_inference::RegionVarBindings;
2626
use util::nodemap::{FnvHashMap, FnvHashSet};
2727

2828
use std::borrow::Cow;

src/librustc/middle/infer/region_inference/mod.rs renamed to src/librustc/infer/region_inference/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ use super::unify_key;
2323
use rustc_data_structures::graph::{self, Direction, NodeIndex};
2424
use rustc_data_structures::unify::{self, UnificationTable};
2525
use middle::free_region::FreeRegionMap;
26-
use middle::ty::{self, Ty, TyCtxt};
27-
use middle::ty::{BoundRegion, Region, RegionVid};
28-
use middle::ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
29-
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
26+
use ty::{self, Ty, TyCtxt};
27+
use ty::{BoundRegion, Region, RegionVid};
28+
use ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
29+
use ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
3030
use util::common::indenter;
3131
use util::nodemap::{FnvHashMap, FnvHashSet};
3232

src/librustc/middle/infer/resolve.rs renamed to src/librustc/infer/resolve.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use super::{InferCtxt, FixupError, FixupResult};
12-
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
12+
use ty::{self, Ty, TyCtxt, TypeFoldable};
1313

1414
///////////////////////////////////////////////////////////////////////////
1515
// OPPORTUNISTIC TYPE RESOLVER

src/librustc/middle/infer/sub.rs renamed to src/librustc/infer/sub.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use super::higher_ranked::HigherRankedRelations;
1313
use super::SubregionOrigin;
1414
use super::type_variable::{SubtypeOf, SupertypeOf};
1515

16-
use middle::ty::{self, Ty, TyCtxt};
17-
use middle::ty::TyVar;
18-
use middle::ty::relate::{Cause, Relate, RelateResult, TypeRelation};
16+
use ty::{self, Ty, TyCtxt};
17+
use ty::TyVar;
18+
use ty::relate::{Cause, Relate, RelateResult, TypeRelation};
1919
use std::mem;
2020

2121
/// Ensures `a` is made a subtype of `b`. Returns `a` on success.

src/librustc/middle/infer/type_variable.rs renamed to src/librustc/infer/type_variable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub use self::RelationDir::*;
1212
use self::TypeVariableValue::*;
1313
use self::UndoEntry::*;
1414
use middle::def_id::{DefId};
15-
use middle::ty::{self, Ty};
15+
use ty::{self, Ty};
1616
use syntax::codemap::Span;
1717

1818
use std::cmp::min;

src/librustc/middle/infer/unify_key.rs renamed to src/librustc/infer/unify_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use syntax::ast;
12-
use middle::ty::{self, IntVarValue, Ty, TyCtxt};
12+
use ty::{self, IntVarValue, Ty, TyCtxt};
1313
use rustc_data_structures::unify::{Combine, UnifyKey};
1414

1515
pub trait ToType<'tcx> {

src/librustc/lib.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,20 @@ pub mod back {
7878
pub use rustc_back::svh;
7979
}
8080

81+
pub mod cfg;
8182
pub mod dep_graph;
8283

8384
pub mod front {
8485
pub mod check_attr;
8586
pub mod map;
8687
}
8788

89+
pub mod infer;
90+
pub mod lint;
91+
8892
pub mod middle {
8993
pub mod astconv_util;
9094
pub mod expr_use_visitor; // STAGE0: increase glitch immunity
91-
pub mod cfg;
9295
pub mod check_match;
9396
pub mod const_eval;
9497
pub mod const_qualif;
@@ -102,7 +105,6 @@ pub mod middle {
102105
pub mod entry;
103106
pub mod free_region;
104107
pub mod intrinsicck;
105-
pub mod infer;
106108
pub mod lang_items;
107109
pub mod liveness;
108110
pub mod mem_categorization;
@@ -113,9 +115,6 @@ pub mod middle {
113115
pub mod recursion_limit;
114116
pub mod resolve_lifetime;
115117
pub mod stability;
116-
pub mod subst;
117-
pub mod traits;
118-
pub mod ty;
119118
pub mod weak_lang_items;
120119
}
121120

@@ -128,8 +127,8 @@ pub mod mir {
128127
}
129128

130129
pub mod session;
131-
132-
pub mod lint;
130+
pub mod traits;
131+
pub mod ty;
133132

134133
pub mod util {
135134
pub use rustc_back::sha2;

src/librustc/lint/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use self::TargetLint::*;
2727

2828
use dep_graph::DepNode;
2929
use middle::privacy::AccessLevels;
30-
use middle::ty::TyCtxt;
30+
use ty::TyCtxt;
3131
use session::{config, early_error, Session};
3232
use lint::{Level, LevelSource, Lint, LintId, LintArray, LintPass};
3333
use lint::{EarlyLintPass, EarlyLintPassObject, LateLintPass, LateLintPassObject};

src/librustc/middle/astconv_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
use middle::def::Def;
18-
use middle::ty::{Ty, TyCtxt};
18+
use ty::{Ty, TyCtxt};
1919

2020
use syntax::codemap::Span;
2121
use rustc_front::hir as ast;

src/librustc/middle/check_match.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ use middle::def_id::{DefId};
2222
use middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor};
2323
use middle::expr_use_visitor::{LoanCause, MutateMode};
2424
use middle::expr_use_visitor as euv;
25-
use middle::infer;
25+
use infer;
2626
use middle::mem_categorization::{cmt};
2727
use middle::pat_util::*;
28-
use middle::traits::ProjectionMode;
29-
use middle::ty::*;
30-
use middle::ty;
28+
use traits::ProjectionMode;
29+
use ty::*;
30+
use ty;
3131
use std::cmp::Ordering;
3232
use std::fmt;
3333
use std::iter::{FromIterator, IntoIterator, repeat};

0 commit comments

Comments
 (0)