Skip to content

Commit 8d3d71a

Browse files
committed
---
yaml --- r: 68826 b: refs/heads/auto c: fd5f8d9 h: refs/heads/master v: v3
1 parent c720183 commit 8d3d71a

File tree

20 files changed

+109
-81
lines changed

20 files changed

+109
-81
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 990dc435aaf4861c6c57d2f94e3964b6c0918a87
17+
refs/heads/auto: fd5f8d90c5cc593e6aa43a978a1498f88558cc39
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,7 @@ 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 {ident: parse_ident(st, ':'),
547-
def_id: parse_def(st, NominalType, |x,y| conv(x,y)),
546+
ty::TypeParameterDef {def_id: parse_def(st, NominalType, |x,y| conv(x,y)),
548547
bounds: @parse_bounds(st, |x,y| conv(x,y))}
549548
}
550549

branches/auto/src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ 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(':');
421419
w.write_str((cx.ds)(v.def_id));
422420
w.write_char('|');
423421
enc_bounds(w, cx, v.bounds);

branches/auto/src/librustc/middle/subst.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ 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,
134133
def_id: self.def_id,
135134
bounds: self.bounds.subst(tcx, substs)
136135
}

branches/auto/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ use middle::trans::type_of::*;
5959
use middle::ty;
6060
use util::common::indenter;
6161
use util::ppaux::{Repr, ty_to_str};
62+
use middle::pat_util;
6263

6364
use middle::trans::type_::Type;
6465

branches/auto/src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::vec;
2020

2121
use back::abi;
2222
use driver::session;
23+
use lib;
2324
use lib::llvm::ValueRef;
2425
use lib::llvm::llvm;
2526
use metadata::csearch;

branches/auto/src/librustc/middle/trans/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use std::hash;
2929
use std::hashmap::{HashMap, HashSet};
3030
use std::str;
3131
use std::local_data;
32+
use extra::time;
3233
use syntax::ast;
3334

3435
use middle::trans::common::{mono_id,ExternMap,tydesc_info,BuilderRef_res,Stats};

branches/auto/src/librustc/middle/trans/controlflow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ pub fn trans_break_cont(bcx: block,
248248
let mut unwind = bcx;
249249
let mut cur_scope = unwind.scope;
250250
let mut target = unwind;
251+
let mut quit = false;
251252
loop {
252253
cur_scope = match cur_scope {
253254
Some(@scope_info {

branches/auto/src/librustc/middle/trans/datum.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ use middle::trans::glue;
100100
use middle::trans::tvec;
101101
use middle::trans::type_of;
102102
use middle::trans::write_guard;
103+
use middle::trans::type_::Type;
103104
use middle::ty;
104105
use util::common::indenter;
105106
use util::ppaux::ty_to_str;

branches/auto/src/librustc/middle/trans/glue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ use middle::trans::type_::Type;
3939
use std::io;
4040
use std::libc::c_uint;
4141
use std::str;
42+
use extra::time;
4243
use syntax::ast;
4344

4445
pub fn trans_free(cx: block, v: ValueRef) -> block {

branches/auto/src/librustc/middle/trans/meth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ pub fn trans_trait_callee_from_llval(bcx: block,
548548

549549
let _icx = push_ctxt("impl::trans_trait_callee");
550550
let ccx = bcx.ccx();
551-
let bcx = bcx;
551+
let mut bcx = bcx;
552552

553553
// Load the vtable from the @Trait pair
554554
debug!("(translating trait callee) loading vtable from pair %s",

branches/auto/src/librustc/middle/trans/uniq.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use middle::trans::glue;
1919
use middle::ty;
2020
use middle::trans::machine::llsize_of;
2121
use middle::trans::type_of;
22+
use middle::trans::type_of::*;
2223

2324
pub fn make_free_glue(bcx: block, vptrptr: ValueRef, box_ty: ty::t)
2425
-> block {

branches/auto/src/librustc/middle/ty.rs

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

796796
pub struct TypeParameterDef {
797-
ident: ast::ident,
798797
def_id: ast::def_id,
799798
bounds: @ParamBounds
800799
}

branches/auto/src/librustc/middle/typeck/collect.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ 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;
6362

6463
pub fn collect_item_types(ccx: @mut CrateCtxt, crate: &ast::crate) {
6564
fn collect_intrinsic_type(ccx: &CrateCtxt,
@@ -319,7 +318,6 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt,
319318
let self_trait_def = get_trait_def(ccx, local_def(trait_id));
320319
let self_trait_ref = self_trait_def.trait_ref.subst(tcx, &substs);
321320
new_type_param_defs.push(ty::TypeParameterDef {
322-
ident: special_idents::self_,
323321
def_id: dummy_defid,
324322
bounds: @ty::ParamBounds {
325323
builtin_bounds: ty::EmptyBuiltinBounds(),
@@ -1153,7 +1151,6 @@ pub fn ty_generics(ccx: &CrateCtxt,
11531151
let bounds = @compute_bounds(ccx, rp, generics,
11541152
param_ty, &param.bounds);
11551153
let def = ty::TypeParameterDef {
1156-
ident: param.ident,
11571154
def_id: local_def(param.id),
11581155
bounds: bounds
11591156
};

branches/auto/src/librustc/util/ppaux.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -435,17 +435,16 @@ 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 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) }
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+
}
449448
}
450449
ty_self(*) => ~"Self",
451450
ty_enum(did, ref substs) | ty_struct(did, ref substs) => {

branches/auto/src/libstd/iterator.rs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,49 @@ 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+
5093
/// Iterator adaptors provided for every `Iterator` implementation. The adaptor objects are also
5194
/// implementations of the `Iterator` trait.
5295
///
@@ -1474,4 +1517,13 @@ mod tests {
14741517
let xs = [-3, 0, 1, 5, -10];
14751518
assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
14761519
}
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+
}
14771529
}

branches/auto/src/libstd/repr.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,11 @@ impl ReprVisitor {
206206
inner: *TyDesc)
207207
-> bool {
208208
let mut p = ptr;
209+
let end = ptr::offset(p, len);
209210
let (sz, al) = unsafe { ((*inner).size, (*inner).align) };
210211
self.writer.write_char('[');
211212
let mut first = true;
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 {
213+
while (p as uint) < (end as uint) {
216214
if first {
217215
first = false;
218216
} else {
@@ -221,7 +219,6 @@ impl ReprVisitor {
221219
self.write_mut_qualifier(mtbl);
222220
self.visit_ptr_inner(p as *c_void, inner);
223221
p = align(ptr::offset(p, sz) as uint, al) as *u8;
224-
left -= dec;
225222
}
226223
self.writer.write_char(']');
227224
true
@@ -638,7 +635,4 @@ fn test_repr() {
638635
"(10, ~\"hello\")");
639636
exact_test(&(10_u64, ~"hello"),
640637
"(10, ~\"hello\")");
641-
642-
struct Foo;
643-
exact_test(&(~[Foo, Foo, Foo]), "~[{}, {}, {}]");
644638
}

0 commit comments

Comments
 (0)