Skip to content

Commit a778e7e

Browse files
committed
---
yaml --- r: 167383 b: refs/heads/snap-stage3 c: f95bb55 h: refs/heads/master i: 167381: 0df6a26 167379: 479f2d9 167375: 915f39e v: v3
1 parent 9563400 commit a778e7e

File tree

28 files changed

+465
-392
lines changed

28 files changed

+465
-392
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 023dfb0c898d851dee6ace2f8339b73b5287136b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 771dd54ea6c09ac32093a46a0d9ed80502ce3b02
4+
refs/heads/snap-stage3: f95bb55a1c4cb258ac8e6adde99cf1aadc5d776b
55
refs/heads/try: 5204084bd2e46af7cc6e0147430e44dd0d657bbb
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustc/metadata/tydecode.rs

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -384,39 +384,40 @@ fn parse_trait_ref<'a, 'tcx>(st: &mut PState<'a, 'tcx>, conv: conv_did)
384384
}
385385

386386
fn parse_ty<'a, 'tcx>(st: &mut PState<'a, 'tcx>, conv: conv_did) -> Ty<'tcx> {
387+
let tcx = st.tcx;
387388
match next(st) {
388-
'b' => return ty::mk_bool(),
389-
'i' => return ty::mk_int(),
390-
'u' => return ty::mk_uint(),
389+
'b' => return tcx.types.bool,
390+
'i' => return tcx.types.int,
391+
'u' => return tcx.types.uint,
391392
'M' => {
392393
match next(st) {
393-
'b' => return ty::mk_mach_uint(ast::TyU8),
394-
'w' => return ty::mk_mach_uint(ast::TyU16),
395-
'l' => return ty::mk_mach_uint(ast::TyU32),
396-
'd' => return ty::mk_mach_uint(ast::TyU64),
397-
'B' => return ty::mk_mach_int(ast::TyI8),
398-
'W' => return ty::mk_mach_int(ast::TyI16),
399-
'L' => return ty::mk_mach_int(ast::TyI32),
400-
'D' => return ty::mk_mach_int(ast::TyI64),
401-
'f' => return ty::mk_mach_float(ast::TyF32),
402-
'F' => return ty::mk_mach_float(ast::TyF64),
394+
'b' => return tcx.types.u8,
395+
'w' => return tcx.types.u16,
396+
'l' => return tcx.types.u32,
397+
'd' => return tcx.types.u64,
398+
'B' => return tcx.types.i8,
399+
'W' => return tcx.types.i16,
400+
'L' => return tcx.types.i32,
401+
'D' => return tcx.types.i64,
402+
'f' => return tcx.types.f32,
403+
'F' => return tcx.types.f64,
403404
_ => panic!("parse_ty: bad numeric type")
404405
}
405406
}
406-
'c' => return ty::mk_char(),
407+
'c' => return tcx.types.char,
407408
't' => {
408409
assert_eq!(next(st), '[');
409410
let def = parse_def(st, NominalType, |x,y| conv(x,y));
410411
let substs = parse_substs(st, |x,y| conv(x,y));
411412
assert_eq!(next(st), ']');
412-
return ty::mk_enum(st.tcx, def, st.tcx.mk_substs(substs));
413+
return ty::mk_enum(tcx, def, st.tcx.mk_substs(substs));
413414
}
414415
'x' => {
415416
assert_eq!(next(st), '[');
416417
let trait_ref = ty::Binder(parse_trait_ref(st, |x,y| conv(x,y)));
417418
let bounds = parse_existential_bounds(st, |x,y| conv(x,y));
418419
assert_eq!(next(st), ']');
419-
return ty::mk_trait(st.tcx, trait_ref, bounds);
420+
return ty::mk_trait(tcx, trait_ref, bounds);
420421
}
421422
'p' => {
422423
let did = parse_def(st, TypeParameter, |x,y| conv(x,y));
@@ -425,41 +426,41 @@ fn parse_ty<'a, 'tcx>(st: &mut PState<'a, 'tcx>, conv: conv_did) -> Ty<'tcx> {
425426
assert_eq!(next(st), '|');
426427
let space = parse_param_space(st);
427428
assert_eq!(next(st), '|');
428-
return ty::mk_param(st.tcx, space, index, did);
429+
return ty::mk_param(tcx, space, index, did);
429430
}
430-
'~' => return ty::mk_uniq(st.tcx, parse_ty(st, |x,y| conv(x,y))),
431-
'*' => return ty::mk_ptr(st.tcx, parse_mt(st, |x,y| conv(x,y))),
431+
'~' => return ty::mk_uniq(tcx, parse_ty(st, |x,y| conv(x,y))),
432+
'*' => return ty::mk_ptr(tcx, parse_mt(st, |x,y| conv(x,y))),
432433
'&' => {
433434
let r = parse_region(st, |x,y| conv(x,y));
434435
let mt = parse_mt(st, |x,y| conv(x,y));
435-
return ty::mk_rptr(st.tcx, st.tcx.mk_region(r), mt);
436+
return ty::mk_rptr(tcx, tcx.mk_region(r), mt);
436437
}
437438
'V' => {
438439
let t = parse_ty(st, |x,y| conv(x,y));
439440
let sz = parse_size(st);
440-
return ty::mk_vec(st.tcx, t, sz);
441+
return ty::mk_vec(tcx, t, sz);
441442
}
442443
'v' => {
443-
return ty::mk_str(st.tcx);
444+
return ty::mk_str(tcx);
444445
}
445446
'T' => {
446447
assert_eq!(next(st), '[');
447448
let mut params = Vec::new();
448449
while peek(st) != ']' { params.push(parse_ty(st, |x,y| conv(x,y))); }
449450
st.pos = st.pos + 1u;
450-
return ty::mk_tup(st.tcx, params);
451+
return ty::mk_tup(tcx, params);
451452
}
452453
'f' => {
453-
return ty::mk_closure(st.tcx, parse_closure_ty(st, |x,y| conv(x,y)));
454+
return ty::mk_closure(tcx, parse_closure_ty(st, |x,y| conv(x,y)));
454455
}
455456
'F' => {
456457
let def_id = parse_def(st, NominalType, |x,y| conv(x,y));
457-
return ty::mk_bare_fn(st.tcx, Some(def_id),
458-
st.tcx.mk_bare_fn(parse_bare_fn_ty(st, |x,y| conv(x,y))));
458+
return ty::mk_bare_fn(tcx, Some(def_id),
459+
tcx.mk_bare_fn(parse_bare_fn_ty(st, |x,y| conv(x,y))));
459460
}
460461
'G' => {
461-
return ty::mk_bare_fn(st.tcx, None,
462-
st.tcx.mk_bare_fn(parse_bare_fn_ty(st, |x,y| conv(x,y))));
462+
return ty::mk_bare_fn(tcx, None,
463+
tcx.mk_bare_fn(parse_bare_fn_ty(st, |x,y| conv(x,y))));
463464
}
464465
'#' => {
465466
let pos = parse_hex(st);
@@ -470,7 +471,7 @@ fn parse_ty<'a, 'tcx>(st: &mut PState<'a, 'tcx>, conv: conv_did) -> Ty<'tcx> {
470471
pos: pos,
471472
len: len };
472473

473-
match st.tcx.rcache.borrow().get(&key).cloned() {
474+
match tcx.rcache.borrow().get(&key).cloned() {
474475
Some(tt) => return tt,
475476
None => {}
476477
}
@@ -479,7 +480,7 @@ fn parse_ty<'a, 'tcx>(st: &mut PState<'a, 'tcx>, conv: conv_did) -> Ty<'tcx> {
479480
.. *st
480481
};
481482
let tt = parse_ty(&mut ps, |x,y| conv(x,y));
482-
st.tcx.rcache.borrow_mut().insert(key, tt);
483+
tcx.rcache.borrow_mut().insert(key, tt);
483484
return tt;
484485
}
485486
'\"' => {
@@ -504,7 +505,7 @@ fn parse_ty<'a, 'tcx>(st: &mut PState<'a, 'tcx>, conv: conv_did) -> Ty<'tcx> {
504505
st.tcx.mk_region(region), st.tcx.mk_substs(substs));
505506
}
506507
'e' => {
507-
return ty::mk_err();
508+
return tcx.types.err;
508509
}
509510
c => { panic!("unexpected char in type string: {}", c);}
510511
}

