Skip to content

Commit 7350c90

Browse files
committed
---
yaml --- r: 51135 b: refs/heads/try c: 2b07f0f h: refs/heads/master i: 51133: ff3677e 51131: 0d8b4b2 51127: 91bb448 51119: 6a3f64e 51103: 9f8f84c 51071: 61bca62 v: v3
1 parent 9c9376f commit 7350c90

File tree

15 files changed

+683
-452
lines changed

15 files changed

+683
-452
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
5-
refs/heads/try: 356438989830d8b9e597096a9d1ea2c7b6aa9af9
5+
refs/heads/try: 2b07f0fb0018649588cda06bd33c33b71c5cac70
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/hashmap.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -393,16 +393,10 @@ pub mod linear {
393393
}
394394
}
395395
396-
pub impl<K: Hash + IterBytes + Eq, V> LinearMap<K, V> {
396+
pub impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
397397
/// Create an empty LinearMap
398398
fn new() -> LinearMap<K, V> {
399-
LinearMap::with_capacity(INITIAL_CAPACITY)
400-
}
401-
402-
/// Create an empty LinearMap with space for at least `n` elements in
403-
/// the hash table.
404-
fn with_capacity(capacity: uint) -> LinearMap<K, V> {
405-
linear_map_with_capacity(capacity)
399+
linear_map_with_capacity(INITIAL_CAPACITY)
406400
}
407401
408402
/// Reserve space for at least `n` elements in the hash table.
@@ -658,15 +652,7 @@ pub mod linear {
658652

659653
pub impl <T:Hash + IterBytes + Eq> LinearSet<T> {
660654
/// Create an empty LinearSet
661-
fn new() -> LinearSet<T> {
662-
LinearSet::with_capacity(INITIAL_CAPACITY)
663-
}
664-
665-
/// Create an empty LinearSet with space for at least `n` elements in
666-
/// the hash table.
667-
fn with_capacity(capacity: uint) -> LinearSet<T> {
668-
LinearSet { map: LinearMap::with_capacity(capacity) }
669-
}
655+
fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
670656

671657
/// Reserve space for at least `n` elements in the hash table.
672658
fn reserve_at_least(&mut self, n: uint) {

branches/try/src/libcore/vec.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -560,28 +560,6 @@ pub fn consume<T>(mut v: ~[T], f: &fn(uint, v: T)) {
560560
}
561561
}
562562
563-
pub fn consume_reverse<T>(mut v: ~[T], f: &fn(uint, v: T)) {
564-
unsafe {
565-
do as_mut_buf(v) |p, ln| {
566-
let mut i = ln;
567-
while i > 0 {
568-
i -= 1;
569-
570-
// NB: This unsafe operation counts on init writing 0s to the
571-
// holes we create in the vector. That ensures that, if the
572-
// iterator fails then we won't try to clean up the consumed
573-
// elements during unwinding
574-
let mut x = intrinsics::init();
575-
let p = ptr::mut_offset(p, i);
576-
x <-> *p;
577-
f(i, x);
578-
}
579-
}
580-
581-
raw::set_len(&mut v, 0);
582-
}
583-
}
584-
585563
/// Remove the last element from a vector and return it
586564
pub fn pop<T>(v: &mut ~[T]) -> T {
587565
let ln = v.len();
@@ -2007,7 +1985,6 @@ pub trait OwnedVector<T> {
20071985
fn truncate(&mut self, newlen: uint);
20081986
fn retain(&mut self, f: &fn(t: &T) -> bool);
20091987
fn consume(self, f: &fn(uint, v: T));
2010-
fn consume_reverse(self, f: &fn(uint, v: T));
20111988
fn filter(self, f: &fn(t: &T) -> bool) -> ~[T];
20121989
fn partition(self, f: &fn(&T) -> bool) -> (~[T], ~[T]);
20131990
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
@@ -2069,11 +2046,6 @@ impl<T> OwnedVector<T> for ~[T] {
20692046
consume(self, f)
20702047
}
20712048

2072-
#[inline]
2073-
fn consume_reverse(self, f: &fn(uint, v: T)) {
2074-
consume_reverse(self, f)
2075-
}
2076-
20772049
#[inline]
20782050
fn filter(self, f: &fn(&T) -> bool) -> ~[T] {
20792051
filter(self, f)

branches/try/src/librustc/middle/astencode.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ trait read_method_map_entry_helper {
558558
fn encode_method_map_entry(ecx: @e::EncodeContext,
559559
ebml_w: writer::Encoder,
560560
mme: method_map_entry) {
561-
do ebml_w.emit_struct("method_map_entry", 3) {
561+
do ebml_w.emit_rec {
562562
do ebml_w.emit_field(~"self_arg", 0u) {
563563
ebml_w.emit_arg(ecx, mme.self_arg);
564564
}
@@ -574,7 +574,7 @@ fn encode_method_map_entry(ecx: @e::EncodeContext,
574574
impl read_method_map_entry_helper for reader::Decoder {
575575
fn read_method_map_entry(&self, xcx: @ExtendedDecodeContext)
576576
-> method_map_entry {
577-
do self.read_struct("method_map_entry", 3) {
577+
do self.read_rec {
578578
method_map_entry {
579579
self_arg: self.read_field(~"self_arg", 0u, || {
580580
self.read_arg(xcx)
@@ -817,7 +817,7 @@ impl ebml_writer_helpers for writer::Encoder {
817817
818818
fn emit_tpbt(&self, ecx: @e::EncodeContext,
819819
tpbt: ty::ty_param_bounds_and_ty) {
820-
do self.emit_struct("ty_param_bounds_and_ty", 3) {
820+
do self.emit_rec {
821821
do self.emit_field(~"bounds", 0) {
822822
do self.emit_from_vec(*tpbt.bounds) |bs| {
823823
self.emit_bounds(ecx, *bs);
@@ -1084,7 +1084,7 @@ impl ebml_decoder_decoder_helpers for reader::Decoder {
10841084
fn read_ty_param_bounds_and_ty(&self, xcx: @ExtendedDecodeContext)
10851085
-> ty::ty_param_bounds_and_ty
10861086
{
1087-
do self.read_struct("ty_param_bounds_and_ty", 3) {
1087+
do self.read_rec {
10881088
ty::ty_param_bounds_and_ty {
10891089
bounds: self.read_field(~"bounds", 0u, || {
10901090
@self.read_to_vec(|| self.read_bounds(xcx) )

branches/try/src/libstd/ebml.rs

Lines changed: 69 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,23 @@ pub mod reader {
311311
fn read_f64(&self) -> f64 { fail!(~"read_f64()"); }
312312
fn read_f32(&self) -> f32 { fail!(~"read_f32()"); }
313313
fn read_float(&self) -> float { fail!(~"read_float()"); }
314+
314315
fn read_char(&self) -> char { fail!(~"read_char()"); }
315-
fn read_str(&self) -> ~str { doc_as_str(self.next_doc(EsStr)) }
316+
317+
fn read_owned_str(&self) -> ~str { doc_as_str(self.next_doc(EsStr)) }
318+
fn read_managed_str(&self) -> @str { fail!(~"read_managed_str()"); }
316319
317320
// Compound types:
321+
fn read_owned<T>(&self, f: &fn() -> T) -> T {
322+
debug!("read_owned()");
323+
f()
324+
}
325+
326+
fn read_managed<T>(&self, f: &fn() -> T) -> T {
327+
debug!("read_managed()");
328+
f()
329+
}
330+
318331
fn read_enum<T>(&self, name: &str, f: &fn() -> T) -> T {
319332
debug!("read_enum(%s)", name);
320333
self._check_label(name);
@@ -348,20 +361,34 @@ pub mod reader {
348361
f()
349362
}
350363
351-
fn read_seq<T>(&self, f: &fn(uint) -> T) -> T {
352-
debug!("read_seq()");
364+
fn read_owned_vec<T>(&self, f: &fn(uint) -> T) -> T {
365+
debug!("read_owned_vec()");
353366
do self.push_doc(self.next_doc(EsVec)) {
354367
let len = self._next_uint(EsVecLen);
355368
debug!(" len=%u", len);
356369
f(len)
357370
}
358371
}
359372
360-
fn read_seq_elt<T>(&self, idx: uint, f: &fn() -> T) -> T {
361-
debug!("read_seq_elt(idx=%u)", idx);
373+
fn read_managed_vec<T>(&self, f: &fn(uint) -> T) -> T {
374+
debug!("read_managed_vec()");
375+
do self.push_doc(self.next_doc(EsVec)) {
376+
let len = self._next_uint(EsVecLen);
377+
debug!(" len=%u", len);
378+
f(len)
379+
}
380+
}
381+
382+
fn read_vec_elt<T>(&self, idx: uint, f: &fn() -> T) -> T {
383+
debug!("read_vec_elt(idx=%u)", idx);
362384
self.push_doc(self.next_doc(EsVecElt), f)
363385
}
364386
387+
fn read_rec<T>(&self, f: &fn() -> T) -> T {
388+
debug!("read_rec()");
389+
f()
390+
}
391+
365392
fn read_struct<T>(&self, name: &str, _len: uint, f: &fn() -> T) -> T {
366393
debug!("read_struct(name=%s)", name);
367394
f()
@@ -373,6 +400,16 @@ pub mod reader {
373400
f()
374401
}
375402
403+
fn read_tup<T>(&self, len: uint, f: &fn() -> T) -> T {
404+
debug!("read_tup(len=%u)", len);
405+
f()
406+
}
407+
408+
fn read_tup_elt<T>(&self, idx: uint, f: &fn() -> T) -> T {
409+
debug!("read_tup_elt(idx=%u)", idx);
410+
f()
411+
}
412+
376413
#[cfg(stage0)]
377414
fn read_option<T>(&self, f: &fn(bool) -> T) -> T {
378415
debug!("read_option()");
@@ -402,21 +439,6 @@ pub mod reader {
402439
}
403440
}
404441
}
405-
406-
fn read_map<T>(&self, _f: &fn(uint) -> T) -> T {
407-
debug!("read_map()");
408-
fail!(~"read_map is unimplemented");
409-
}
410-
411-
fn read_map_elt_key<T>(&self, idx: uint, _f: &fn() -> T) -> T {
412-
debug!("read_map_elt_key(idx=%u)", idx);
413-
fail!(~"read_map_elt_val is unimplemented");
414-
}
415-
416-
fn read_map_elt_val<T>(&self, idx: uint, _f: &fn() -> T) -> T {
417-
debug!("read_map_elt_val(idx=%u)", idx);
418-
fail!(~"read_map_elt_val is unimplemented");
419-
}
420442
}
421443
}
422444
@@ -628,10 +650,22 @@ pub mod writer {
628650
fail!(~"Unimplemented: serializing a char");
629651
}
630652
631-
fn emit_str(&self, v: &str) {
653+
fn emit_borrowed_str(&self, v: &str) {
632654
self.wr_tagged_str(EsStr as uint, v)
633655
}
634656
657+
fn emit_owned_str(&self, v: &str) {
658+
self.emit_borrowed_str(v)
659+
}
660+
661+
fn emit_managed_str(&self, v: &str) {
662+
self.emit_borrowed_str(v)
663+
}
664+
665+
fn emit_borrowed(&self, f: &fn()) { f() }
666+
fn emit_owned(&self, f: &fn()) { f() }
667+
fn emit_managed(&self, f: &fn()) { f() }
668+
635669
fn emit_enum(&self, name: &str, f: &fn()) {
636670
self._emit_label(name);
637671
self.wr_tag(EsEnum as uint, f)
@@ -643,23 +677,35 @@ pub mod writer {
643677
}
644678
fn emit_enum_variant_arg(&self, _idx: uint, f: &fn()) { f() }
645679
646-
fn emit_seq(&self, len: uint, f: &fn()) {
680+
fn emit_borrowed_vec(&self, len: uint, f: &fn()) {
647681
do self.wr_tag(EsVec as uint) {
648682
self._emit_tagged_uint(EsVecLen, len);
649683
f()
650684
}
651685
}
652686
653-
fn emit_seq_elt(&self, _idx: uint, f: &fn()) {
687+
fn emit_owned_vec(&self, len: uint, f: &fn()) {
688+
self.emit_borrowed_vec(len, f)
689+
}
690+
691+
fn emit_managed_vec(&self, len: uint, f: &fn()) {
692+
self.emit_borrowed_vec(len, f)
693+
}
694+
695+
fn emit_vec_elt(&self, _idx: uint, f: &fn()) {
654696
self.wr_tag(EsVecElt as uint, f)
655697
}
656698
699+
fn emit_rec(&self, f: &fn()) { f() }
657700
fn emit_struct(&self, _name: &str, _len: uint, f: &fn()) { f() }
658701
fn emit_field(&self, name: &str, _idx: uint, f: &fn()) {
659702
self._emit_label(name);
660703
f()
661704
}
662705
706+
fn emit_tup(&self, _len: uint, f: &fn()) { f() }
707+
fn emit_tup_elt(&self, _idx: uint, f: &fn()) { f() }
708+
663709
fn emit_option(&self, f: &fn()) {
664710
self.emit_enum("Option", f);
665711
}
@@ -669,18 +715,6 @@ pub mod writer {
669715
fn emit_option_some(&self, f: &fn()) {
670716
self.emit_enum_variant("Some", 1, 1, f)
671717
}
672-
673-
fn emit_map(&self, _len: uint, _f: &fn()) {
674-
fail!(~"emit_map is unimplemented");
675-
}
676-
677-
fn emit_map_elt_key(&self, _idx: uint, _f: &fn()) {
678-
fail!(~"emit_map_elt_key is unimplemented");
679-
}
680-
681-
fn emit_map_elt_val(&self, _idx: uint, _f: &fn()) {
682-
fail!(~"emit_map_elt_val is unimplemented");
683-
}
684718
}
685719
}
686720

branches/try/src/libstd/flatpipes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ pub mod flatteners {
466466
fn from_writer(w: @Writer) -> Self;
467467
}
468468
469-
impl FromReader for json::Decoder {
470-
fn from_reader(r: @Reader) -> json::Decoder {
469+
impl<'self> FromReader for json::Decoder<'self> {
470+
fn from_reader(r: @Reader) -> json::Decoder<'self> {
471471
match json::from_reader(r) {
472472
Ok(json) => {
473473
json::Decoder(json)

0 commit comments

Comments
 (0)