Skip to content

Commit caa10c3

Browse files
Ariel Ben-Yehudaarielb1
Ariel Ben-Yehuda
authored andcommitted
move middle::ty and related modules to middle/ty/
1 parent 009f2cf commit caa10c3

Some content is hidden

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

52 files changed

+140
-154
lines changed

src/librustc/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ pub mod front {
107107
pub mod middle {
108108
pub mod astconv_util;
109109
pub mod astencode;
110-
pub mod cast;
111110
pub mod cfg;
112111
pub mod check_const;
113112
pub mod check_static_recursion;
@@ -124,15 +123,13 @@ pub mod middle {
124123
pub mod effect;
125124
pub mod entry;
126125
pub mod expr_use_visitor;
127-
pub mod fast_reject;
128126
pub mod free_region;
129127
pub mod intrinsicck;
130128
pub mod infer;
131129
pub mod implicator;
132130
pub mod lang_items;
133131
pub mod liveness;
134132
pub mod mem_categorization;
135-
pub mod outlives;
136133
pub mod pat_util;
137134
pub mod privacy;
138135
pub mod reachable;
@@ -143,11 +140,6 @@ pub mod middle {
143140
pub mod subst;
144141
pub mod traits;
145142
pub mod ty;
146-
pub mod ty_fold;
147-
pub mod ty_match;
148-
pub mod ty_relate;
149-
pub mod ty_walk;
150-
pub mod wf;
151143
pub mod weak_lang_items;
152144
}
153145

src/librustc/middle/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use metadata::tydecode;
2727
use metadata::tydecode::{DefIdSource, NominalType, TypeWithId};
2828
use metadata::tydecode::{RegionParameter, ClosureSource};
2929
use metadata::tyencode;
30-
use middle::cast;
30+
use middle::ty::cast;
3131
use middle::check_const::ConstQualif;
3232
use middle::def;
3333
use middle::def_id::{DefId, LOCAL_CRATE};

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// - It's not possible to take the address of a static item with unsafe interior. This is enforced
2525
// by borrowck::gather_loans
2626

27-
use middle::cast::{CastKind};
27+
use middle::ty::cast::{CastKind};
2828
use middle::const_eval;
2929
use middle::const_eval::EvalHint::ExprTypeChecked;
3030
use middle::def;

src/librustc/middle/free_region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! region outlives another and so forth.
1717
1818
use middle::ty::{self, FreeRegion, Region};
19-
use middle::wf::ImpliedBound;
19+
use middle::ty::wf::ImpliedBound;
2020
use rustc_data_structures::transitive_relation::TransitiveRelation;
2121

2222
#[derive(Clone)]

src/librustc/middle/implicator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use middle::infer::{InferCtxt, GenericKind};
1515
use middle::subst::Substs;
1616
use middle::traits;
1717
use middle::ty::{self, RegionEscape, ToPredicate, Ty};
18-
use middle::ty_fold::{TypeFoldable, TypeFolder};
18+
use middle::ty::fold::{TypeFoldable, TypeFolder};
1919

2020
use syntax::ast;
2121
use syntax::codemap::Span;

src/librustc/middle/infer/bivariate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use super::type_variable::{BiTo};
3030

3131
use middle::ty::{self, Ty};
3232
use middle::ty::TyVar;
33-
use middle::ty_relate::{Relate, RelateResult, TypeRelation};
33+
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
3434

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

src/librustc/middle/infer/combine.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ use super::type_variable::{RelationDir, BiTo, EqTo, SubtypeOf, SupertypeOf};
4444
use middle::ty::{TyVar};
4545
use middle::ty::{IntType, UintType};
4646
use middle::ty::{self, Ty, TypeError};
47-
use middle::ty_fold;
48-
use middle::ty_fold::{TypeFolder, TypeFoldable};
49-
use middle::ty_relate::{self, Relate, RelateResult, TypeRelation};
47+
use middle::ty::fold::{TypeFolder, TypeFoldable};
48+
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
5049

5150
use syntax::codemap::Span;
5251
use rustc_front::hir;
@@ -56,7 +55,7 @@ pub struct CombineFields<'a, 'tcx: 'a> {
5655
pub infcx: &'a InferCtxt<'a, 'tcx>,
5756
pub a_is_expected: bool,
5857
pub trace: TypeTrace<'tcx>,
59-
pub cause: Option<ty_relate::Cause>,
58+
pub cause: Option<ty::relate::Cause>,
6059
}
6160

6261
pub fn super_combine_tys<'a,'tcx:'a,R>(infcx: &InferCtxt<'a, 'tcx>,
@@ -108,12 +107,12 @@ pub fn super_combine_tys<'a,'tcx:'a,R>(infcx: &InferCtxt<'a, 'tcx>,
108107
// All other cases of inference are errors
109108
(&ty::TyInfer(_), _) |
110109
(_, &ty::TyInfer(_)) => {
111-
Err(TypeError::Sorts(ty_relate::expected_found(relation, &a, &b)))
110+
Err(TypeError::Sorts(ty::relate::expected_found(relation, &a, &b)))
112111
}
113112

114113

115114
_ => {
116-
ty_relate::super_relate_tys(relation, a, b)
115+
ty::relate::super_relate_tys(relation, a, b)
117116
}
118117
}
119118
}
@@ -293,7 +292,7 @@ struct Generalizer<'cx, 'tcx:'cx> {
293292
cycle_detected: bool,
294293
}
295294