branches/snap-stage3/src/librustc/middle/astconv_util.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,23 @@ pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
5757
match nty {
5858
ast::TyBool => {
5959
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
60-
Some(ty::mk_bool())
60+
Some(tcx.types.bool)
6161
}
6262
ast::TyChar => {
6363
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
64-
Some(ty::mk_char())
64+
Some(tcx.types.char)
6565
}
6666
ast::TyInt(it) => {
6767
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
68-
Some(ty::mk_mach_int(it))
68+
Some(ty::mk_mach_int(tcx, it))
6969
}
7070
ast::TyUint(uit) => {
7171
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
72-
Some(ty::mk_mach_uint(uit))
72+
Some(ty::mk_mach_uint(tcx, uit))
7373
}
7474
ast::TyFloat(ft) => {
7575
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
76-
Some(ty::mk_mach_float(ft))
76+
Some(ty::mk_mach_float(tcx, ft))
7777
}
7878
ast::TyStr => {
7979
Some(ty::mk_str(tcx))

branches/snap-stage3/src/librustc/middle/infer/combine.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ pub fn expected_found<'tcx, C: Combine<'tcx>, T>(
397397
pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
398398
a: Ty<'tcx>,
399399
b: Ty<'tcx>)
400-
-> cres<'tcx, Ty<'tcx>> {
401-
400+
-> cres<'tcx, Ty<'tcx>>
401+
{
402402
let tcx = this.infcx().tcx;
403403
let a_sty = &a.sty;
404404
let b_sty = &b.sty;
@@ -415,7 +415,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
415415
}
416416

417417
(&ty::ty_err, _) | (_, &ty::ty_err) => {
418-
Ok(ty::mk_err())
418+
Ok(tcx.types.err)
419419
}
420420

421421
// Relate integral variables to other types
@@ -592,8 +592,8 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
592592
{
593593
try!(this.infcx().simple_var_t(vid_is_expected, vid, val));
594594
match val {
595-
IntType(v) => Ok(ty::mk_mach_int(v)),
596-
UintType(v) => Ok(ty::mk_mach_uint(v))
595+
IntType(v) => Ok(ty::mk_mach_int(this.tcx(), v)),
596+
UintType(v) => Ok(ty::mk_mach_uint(this.tcx(), v))
597597
}
598598
}
599599

@@ -604,7 +604,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
604604
val: ast::FloatTy) -> cres<'tcx, Ty<'tcx>>
605605
{
606606
try!(this.infcx().simple_var_t(vid_is_expected, vid, val));
607-
Ok(ty::mk_mach_float(val))
607+
Ok(ty::mk_mach_float(this.tcx(), val))
608608
}
609609
}
610610

@@ -763,7 +763,7 @@ impl<'cx, 'tcx> ty_fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> {
763763
ty::ty_infer(ty::TyVar(vid)) => {
764764
if vid == self.for_vid {
765765
self.cycle_detected = true;
766-
ty::mk_err()
766+
self.tcx().types.err
767767
} else {
768768
match self.infcx.type_variables.borrow().probe(vid) {
769769
Some(u) => self.fold_ty(u),

branches/snap-stage3/src/librustc/middle/infer/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ pub fn common_supertype<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
324324
Ok(t) => t,
325325
Err(ref err) => {
326326
cx.report_and_explain_type_error(trace, err);
327-
ty::mk_err()
327+
cx.tcx.types.err
328328
}
329329
}
330330
}
@@ -1058,12 +1058,12 @@ impl<'tcx> TypeTrace<'tcx> {
10581058
self.origin.span()
10591059
}
10601060

1061-
pub fn dummy() -> TypeTrace<'tcx> {
1061+
pub fn dummy(tcx: &ty::ctxt<'tcx>) -> TypeTrace<'tcx> {
10621062
TypeTrace {
10631063
origin: Misc(codemap::DUMMY_SP),
10641064
values: Types(ty::expected_found {
1065-
expected: ty::mk_err(),
1066-
found: ty::mk_err(),
1065+
expected: tcx.types.err,
1066+
found: tcx.types.err,
10671067
})
10681068
}
10691069
}

branches/snap-stage3/src/librustc/middle/infer/resolve.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
8383
match t.sty {
8484
ty::ty_infer(ty::TyVar(vid)) => {
8585
self.err = Some(unresolved_ty(vid));
86-
ty::mk_err()
86+
self.tcx().types.err
8787
}
8888
ty::ty_infer(ty::IntVar(vid)) => {
8989
self.err = Some(unresolved_int_ty(vid));
90-
ty::mk_err()
90+
self.tcx().types.err
9191
}
9292
ty::ty_infer(ty::FloatVar(vid)) => {
9393
self.err = Some(unresolved_float_ty(vid));
94-
ty::mk_err()
94+
self.tcx().types.err
9595
}
9696
ty::ty_infer(_) => {
9797
self.infcx.tcx.sess.bug(

branches/snap-stage3/src/librustc/middle/infer/sub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl<'f, 'tcx> Combine<'tcx> for Sub<'f, 'tcx> {
146146
}
147147

148148
(&ty::ty_err, _) | (_, &ty::ty_err) => {
149-
Ok(ty::mk_err())
149+
Ok(self.tcx().types.err)
150150
}
151151

152152
_ => {

branches/snap-stage3/src/librustc/middle/infer/unify.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<K,V> sv::SnapshotVecDelegate<VarValue<K,V>,()> for Delegate {
225225
/// Indicates a type that does not have any kind of subtyping
226226
/// relationship.
227227
pub trait SimplyUnifiable<'tcx> : Clone + PartialEq + Repr<'tcx> {
228-
fn to_type(&self) -> Ty<'tcx>;
228+
fn to_type(&self, tcx: &ty::ctxt<'tcx>) -> Ty<'tcx>;
229229
fn to_type_err(expected_found<Self>) -> ty::type_err<'tcx>;
230230
}
231231

@@ -337,7 +337,7 @@ impl<'a,'tcx,V:SimplyUnifiable<'tcx>,K:UnifyKey<'tcx, Option<V>>>
337337
let node_a = table.borrow_mut().get(tcx, a_id);
338338
match node_a.value {
339339
None => None,
340-
Some(ref a_t) => Some(a_t.to_type())
340+
Some(ref a_t) => Some(a_t.to_type(tcx))
341341
}
342342
}
343343
}
@@ -363,10 +363,10 @@ impl<'tcx> UnifyKey<'tcx, Option<IntVarValue>> for ty::IntVid {
363363
}
364364

365365
impl<'tcx> SimplyUnifiable<'tcx> for IntVarValue {
366-
fn to_type(&self) -> Ty<'tcx> {
366+
fn to_type(&self, tcx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
367367
match *self {
368-
ty::IntType(i) => ty::mk_mach_int(i),
369-
ty::UintType(i) => ty::mk_mach_uint(i),
368+
ty::IntType(i) => ty::mk_mach_int(tcx, i),
369+
ty::UintType(i) => ty::mk_mach_uint(tcx, i),
370370
}
371371
}
372372

@@ -399,8 +399,8 @@ impl<'tcx> UnifyValue<'tcx> for Option<ast::FloatTy> {
399399
}
400400

401401
impl<'tcx> SimplyUnifiable<'tcx> for ast::FloatTy {
402-
fn to_type(&self) -> Ty<'tcx> {
403-
ty::mk_mach_float(*self)
402+
fn to_type(&self, tcx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
403+
ty::mk_mach_float(tcx, *self)
404404
}
405405

406406
fn to_type_err(err: expected_found<ast::FloatTy>) -> ty::type_err<'tcx> {

branches/snap-stage3/src/librustc/middle/intrinsicck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ pub fn check_crate(tcx: &ctxt) {
2828
let mut visitor = IntrinsicCheckingVisitor {
2929
tcx: tcx,
3030
param_envs: Vec::new(),
31-
dummy_sized_ty: ty::mk_int(),
32-
dummy_unsized_ty: ty::mk_vec(tcx, ty::mk_int(), None),
31+
dummy_sized_ty: tcx.types.int,
32+
dummy_unsized_ty: ty::mk_vec(tcx, tcx.types.int, None),
3333
};
3434
visit::walk_crate(&mut visitor, tcx.map.krate());
3535
}

branches/snap-stage3/src/librustc/middle/mem_categorization.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
755755
// instead of bothering to construct a proper
756756
// one.
757757
base.mutbl = McImmutable;
758-
base.ty = ty::mk_err();
758+
base.ty = self.tcx().types.err;
759759
Rc::new(cmt_ {
760760
id: id,
761761
span: span,
@@ -781,7 +781,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
781781
is_unboxed: is_unboxed
782782
}),
783783
mutbl: McImmutable,
784-
ty: ty::mk_err(),
784+
ty: self.tcx().types.err,
785785
note: NoteNone
786786
};
787787

@@ -792,7 +792,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
792792
span: span,
793793
cat: cat_deref(Rc::new(base), 0, env_ptr),
794794
mutbl: env_mutbl,
795-
ty: ty::mk_err(),
795+
ty: self.tcx().types.err,
796796
note: NoteClosureEnv(upvar_id)
797797
};
798798
}
@@ -987,7 +987,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
987987
ty::ty_fn_args(method_ty)[0]
988988
}
989989
None => {
990-
match ty::array_element_ty(base_cmt.ty) {
990+
match ty::array_element_ty(self.tcx(), base_cmt.ty) {
991991
Some(ty) => ty,
992992
None => {
993993
self.tcx().sess.span_bug(

branches/snap-stage3/src/librustc/middle/traits/select.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,9 @@ 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(self.tcx(),
1104-
ty::mk_err());
1103+
let tmp_tr =
1104+
data.principal_trait_ref_with_self_ty(self.tcx(),
1105+
self.tcx().types.err);
11051106
for tr in util::supertraits(self.tcx(), tmp_tr) {
11061107
let td = ty::lookup_trait_def(self.tcx(), tr.def_id());
11071108

0 commit comments

Comments
 (0)