Skip to content

Commit 669fbdd

Browse files
committed
librustc: Add explicit self to IterBytes. r=nmatsakis
1 parent 430583c commit 669fbdd

File tree

13 files changed

+903
-14
lines changed

13 files changed

+903
-14
lines changed

src/libcore/to_bytes.rs

Lines changed: 350 additions & 12 deletions
Large diffs are not rendered by default.

src/librustc/middle/borrowck.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,19 @@ impl root_map_key : cmp::Eq {
483483
}
484484
}
485485

486+
#[cfg(stage0)]
486487
impl root_map_key : to_bytes::IterBytes {
487488
pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
488489
to_bytes::iter_bytes_2(&self.id, &self.derefs, lsb0, f);
489490
}
490491
}
492+
#[cfg(stage1)]
493+
#[cfg(stage2)]
494+
impl root_map_key : to_bytes::IterBytes {
495+
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
496+
to_bytes::iter_bytes_2(&self.id, &self.derefs, lsb0, f);
497+
}
498+
}
491499

492500
fn root_map() -> root_map {
493501
return HashMap();

src/librustc/middle/trans/common.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,7 @@ impl mono_id_ : cmp::Eq {
12261226
pure fn ne(&self, other: &mono_id_) -> bool { !(*self).eq(other) }
12271227
}
12281228
1229+
#[cfg(stage0)]
12291230
impl mono_param_id : to_bytes::IterBytes {
12301231
pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
12311232
match self {
@@ -1239,12 +1240,35 @@ impl mono_param_id : to_bytes::IterBytes {
12391240
}
12401241
}
12411242
}
1243+
#[cfg(stage1)]
1244+
#[cfg(stage2)]
1245+
impl mono_param_id : to_bytes::IterBytes {
1246+
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
1247+
match *self {
1248+
mono_precise(t, mids) =>
1249+
to_bytes::iter_bytes_3(&0u8, &ty::type_id(t), &mids, lsb0, f),
1250+
1251+
mono_any => 1u8.iter_bytes(lsb0, f),
12421252
1253+
mono_repr(ref a, ref b, ref c, ref d) =>
1254+
to_bytes::iter_bytes_5(&2u8, a, b, c, d, lsb0, f)
1255+
}
1256+
}
1257+
}
1258+
1259+
#[cfg(stage0)]
12431260
impl mono_id_ : core::to_bytes::IterBytes {
12441261
pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
12451262
to_bytes::iter_bytes_2(&self.def, &self.params, lsb0, f);
12461263
}
12471264
}
1265+
#[cfg(stage1)]
1266+
#[cfg(stage2)]
1267+
impl mono_id_ : core::to_bytes::IterBytes {
1268+
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
1269+
to_bytes::iter_bytes_2(&self.def, &self.params, lsb0, f);
1270+
}
1271+
}
12481272
12491273
fn umax(cx: block, a: ValueRef, b: ValueRef) -> ValueRef {
12501274
let cond = build::ICmp(cx, lib::llvm::IntULT, a, b);

src/librustc/middle/trans/datum.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,19 @@ impl DatumMode: cmp::Eq {
155155
pure fn ne(&self, other: &DatumMode) -> bool { !(*self).eq(other) }
156156
}
157157

158+
#[cfg(stage0)]
158159
impl DatumMode: to_bytes::IterBytes {
159160
pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) {
160161
(self as uint).iter_bytes(lsb0, f)
161162
}
162163
}
164+
#[cfg(stage1)]
165+
#[cfg(stage2)]
166+
impl DatumMode: to_bytes::IterBytes {
167+
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
168+
(*self as uint).iter_bytes(lsb0, f)
169+
}
170+
}
163171

164172
/// See `Datum Sources` section at the head of this module.
165173
enum DatumSource {

0 commit comments

Comments
 (0)