296-
impl<'cx, 'tcx> ty_fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> {
295+
impl<'cx, 'tcx> ty::fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> {
297296
fn tcx(&self) -> &ty::ctxt<'tcx> {
298297
self.infcx.tcx
299298
}
@@ -319,7 +318,7 @@ impl<'cx, 'tcx> ty_fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> {
319318
}
320319
}
321320
_ => {
322-
ty_fold::super_fold_ty(self, t)
321+
ty::fold::super_fold_ty(self, t)
323322
}
324323
}
325324
}
@@ -384,13 +383,13 @@ fn int_unification_error<'tcx>(a_is_expected: bool, v: (ty::IntVarValue, ty::Int
384383
-> ty::TypeError<'tcx>
385384
{
386385
let (a, b) = v;
387-
TypeError::IntMismatch(ty_relate::expected_found_bool(a_is_expected, &a, &b))
386+
TypeError::IntMismatch(ty::relate::expected_found_bool(a_is_expected, &a, &b))
388387
}
389388

390389
fn float_unification_error<'tcx>(a_is_expected: bool,
391390
v: (hir::FloatTy, hir::FloatTy))
392391
-> ty::TypeError<'tcx>
393392
{
394393
let (a, b) = v;
395-
TypeError::FloatMismatch(ty_relate::expected_found_bool(a_is_expected, &a, &b))
394+
TypeError::FloatMismatch(ty::relate::expected_found_bool(a_is_expected, &a, &b))
396395
}

src/librustc/middle/infer/equate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use super::type_variable::{EqTo};
1515

1616
use middle::ty::{self, Ty};
1717
use middle::ty::TyVar;
18-
use middle::ty_relate::{Relate, RelateResult, TypeRelation};
18+
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
1919

2020
pub struct Equate<'a, 'tcx: 'a> {
2121
fields: CombineFields<'a, 'tcx>

src/librustc/middle/infer/freshen.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131
//! inferencer knows "so far".
3232
3333
use middle::ty::{self, Ty, HasTypeFlags};
34-
use middle::ty_fold;
35-
use middle::ty_fold::TypeFoldable;
36-
use middle::ty_fold::TypeFolder;
34+
use middle::ty::fold::TypeFoldable;
35+
use middle::ty::fold::TypeFolder;
3736
use std::collections::hash_map::{self, Entry};
3837

3938
use super::InferCtxt;
@@ -170,7 +169,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
170169
ty::TyTuple(..) |
171170
ty::TyProjection(..) |
172171
ty::TyParam(..) => {
173-
ty_fold::super_fold_ty(self, t)
172+
ty::fold::super_fold_ty(self, t)
174173
}
175174
}
176175
}

src/librustc/middle/infer/glb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use super::lattice::{self, LatticeDir};
1515
use super::Subtype;
1616

1717
use middle::ty::{self, Ty};
18-
use middle::ty_relate::{Relate, RelateResult, TypeRelation};
18+
use middle::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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use super::{CombinedSnapshot, InferCtxt, HigherRankedType, SkolemizationMap};
1515
use super::combine::CombineFields;
1616

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

