Skip to content

Commit 91db254

Browse files
committed
More rebase fixes.
1 parent 7c21a0f commit 91db254

File tree

19 files changed

+60
-52
lines changed

19 files changed

+60
-52
lines changed

src/librustc/metadata/tyencode.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
8383
ast::TyF64 => mywrite!(w, "MF"),
8484
}
8585
}
86-
ty::ty_enum(def, ref substs) => {
86+
ty::ty_enum(def, substs) => {
8787
mywrite!(w, "t[{}|", (cx.ds)(def));
8888
enc_substs(w, cx, substs);
8989
mywrite!(w, "]");
@@ -104,7 +104,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
104104
ty::ty_ptr(mt) => { mywrite!(w, "*"); enc_mt(w, cx, mt); }
105105
ty::ty_rptr(r, mt) => {
106106
mywrite!(w, "&");
107-
enc_region(w, cx, r);
107+
enc_region(w, cx, *r);
108108
enc_mt(w, cx, mt);
109109
}
110110
ty::ty_vec(t, sz) => {
@@ -123,12 +123,12 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
123123
mywrite!(w, "f");
124124
enc_closure_ty(w, cx, &**f);
125125
}
126-
ty::ty_bare_fn(Some(def_id), ref f) => {
126+
ty::ty_bare_fn(Some(def_id), f) => {
127127
mywrite!(w, "F");
128128
mywrite!(w, "{}|", (cx.ds)(def_id));
129129
enc_bare_fn_ty(w, cx, f);
130130
}
131-
ty::ty_bare_fn(None, ref f) => {
131+
ty::ty_bare_fn(None, f) => {
132132
mywrite!(w, "G");
133133
enc_bare_fn_ty(w, cx, f);
134134
}
@@ -138,14 +138,14 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
138138
ty::ty_param(ParamTy {space, idx: id, def_id: did}) => {
139139
mywrite!(w, "p{}|{}|{}|", (cx.ds)(did), id, space.to_uint())
140140
}
141-
ty::ty_struct(def, ref substs) => {
141+
ty::ty_struct(def, substs) => {
142142
mywrite!(w, "a[{}|", (cx.ds)(def));
143143
enc_substs(w, cx, substs);
144144
mywrite!(w, "]");
145145
}
146-
ty::ty_unboxed_closure(def, region, ref substs) => {
146+
ty::ty_unboxed_closure(def, region, substs) => {
147147
mywrite!(w, "k[{}|", (cx.ds)(def));
148-
enc_region(w, cx, region);
148+
enc_region(w, cx, *region);
149149
enc_substs(w, cx, substs);
150150
mywrite!(w, "]");
151151
}

src/librustc/middle/infer/coercion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
499499
fn coerce_from_fn_item(&self,
500500
a: Ty<'tcx>,
501501
fn_def_id_a: ast::DefId,
502-
fn_ty_a: &ty::BareFnTy<'tcx>,
502+
fn_ty_a: &'tcx ty::BareFnTy<'tcx>,
503503
b: Ty<'tcx>)
504504
-> CoerceResult<'tcx> {
505505
/*!
@@ -528,7 +528,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
528528
Ok(Some(adj))
529529
}
530530
ty::ty_bare_fn(None, _) => {
531-
let a_fn_pointer = ty::mk_bare_fn(self.tcx(), None, (*fn_ty_a).clone());
531+
let a_fn_pointer = ty::mk_bare_fn(self.tcx(), None, fn_ty_a);
532532
try!(self.subtype(a_fn_pointer, b));
533533
Ok(Some(ty::AdjustReifyFnPointer(fn_def_id_a)))
534534
}

src/librustc/middle/infer/combine.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ pub trait Combine<'tcx> {
343343
if a.def_id != b.def_id {
344344
Err(ty::terr_traits(expected_found(self, a.def_id, b.def_id)))
345345
} else {
346-
let substs = try!(self.substs(a.def_id, &a.substs, &b.substs));
347-
Ok(ty::TraitRef { def_id: a.def_id, substs: substs })
346+
let substs = try!(self.substs(a.def_id, a.substs, b.substs));
347+
Ok(ty::TraitRef { def_id: a.def_id, substs: self.tcx().mk_substs(substs) })
348348
}
349349
}
350350

@@ -572,7 +572,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
572572
if a_opt_def_id == b_opt_def_id =>
573573
{
574574
let fty = try!(this.bare_fn_tys(a_fty, b_fty));
575-
Ok(ty::mk_bare_fn(tcx, a_opt_def_id, fty))
575+
Ok(ty::mk_bare_fn(tcx, a_opt_def_id, tcx.mk_bare_fn(fty)))
576576
}
577577

578578
(&ty::ty_closure(ref a_fty), &ty::ty_closure(ref b_fty)) => {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub struct RegionVarBindings<'a, 'tcx: 'a> {
219219
#[allow(missing_copy_implementations)]
220220
pub struct RegionSnapshot {
221221
length: uint,
222-
skolemization_count: uint,
222+
skolemization_count: u32,
223223
}
224224

225225
impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {

src/librustc/middle/infer/type_variable.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use self::UndoEntry::*;
1515
use middle::ty::{mod, Ty};
1616
use std::cmp::min;
1717
use std::mem;
18-
use std::uint;
18+
use std::u32;
1919
use util::snapshot_vec as sv;
2020

2121
pub struct TypeVariableTable<'tcx> {
@@ -161,7 +161,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
161161
* unified `V1` with `T1`, this function would return `{T0}`.
162162
*/
163163

164-
let mut new_elem_threshold = uint::MAX;
164+
let mut new_elem_threshold = u32::MAX;
165165
let mut escaping_types = Vec::new();
166166
let actions_since_snapshot = self.values.actions_since_snapshot(&s.snapshot);
167167
debug!("actions_since_snapshot.len() = {}", actions_since_snapshot.len());
@@ -173,7 +173,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
173173
// always be the first one we see). Note that this
174174
// action must precede those variables being
175175
// specified.
176-
new_elem_threshold = min(new_elem_threshold, index);
176+
new_elem_threshold = min(new_elem_threshold, index as u32);
177177
debug!("NewElem({}) new_elem_threshold={}", index, new_elem_threshold);
178178
}
179179

src/librustc/middle/traits/select.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11001100
} else {
11011101
// Recursively check all supertraits to find out if any further
11021102
// bounds are required and thus we must fulfill.
1103-
let tmp_tr = data.principal_trait_ref_with_self_ty(ty::mk_err());
1103+
let tmp_tr = data.principal_trait_ref_with_self_ty(self.tcx(),
1104+
ty::mk_err());
11041105
for tr in util::supertraits(self.tcx(), tmp_tr) {
11051106
let td = ty::lookup_trait_def(self.tcx(), tr.def_id());
11061107

src/librustc/middle/ty.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -1383,12 +1383,13 @@ impl<'tcx> TyTrait<'tcx> {
13831383
/// we convert the principal trait-ref into a normal trait-ref,
13841384
/// you must give *some* self-type. A common choice is `mk_err()`
13851385
/// or some skolemized type.
1386-
pub fn principal_trait_ref_with_self_ty(&self, self_ty: Ty<'tcx>)
1386+
pub fn principal_trait_ref_with_self_ty(&self,
1387+
tcx: &ctxt<'tcx>, self_ty: Ty<'tcx>)
13871388
-> Rc<ty::PolyTraitRef<'tcx>>
13881389
{
13891390
Rc::new(ty::Binder(ty::TraitRef {
13901391
def_id: self.principal.def_id(),
1391-
substs: self.principal.substs().with_self_ty(self_ty),
1392+
substs: tcx.mk_substs(self.principal.substs().with_self_ty(self_ty)),
13921393
}))
13931394
}
13941395
}
@@ -1425,8 +1426,8 @@ impl<'tcx> PolyTraitRef<'tcx> {
14251426
self.0.def_id
14261427
}
14271428

1428-
pub fn substs(&self) -> &Substs<'tcx> {
1429-
&self.0.substs
1429+
pub fn substs(&self) -> &'tcx Substs<'tcx> {
1430+
self.0.substs
14301431
}
14311432

14321433
pub fn input_types(&self) -> &[Ty<'tcx>] {
@@ -4159,8 +4160,8 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
41594160

41604161
AdjustReifyFnPointer(_) => {
41614162
match unadjusted_ty.sty {
4162-
ty::ty_bare_fn(Some(_), ref b) => {
4163-
ty::mk_bare_fn(cx, None, (*b).clone())
4163+
ty::ty_bare_fn(Some(_), b) => {
4164+
ty::mk_bare_fn(cx, None, b)
41644165
}
41654166
ref b => {
41664167
cx.sess.bug(
@@ -6727,42 +6728,42 @@ pub trait RegionEscape {
67276728
self.has_regions_escaping_depth(0)
67286729
}
67296730

6730-
fn has_regions_escaping_depth(&self, depth: uint) -> bool;
6731+
fn has_regions_escaping_depth(&self, depth: u32) -> bool;
67316732
}
67326733

67336734
impl<'tcx> RegionEscape for Ty<'tcx> {
6734-
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
6735+
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
67356736
ty::type_escapes_depth(*self, depth)
67366737
}
67376738
}
67386739

67396740
impl RegionEscape for Region {
6740-
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
6741+
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
67416742
self.escapes_depth(depth)
67426743
}
67436744
}
67446745

67456746
impl<'tcx> RegionEscape for TraitRef<'tcx> {
6746-
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
6747+
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
67476748
self.substs.types.iter().any(|t| t.has_regions_escaping_depth(depth)) &&
67486749
self.substs.regions().iter().any(|t| t.has_regions_escaping_depth(depth))
67496750
}
67506751
}
67516752

67526753
impl<'tcx,T:RegionEscape> RegionEscape for Binder<T> {
6753-
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
6754+
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
67546755
self.0.has_regions_escaping_depth(depth + 1)
67556756
}
67566757
}
67576758

67586759
impl<'tcx> RegionEscape for EquatePredicate<'tcx> {
6759-
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
6760+
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
67606761
self.0.has_regions_escaping_depth(depth) || self.1.has_regions_escaping_depth(depth)
67616762
}
67626763
}
67636764

67646765
impl<T:RegionEscape,U:RegionEscape> RegionEscape for OutlivesPredicate<T,U> {
6765-
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
6766+
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
67666767
self.0.has_regions_escaping_depth(depth) || self.1.has_regions_escaping_depth(depth)
67676768
}
67686769
}

src/librustc/middle/ty_fold.rs

+13-6
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,8 @@ pub fn super_fold_ty<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
527527
ty::ty_open(typ.fold_with(this))
528528
}
529529
ty::ty_enum(tid, ref substs) => {
530-
ty::ty_enum(tid, substs.fold_with(this))
530+
let substs = substs.fold_with(this);
531+
ty::ty_enum(tid, this.tcx().mk_substs(substs))
531532
}
532533
ty::ty_trait(box ty::TyTrait { ref principal, bounds }) => {
533534
ty::ty_trait(box ty::TyTrait {
@@ -539,19 +540,24 @@ pub fn super_fold_ty<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
539540
ty::ty_tup(ts.fold_with(this))
540541
}
541542
ty::ty_bare_fn(opt_def_id, ref f) => {
542-
ty::ty_bare_fn(opt_def_id, f.fold_with(this))
543+
let bfn = f.fold_with(this);
544+
ty::ty_bare_fn(opt_def_id, this.tcx().mk_bare_fn(bfn))
543545
}
544546
ty::ty_closure(ref f) => {
545547
ty::ty_closure(box f.fold_with(this))
546548
}
547549
ty::ty_rptr(r, ref tm) => {
548-
ty::ty_rptr(r.fold_with(this), tm.fold_with(this))
550+
let r = r.fold_with(this);
551+
ty::ty_rptr(this.tcx().mk_region(r), tm.fold_with(this))
549552
}
550553
ty::ty_struct(did, ref substs) => {
551-
ty::ty_struct(did, substs.fold_with(this))
554+
let substs = substs.fold_with(this);
555+
ty::ty_struct(did, this.tcx().mk_substs(substs))
552556
}
553557
ty::ty_unboxed_closure(did, ref region, ref substs) => {
554-
ty::ty_unboxed_closure(did, region.fold_with(this), substs.fold_with(this))
558+
let r = region.fold_with(this);
559+
let s = substs.fold_with(this);
560+
ty::ty_unboxed_closure(did, this.tcx().mk_region(r), this.tcx().mk_substs(s))
555561
}
556562
ty::ty_bool | ty::ty_char | ty::ty_str |
557563
ty::ty_int(_) | ty::ty_uint(_) | ty::ty_float(_) |
@@ -624,6 +630,7 @@ pub fn super_fold_trait_ref<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
624630
t: &ty::TraitRef<'tcx>)
625631
-> ty::TraitRef<'tcx>
626632
{
633+
let substs = t.substs.fold_with(this);
627634
ty::TraitRef {
628635
def_id: t.def_id,
629636
substs: this.tcx().mk_substs(substs),
@@ -745,7 +752,7 @@ pub fn fold_regions<'tcx,T,F>(tcx: &ty::ctxt<'tcx>,
745752
value: &T,
746753
mut f: F)
747754
-> T
748-
where F : FnMut(ty::Region, uint) -> ty::Region,
755+
where F : FnMut(ty::Region, u32) -> ty::Region,
749756
T : TypeFoldable<'tcx>,
750757
{
751758
value.fold_with(&mut RegionFolder::new(tcx, &mut f))

src/librustc/util/ppaux.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1211,8 +1211,6 @@ impl<'tcx> UserString<'tcx> for ty::TraitRef<'tcx> {
12111211
let trait_def = ty::lookup_trait_def(tcx, self.def_id);
12121212
parameterized(tcx, path_str.as_slice(), self.substs,
12131213
&trait_def.generics, self.def_id)
1214-
let did = trait_def.trait_ref.def_id;
1215-
parameterized(tcx, base.as_slice(), trait_ref.substs, &trait_def.generics, did)
12161214
}
12171215
}
12181216

src/librustc_driver/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,15 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
256256
let input_args = input_tys.iter().map(|ty| *ty).collect();
257257
ty::mk_bare_fn(self.infcx.tcx,
258258
None,
259-
ty::BareFnTy {
259+
self.infcx.tcx.mk_bare_fn(ty::BareFnTy {
260260
unsafety: ast::Unsafety::Normal,
261261
abi: abi::Rust,
262262
sig: ty::Binder(ty::FnSig {
263263
inputs: input_args,
264264
output: ty::FnConverging(output_ty),
265265
variadic: false
266266
})
267-
})
267+
}))
268268
}
269269

270270
pub fn t_nil(&self) -> Ty<'tcx> {

src/librustc_trans/trans/adt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ fn find_discr_field_candidate<'tcx>(tcx: &ty::ctxt<'tcx>,
361361
},
362362

363363
// Is this the NonZero lang item wrapping a pointer or integer type?
364-
ty::ty_struct(did, ref substs) if Some(did) == tcx.lang_items.non_zero() => {
364+
ty::ty_struct(did, substs) if Some(did) == tcx.lang_items.non_zero() => {
365365
let nonzero_fields = ty::lookup_struct_fields(tcx, did);
366366
assert_eq!(nonzero_fields.len(), 1);
367367
let nonzero_field = ty::lookup_field_type(tcx, did, nonzero_fields[0].id, substs);
@@ -376,7 +376,7 @@ fn find_discr_field_candidate<'tcx>(tcx: &ty::ctxt<'tcx>,
376376

377377
// Perhaps one of the fields of this struct is non-zero
378378
// let's recurse and find out
379-
ty::ty_struct(def_id, ref substs) => {
379+
ty::ty_struct(def_id, substs) => {
380380
let fields = ty::lookup_struct_fields(tcx, def_id);
381381
for (j, field) in fields.iter().enumerate() {
382382
let field_ty = ty::lookup_field_type(tcx, def_id, field.id, substs);

src/librustc_trans/trans/callee.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,12 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
299299
tcx.mk_bare_fn(ty::BareFnTy {
300300
unsafety: ast::Unsafety::Normal,
301301
abi: synabi::RustCall,
302-
sig: ty::FnSig {
302+
sig: ty::Binder(ty::FnSig {
303303
inputs: vec![bare_fn_ty_ref,
304304
tuple_input_ty],
305305
output: output_ty,
306306
variadic: false
307-
}}));
307+
})}));
308308
debug!("tuple_fn_ty: {}", tuple_fn_ty.repr(tcx));
309309

310310
//

src/librustc_trans/trans/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
10851085
None,
10861086
expr.span,
10871087
expr.id,
1088-
ty::mk_struct(tcx, did, substs),
1088+
ty::mk_struct(tcx, did, tcx.mk_substs(substs)),
10891089
dest)
10901090
} else {
10911091
tcx.sess.span_bug(expr.span,

src/librustc_typeck/check/method/confirm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> {
223223
// been ruled out when we deemed the trait to be
224224
// "object safe".
225225
let original_poly_trait_ref =
226-
data.principal_trait_ref_with_self_ty(object_ty);
226+
data.principal_trait_ref_with_self_ty(this.tcx(), object_ty);
227227
let upcast_poly_trait_ref =
228228
this.upcast(original_poly_trait_ref.clone(), trait_def_id);
229229
let upcast_trait_ref =

src/librustc_typeck/check/method/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &'a FnCtxt<'a, 'tcx>,
200200
&fn_sig).0;
201201
let transformed_self_ty = fn_sig.inputs[0];
202202
let fty = ty::mk_bare_fn(tcx, None, tcx.mk_bare_fn(ty::BareFnTy {
203+
sig: ty::Binder(fn_sig),
203204
unsafety: bare_fn_ty.unsafety,
204205
abi: bare_fn_ty.abi.clone(),
205206
}));

src/librustc_typeck/check/method/probe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
305305
// a substitution that replaces `Self` with the object type
306306
// itself. Hence, a `&self` method will wind up with an
307307
// argument type like `&Trait`.
308-
let trait_ref = data.principal_trait_ref_with_self_ty(self_ty);
308+
let trait_ref = data.principal_trait_ref_with_self_ty(self.tcx(), self_ty);
309309
self.elaborate_bounds(&[trait_ref.clone()], false, |this, new_trait_ref, m, method_num| {
310310
let vtable_index =
311311
get_method_index(tcx, &*new_trait_ref, trait_ref.clone(), method_num);

src/librustc_typeck/check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4355,7 +4355,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
43554355
traits::ItemObligation(did)),
43564356
&bounds);
43574357

4358-
ty::mk_struct(tcx, did, substs)
4358+
ty::mk_struct(tcx, did, tcx.mk_substs(substs))
43594359
} else {
43604360
ty::mk_err()
43614361
}

0 commit comments

Comments
 (0)