Skip to content

Commit d8988fe

Browse files
committed
libstd: fix serialization no-implicit-copies warnings
1 parent 007e47d commit d8988fe

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

src/libstd/ebml.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl writer {
284284
self.wr_tagged_bytes(tag_id, &[v as u8]);
285285
}
286286

287-
fn wr_tagged_str(tag_id: uint, v: ~str) {
287+
fn wr_tagged_str(tag_id: uint, v: &str) {
288288
str::byte_slice(v, |b| self.wr_tagged_bytes(tag_id, b));
289289
}
290290

@@ -363,7 +363,7 @@ impl ebml::writer: serialization::serializer {
363363
fn emit_f32(_v: f32) { fail ~"Unimplemented: serializing an f32"; }
364364
fn emit_float(_v: float) { fail ~"Unimplemented: serializing a float"; }
365365

366-
fn emit_str(v: ~str) { self.wr_tagged_str(es_str as uint, v) }
366+
fn emit_str(v: &str) { self.wr_tagged_str(es_str as uint, v) }
367367

368368
fn emit_enum(name: ~str, f: fn()) {
369369
self._emit_label(name);
@@ -445,7 +445,7 @@ priv impl ebml_deserializer {
445445
return r_doc;
446446
}
447447

448-
fn push_doc<T: copy>(d: ebml::doc, f: fn() -> T) -> T{
448+
fn push_doc<T>(d: ebml::doc, f: fn() -> T) -> T{
449449
let old_parent = self.parent;
450450
let old_pos = self.pos;
451451
self.parent = d;
@@ -499,13 +499,13 @@ impl ebml_deserializer: serialization::deserializer {
499499
fn read_str() -> ~str { ebml::doc_as_str(self.next_doc(es_str)) }
500500

501501
// Compound types:
502-
fn read_enum<T:copy>(name: ~str, f: fn() -> T) -> T {
502+
fn read_enum<T>(name: ~str, f: fn() -> T) -> T {
503503
debug!{"read_enum(%s)", name};
504504
self._check_label(name);
505505
self.push_doc(self.next_doc(es_enum), f)
506506
}
507507

508-
fn read_enum_variant<T:copy>(f: fn(uint) -> T) -> T {
508+
fn read_enum_variant<T>(f: fn(uint) -> T) -> T {
509509
debug!{"read_enum_variant()"};
510510
let idx = self._next_uint(es_enum_vid);
511511
debug!{" idx=%u", idx};
@@ -514,12 +514,12 @@ impl ebml_deserializer: serialization::deserializer {
514514
}
515515
}
516516

517-
fn read_enum_variant_arg<T:copy>(idx: uint, f: fn() -> T) -> T {
517+
fn read_enum_variant_arg<T>(idx: uint, f: fn() -> T) -> T {
518518
debug!{"read_enum_variant_arg(idx=%u)", idx};
519519
f()
520520
}
521521

522-
fn read_vec<T:copy>(f: fn(uint) -> T) -> T {
522+
fn read_vec<T>(f: fn(uint) -> T) -> T {
523523
debug!{"read_vec()"};
524524
do self.push_doc(self.next_doc(es_vec)) {
525525
let len = self._next_uint(es_vec_len);
@@ -528,38 +528,38 @@ impl ebml_deserializer: serialization::deserializer {
528528
}
529529
}
530530

531-
fn read_vec_elt<T:copy>(idx: uint, f: fn() -> T) -> T {
531+
fn read_vec_elt<T>(idx: uint, f: fn() -> T) -> T {
532532
debug!{"read_vec_elt(idx=%u)", idx};
533533
self.push_doc(self.next_doc(es_vec_elt), f)
534534
}
535535

536-
fn read_box<T:copy>(f: fn() -> T) -> T {
536+
fn read_box<T>(f: fn() -> T) -> T {
537537
debug!{"read_box()"};
538538
f()
539539
}
540540

541-
fn read_uniq<T:copy>(f: fn() -> T) -> T {
541+
fn read_uniq<T>(f: fn() -> T) -> T {
542542
debug!{"read_uniq()"};
543543
f()
544544
}
545545

546-
fn read_rec<T:copy>(f: fn() -> T) -> T {
546+
fn read_rec<T>(f: fn() -> T) -> T {
547547
debug!{"read_rec()"};
548548
f()
549549
}
550550

551-
fn read_rec_field<T:copy>(f_name: ~str, f_idx: uint, f: fn() -> T) -> T {
551+
fn read_rec_field<T>(f_name: ~str, f_idx: uint, f: fn() -> T) -> T {
552552
debug!{"read_rec_field(%s, idx=%u)", f_name, f_idx};
553553
self._check_label(f_name);
554554
f()
555555
}
556556

557-
fn read_tup<T:copy>(sz: uint, f: fn() -> T) -> T {
557+
fn read_tup<T>(sz: uint, f: fn() -> T) -> T {
558558
debug!{"read_tup(sz=%u)", sz};
559559
f()
560560
}
561561

562-
fn read_tup_elt<T:copy>(idx: uint, f: fn() -> T) -> T {
562+
fn read_tup_elt<T>(idx: uint, f: fn() -> T) -> T {
563563
debug!{"read_tup_elt(idx=%u)", idx};
564564
f()
565565
}

src/libstd/prettyprint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl Writer: serializer {
6363
self.write_str(fmt!{"%?_f32", v});
6464
}
6565

66-
fn emit_str(v: ~str) {
66+
fn emit_str(v: &str) {
6767
self.write_str(fmt!{"%?", v});
6868
}
6969

@@ -127,4 +127,4 @@ impl Writer: serializer {
127127
if idx > 0u { self.write_str(~", "); }
128128
f();
129129
}
130-
}
130+
}

src/libstd/serialization.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ trait serializer {
2323
fn emit_float(v: float);
2424
fn emit_f64(v: f64);
2525
fn emit_f32(v: f32);
26-
fn emit_str(v: ~str);
26+
fn emit_str(v: &str);
2727

2828
// Compound types:
2929
fn emit_enum(name: ~str, f: fn());
@@ -65,17 +65,17 @@ trait deserializer {
6565
fn read_float() -> float;
6666

6767
// Compound types:
68-
fn read_enum<T:copy>(name: ~str, f: fn() -> T) -> T;
69-
fn read_enum_variant<T:copy>(f: fn(uint) -> T) -> T;
70-
fn read_enum_variant_arg<T:copy>(idx: uint, f: fn() -> T) -> T;
71-
fn read_vec<T:copy>(f: fn(uint) -> T) -> T;
72-
fn read_vec_elt<T:copy>(idx: uint, f: fn() -> T) -> T;
73-
fn read_box<T:copy>(f: fn() -> T) -> T;
74-
fn read_uniq<T:copy>(f: fn() -> T) -> T;
75-
fn read_rec<T:copy>(f: fn() -> T) -> T;
76-
fn read_rec_field<T:copy>(f_name: ~str, f_idx: uint, f: fn() -> T) -> T;
77-
fn read_tup<T:copy>(sz: uint, f: fn() -> T) -> T;
78-
fn read_tup_elt<T:copy>(idx: uint, f: fn() -> T) -> T;
68+
fn read_enum<T>(name: ~str, f: fn() -> T) -> T;
69+
fn read_enum_variant<T>(f: fn(uint) -> T) -> T;
70+
fn read_enum_variant_arg<T>(idx: uint, f: fn() -> T) -> T;
71+
fn read_vec<T>(f: fn(uint) -> T) -> T;
72+
fn read_vec_elt<T>(idx: uint, f: fn() -> T) -> T;
73+
fn read_box<T>(f: fn() -> T) -> T;
74+
fn read_uniq<T>(f: fn() -> T) -> T;
75+
fn read_rec<T>(f: fn() -> T) -> T;
76+
fn read_rec_field<T>(f_name: ~str, f_idx: uint, f: fn() -> T) -> T;
77+
fn read_tup<T>(sz: uint, f: fn() -> T) -> T;
78+
fn read_tup_elt<T>(idx: uint, f: fn() -> T) -> T;
7979
}
8080

8181
// ___________________________________________________________________________
@@ -201,7 +201,7 @@ fn deserialize_i64<D: deserializer>(d: D) -> i64 {
201201
d.read_i64()
202202
}
203203

204-
fn serialize_str<S: serializer>(s: S, v: ~str) {
204+
fn serialize_str<S: serializer>(s: S, v: &str) {
205205
s.emit_str(v);
206206
}
207207

0 commit comments

Comments
 (0)