Skip to content

Commit 9fa0eb5

Browse files
committed
---
yaml --- r: 64201 b: refs/heads/snap-stage3 c: 9239d69 h: refs/heads/master i: 64199: 09a05b8 v: v3
1 parent f976378 commit 9fa0eb5

File tree

13 files changed

+133
-102
lines changed

13 files changed

+133
-102
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: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 00da76dfbe3aba8c1ec399ecfa0eae4b4ba6885e
4+
refs/heads/snap-stage3: 9239d697889465dec4da1b30d13d731b96a0f40d
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,8 @@ pub fn parse_type_param_def_data(data: &[u8], start: uint,
543543
}
544544

545545
fn parse_type_param_def(st: &mut PState, conv: conv_did) -> ty::TypeParameterDef {
546-
ty::TypeParameterDef {def_id: parse_def(st, NominalType, |x,y| conv(x,y)),
546+
ty::TypeParameterDef {ident: parse_ident(st, ':'),
547+
def_id: parse_def(st, NominalType, |x,y| conv(x,y)),
547548
bounds: @parse_bounds(st, |x,y| conv(x,y))}
548549
}
549550

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ fn enc_bounds(w: @io::Writer, cx: @ctxt, bs: &ty::ParamBounds) {
416416
}
417417

418418
pub fn enc_type_param_def(w: @io::Writer, cx: @ctxt, v: &ty::TypeParameterDef) {
419+
w.write_str(cx.tcx.sess.str_of(v.ident));
420+
w.write_char(':');
419421
w.write_str((cx.ds)(v.def_id));
420422
w.write_char('|');
421423
enc_bounds(w, cx, v.bounds);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ impl Subst for ty::ParamBounds {
130130
impl Subst for ty::TypeParameterDef {
131131
fn subst(&self, tcx: ty::ctxt, substs: &ty::substs) -> ty::TypeParameterDef {
132132
ty::TypeParameterDef {
133+
ident: self.ident,
133134
def_id: self.def_id,
134135
bounds: self.bounds.subst(tcx, substs)
135136
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ impl ToStr for IntVarValue {
794794
}
795795

796796
pub struct TypeParameterDef {
797+
ident: ast::ident,
797798
def_id: ast::def_id,
798799
bounds: @ParamBounds
799800
}

branches/snap-stage3/src/librustc/middle/typeck/collect.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ use syntax::print::pprust::{path_to_str, explicit_self_to_str};
5959
use syntax::visit;
6060
use syntax::opt_vec::OptVec;
6161
use syntax::opt_vec;
62+
use syntax::parse::token::special_idents;
6263

6364
pub fn collect_item_types(ccx: @mut CrateCtxt, crate: &ast::crate) {
6465
fn collect_intrinsic_type(ccx: &CrateCtxt,
@@ -318,6 +319,7 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt,
318319
let self_trait_def = get_trait_def(ccx, local_def(trait_id));
319320
let self_trait_ref = self_trait_def.trait_ref.subst(tcx, &substs);
320321
new_type_param_defs.push(ty::TypeParameterDef {
322+
ident: special_idents::self_,
321323
def_id: dummy_defid,
322324
bounds: @ty::ParamBounds {
323325
builtin_bounds: ty::EmptyBuiltinBounds(),
@@ -1151,6 +1153,7 @@ pub fn ty_generics(ccx: &CrateCtxt,
11511153
let bounds = @compute_bounds(ccx, rp, generics,
11521154
param_ty, &param.bounds);
11531155
let def = ty::TypeParameterDef {
1156+
ident: param.ident,
11541157
def_id: local_def(param.id),
11551158
bounds: bounds
11561159
};

branches/snap-stage3/src/librustc/util/ppaux.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,17 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
435435
ty_infer(infer_ty) => infer_ty.to_str(),
436436
ty_err => ~"[type error]",
437437
ty_param(param_ty {idx: id, def_id: did}) => {
438-
let mut parm = (('T' as uint) + id) as char;
439-
if (parm as uint) > ('Z' as uint) {
440-
parm = (parm as uint - 26) as char;
441-
}
442-
443-
if cx.sess.verbose() {
444-
fmt!("%c:%?", parm, did)
445-
} else {
446-
fmt!("%c", parm)
447-
}
438+
let param_def = cx.ty_param_defs.find(&did.node);
439+
let ident = match param_def {
440+
Some(def) => {
441+
cx.sess.str_of(def.ident).to_owned()
442+
}
443+
None => {
444+
// This should not happen...
445+
fmt!("BUG[%?]", id)
446+
}
447+
};
448+
if !cx.sess.verbose() { ident } else { fmt!("%s:%?", ident, did) }
448449
}
449450
ty_self(*) => ~"Self",
450451
ty_enum(did, ref substs) | ty_struct(did, ref substs) => {

branches/snap-stage3/src/libstd/cast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use sys;
1414
use unstable::intrinsics;
1515

16-
/// Casts the value at `src` to U. The two types must have the same length.
1716
/// Casts the value at `src` to U. The two types must have the same length.
1817
#[cfg(target_word_size = "32")]
1918
#[inline]

branches/snap-stage3/src/libstd/iterator.rs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -47,49 +47,6 @@ pub trait Iterator<A> {
4747
fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
4848
}
4949

50-
/// A range iterator able to yield elements from both ends
51-
pub trait DoubleEndedIterator<A>: Iterator<A> {
52-
/// Yield an element from the end of the range, returning `None` if the range is empty.
53-
fn next_back(&mut self) -> Option<A>;
54-
}
55-
56-
/// Iterator adaptors provided for every `DoubleEndedIterator` implementation.
57-
///
58-
/// In the future these will be default methods instead of a utility trait.
59-
pub trait DoubleEndedIteratorUtil<A> {
60-
/// Flip the direction of the iterator
61-
fn invert(self) -> InvertIterator<A, Self>;
62-
}
63-
64-
/// Iterator adaptors provided for every `DoubleEndedIterator` implementation.
65-
///
66-
/// In the future these will be default methods instead of a utility trait.
67-
impl<A, T: DoubleEndedIterator<A>> DoubleEndedIteratorUtil<A> for T {
68-
/// Flip the direction of the iterator
69-
#[inline]
70-
fn invert(self) -> InvertIterator<A, T> {
71-
InvertIterator{iter: self}
72-
}
73-
}
74-
75-
/// An double-ended iterator with the direction inverted
76-
// FIXME #6967: Dummy A parameter to get around type inference bug
77-
pub struct InvertIterator<A, T> {
78-
priv iter: T
79-
}
80-
81-
impl<A, T: DoubleEndedIterator<A>> Iterator<A> for InvertIterator<A, T> {
82-
#[inline]
83-
fn next(&mut self) -> Option<A> { self.iter.next_back() }
84-
#[inline]
85-
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
86-
}
87-
88-
impl<A, T: Iterator<A>> DoubleEndedIterator<A> for InvertIterator<A, T> {
89-
#[inline]
90-
fn next_back(&mut self) -> Option<A> { self.iter.next() }
91-
}
92-
9350
/// Iterator adaptors provided for every `Iterator` implementation. The adaptor objects are also
9451
/// implementations of the `Iterator` trait.
9552
///
@@ -1517,13 +1474,4 @@ mod tests {
15171474
let xs = [-3, 0, 1, 5, -10];
15181475
assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
15191476
}
1520-
1521-
#[test]
1522-
fn test_invert() {
1523-
let xs = [2, 4, 6, 8, 10, 12, 14, 16];
1524-
let mut it = xs.iter();
1525-
it.next();
1526-
it.next();
1527-
assert_eq!(it.invert().transform(|&x| x).collect::<~[int]>(), ~[16, 14, 12, 10, 8, 6]);
1528-
}
15291477
}

branches/snap-stage3/src/libstd/libc.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ pub mod types {
186186
// Standard types that are opaque or common, so are not per-target.
187187
pub mod common {
188188
pub mod c95 {
189+
/**
190+
Type used to construct void pointers for use with C.
191+
192+
This type is only useful as a pointer target. Do not use it as a
193+
return type for FFI functions which have the `void` return type in
194+
C. Use the unit type `()` or omit the return type instead.
195+
*/
189196
pub enum c_void {}
190197
pub enum FILE {}
191198
pub enum fpos_t {}

branches/snap-stage3/src/libstd/repr.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,13 @@ impl ReprVisitor {
206206
inner: *TyDesc)
207207
-> bool {
208208
let mut p = ptr;
209-
let end = ptr::offset(p, len);
210209
let (sz, al) = unsafe { ((*inner).size, (*inner).align) };
211210
self.writer.write_char('[');
212211
let mut first = true;
213-
while (p as uint) < (end as uint) {
212+
let mut left = len;
213+
// unit structs have 0 size, and don't loop forever.
214+
let dec = if sz == 0 {1} else {sz};
215+
while left > 0 {
214216
if first {
215217
first = false;
216218
} else {
@@ -219,6 +221,7 @@ impl ReprVisitor {
219221
self.write_mut_qualifier(mtbl);
220222
self.visit_ptr_inner(p as *c_void, inner);
221223
p = align(ptr::offset(p, sz) as uint, al) as *u8;
224+
left -= dec;
222225
}
223226
self.writer.write_char(']');
224227
true
@@ -635,4 +638,7 @@ fn test_repr() {
635638
"(10, ~\"hello\")");
636639
exact_test(&(10_u64, ~"hello"),
637640
"(10, ~\"hello\")");
641+
642+
struct Foo;
643+
exact_test(&(~[Foo, Foo, Foo]), "~[{}, {}, {}]");
638644
}

0 commit comments

Comments
 (0)