@@ -358,7 +358,7 @@ fn fold_regions_in<'tcx, T, F>(tcx: &ty::ctxt<'tcx>,
358358
where T: TypeFoldable<'tcx>,
359359
F: FnMut(ty::Region, ty::DebruijnIndex) -> ty::Region,
360360
{
361-
ty_fold::fold_regions(tcx, unbound_value, &mut false, |region, current_depth| {
361+
ty::fold::fold_regions(tcx, unbound_value, &mut false, |region, current_depth| {
362362
// we should only be encountering "escaping" late-bound regions here,
363363
// because the ones at the current level should have been replaced
364364
// with fresh variables
@@ -438,7 +438,7 @@ impl<'a,'tcx> InferCtxtExt for InferCtxt<'a,'tcx> {
438438

439439
let mut escaping_region_vars = FnvHashSet();
440440
for ty in &escaping_types {
441-
ty_fold::collect_regions(self.tcx, ty, &mut escaping_region_vars);
441+
ty::fold::collect_regions(self.tcx, ty, &mut escaping_region_vars);
442442
}
443443

444444
region_vars.retain(|&region_vid| {
@@ -468,7 +468,7 @@ pub fn skolemize_late_bound_regions<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
468468
* details.
469469
*/
470470

471-
let (result, map) = ty_fold::replace_late_bound_regions(infcx.tcx, binder, |br| {
471+
let (result, map) = ty::fold::replace_late_bound_regions(infcx.tcx, binder, |br| {
472472
infcx.region_vars.new_skolemized(br, &snapshot.region_vars_snapshot)
473473
});
474474

@@ -590,7 +590,7 @@ pub fn plug_leaks<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
590590
// binder is that we encountered in `value`. The caller is
591591
// responsible for ensuring that (a) `value` contains at least one
592592
// binder and (b) that binder is the one we want to use.
593-
let result = ty_fold::fold_regions(infcx.tcx, &value, &mut false, |r, current_depth| {
593+
let result = ty::fold::fold_regions(infcx.tcx, &value, &mut false, |r, current_depth| {
594594
match inv_skol_map.get(&r) {
595595
None => r,
596596
Some(br) => {

src/librustc/middle/infer/lattice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use super::InferCtxt;
3434

3535
use middle::ty::TyVar;
3636
use middle::ty::{self, Ty};
37-
use middle::ty_relate::{RelateResult, TypeRelation};
37+
use middle::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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use super::lattice::{self, LatticeDir};
1515
use super::Subtype;
1616

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

2020
/// "Least upper bound" (common supertype)
2121
pub struct Lub<'a, 'tcx: 'a> {
@@ -83,4 +83,3 @@ impl<'a, 'tcx> LatticeDir<'a,'tcx> for Lub<'a, 'tcx> {
8383
Ok(())
8484
}
8585
}
86-

src/librustc/middle/infer/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ use middle::traits::{self, FulfillmentContext, Normalized,
3232
SelectionContext, ObligationCause};
3333
use middle::ty::{TyVid, IntVid, FloatVid, RegionVid, UnconstrainedNumeric};
3434
use middle::ty::{self, Ty, TypeError, HasTypeFlags};
35-
use middle::ty_fold::{self, TypeFolder, TypeFoldable};
36-
use middle::ty_relate::{Relate, RelateResult, TypeRelation};
35+
use middle::ty::fold::{TypeFolder, TypeFoldable};
36+
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
3737
use rustc_data_structures::unify::{self, UnificationTable};
3838
use std::cell::{RefCell, Ref};
3939
use std::fmt;
@@ -583,7 +583,7 @@ pub fn drain_fulfillment_cx<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
583583
/// Returns an equivalent value with all free regions removed (note
584584
/// that late-bound regions remain, because they are important for
585585
/// subtyping, but they are anonymized and normalized as well). This
586-
/// is a stronger, caching version of `ty_fold::erase_regions`.
586+
/// is a stronger, caching version of `ty::fold::erase_regions`.
587587
pub fn erase_regions<'tcx,T>(cx: &ty::ctxt<'tcx>, value: &T) -> T
588588
where T : TypeFoldable<'tcx>
589589
{
@@ -603,7 +603,7 @@ pub fn erase_regions<'tcx,T>(cx: &ty::ctxt<'tcx>, value: &T) -> T
603603
Some(u) => return u
604604
}
605605

606-
let t_norm = ty_fold::super_fold_ty(self, ty);
606+
let t_norm = ty::fold::super_fold_ty(self, ty);
607607
self.tcx().normalized_cache.borrow_mut().insert(ty, t_norm);
608608
return t_norm;
609609
}
@@ -612,7 +612,7 @@ pub fn erase_regions<'tcx,T>(cx: &ty::ctxt<'tcx>, value: &T) -> T
612612
where T : TypeFoldable<'tcx>
613613
{
614614
let u = self.tcx().anonymize_late_bound_regions(t);
615-
ty_fold::super_fold_binder(self, &u)
615+
ty::fold::super_fold_binder(self, &u)
616616
}
617617

618618
fn fold_region(&mut self, r: ty::Region) -> ty::Region {
@@ -1406,7 +1406,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14061406
-> (T, FnvHashMap<ty::BoundRegion,ty::Region>)
14071407
where T : TypeFoldable<'tcx>
14081408
{
1409-
ty_fold::replace_late_bound_regions(
1409+
ty::fold::replace_late_bound_regions(
14101410
self.tcx,
14111411
value,
14121412
|br| self.next_region_var(LateBoundRegion(span, br, lbrct)))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use middle::ty::{self, Ty, TypeError};
2727
use middle::ty::{BoundRegion, FreeRegion, Region, RegionVid};
2828
use middle::ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
2929
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
30-
use middle::ty_relate::RelateResult;
30+
use middle::ty::relate::RelateResult;
3131
use util::common::indenter;
3232
use util::nodemap::{FnvHashMap, FnvHashSet};
3333

src/librustc/middle/infer/resolve.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use super::{InferCtxt, FixupError, FixupResult};
1212
use middle::ty::{self, Ty, HasTypeFlags};
13-
use middle::ty_fold::{self, TypeFoldable};
13+
use middle::ty::fold::{TypeFoldable};
1414

1515
///////////////////////////////////////////////////////////////////////////
1616
// OPPORTUNISTIC TYPE RESOLVER
@@ -30,7 +30,7 @@ impl<'a, 'tcx> OpportunisticTypeResolver<'a, 'tcx> {
3030
}
3131
}
3232

33-
impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for OpportunisticTypeResolver<'a, 'tcx> {
33+
impl<'a, 'tcx> ty::fold::TypeFolder<'tcx> for OpportunisticTypeResolver<'a, 'tcx> {
3434
fn tcx(&self) -> &ty::ctxt<'tcx> {
3535
self.infcx.tcx
3636
}
@@ -40,7 +40,7 @@ impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for OpportunisticTypeResolver<'a, 'tcx>
4040
t // micro-optimize -- if there is nothing in this type that this fold affects...
4141
} else {
4242
let t0 = self.infcx.shallow_resolve(t);
43-
ty_fold::super_fold_ty(self, t0)
43+
ty::fold::super_fold_ty(self, t0)
4444
}
4545
}
4646
}
@@ -69,7 +69,7 @@ struct FullTypeResolver<'a, 'tcx:'a> {
6969
err: Option<FixupError>,
7070
}
7171

72-
impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
72+
impl<'a, 'tcx> ty::fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
7373
fn tcx(&self) -> &ty::ctxt<'tcx> {
7474
self.infcx.tcx
7575
}
@@ -98,7 +98,7 @@ impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
9898
t));
9999
}
100100
_ => {
101-
ty_fold::super_fold_ty(self, t)
101+
ty::fold::super_fold_ty(self, t)
102102
}
103103
}
104104
}

src/librustc/middle/infer/sub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use super::type_variable::{SubtypeOf, SupertypeOf};
1515

1616
use middle::ty::{self, Ty};
1717
use middle::ty::TyVar;
18-
use middle::ty_relate::{Cause, Relate, RelateResult, TypeRelation};
18+
use middle::ty::relate::{Cause, Relate, RelateResult, TypeRelation};
1919
use std::mem;
2020

2121
/// "Greatest lower bound" (common subtype)

0 commit comments

Comments
 (0)