From d18f7854578e8c2e1d7dce90db6e3b5cf9befba9 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 7 Mar 2013 14:38:38 -0800 Subject: librustc: Replace all uses of `fn()` with `&fn()`. rs=defun --- src/libstd/arc.rs | 16 ++++----- src/libstd/arena.rs | 6 ++-- src/libstd/bitv.rs | 30 ++++++++-------- src/libstd/ebml.rs | 70 ++++++++++++++++++------------------ src/libstd/fun_treemap.rs | 2 +- src/libstd/json.rs | 86 ++++++++++++++++++++++---------------------- src/libstd/list.rs | 8 ++--- src/libstd/md4.rs | 2 +- src/libstd/oldmap.rs | 14 ++++---- src/libstd/prettyprint.rs | 30 ++++++++-------- src/libstd/priority_queue.rs | 2 +- src/libstd/rope.rs | 10 +++--- src/libstd/semver.rs | 2 +- src/libstd/serialize.rs | 64 ++++++++++++++++----------------- src/libstd/smallintmap.rs | 12 +++---- src/libstd/sync.rs | 32 ++++++++--------- src/libstd/treemap.rs | 32 ++++++++--------- src/libstd/workcache.rs | 2 +- 18 files changed, 210 insertions(+), 210 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index e7503f0082c..46e6980be58 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -176,7 +176,7 @@ pub impl MutexARC { * blocked on the mutex) will also fail immediately. */ #[inline(always)] - unsafe fn access(&self, blk: fn(x: &mut T) -> U) -> U { + unsafe fn access(&self, blk: &fn(x: &mut T) -> U) -> U { unsafe { let state = get_shared_mutable_state(&self.x); // Borrowck would complain about this if the function were @@ -301,7 +301,7 @@ pub impl RWARC { * poison the ARC, so subsequent readers and writers will both also fail. */ #[inline(always)] - fn write(&self, blk: fn(x: &mut T) -> U) -> U { + fn write(&self, blk: &fn(x: &mut T) -> U) -> U { unsafe { let state = get_shared_mutable_state(&self.x); do (*borrow_rwlock(state)).write { @@ -313,7 +313,7 @@ pub impl RWARC { } /// As write(), but with a condvar, as sync::rwlock.write_cond(). #[inline(always)] - fn write_cond(&self, blk: fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { + fn write_cond(&self, blk: &fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { unsafe { let state = get_shared_mutable_state(&self.x); do (*borrow_rwlock(state)).write_cond |cond| { @@ -335,7 +335,7 @@ pub impl RWARC { * Failing will unlock the ARC while unwinding. However, unlike all other * access modes, this will not poison the ARC. */ - fn read(&self, blk: fn(x: &T) -> U) -> U { + fn read(&self, blk: &fn(x: &T) -> U) -> U { let state = unsafe { get_shared_immutable_state(&self.x) }; do (&state.lock).read { check_poison(false, state.failed); @@ -360,7 +360,7 @@ pub impl RWARC { * } * ~~~ */ - fn write_downgrade(&self, blk: fn(v: RWWriteMode) -> U) -> U { + fn write_downgrade(&self, blk: &fn(v: RWWriteMode) -> U) -> U { unsafe { let state = get_shared_mutable_state(&self.x); do (*borrow_rwlock(state)).write_downgrade |write_mode| { @@ -408,7 +408,7 @@ pub enum RWReadMode = (&self/T, sync::RWlockReadMode/&self); pub impl RWWriteMode/&self { /// Access the pre-downgrade RWARC in write mode. - fn write(&self, blk: fn(x: &mut T) -> U) -> U { + fn write(&self, blk: &fn(x: &mut T) -> U) -> U { match *self { RWWriteMode((ref data, ref token, _)) => { do token.write { @@ -418,7 +418,7 @@ pub impl RWWriteMode/&self { } } /// Access the pre-downgrade RWARC in write mode with a condvar. - fn write_cond(&self, blk: fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { + fn write_cond(&self, blk: &fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { match *self { RWWriteMode((ref data, ref token, ref poison)) => { do token.write_cond |cond| { @@ -438,7 +438,7 @@ pub impl RWWriteMode/&self { pub impl RWReadMode/&self { /// Access the post-downgrade rwlock in read mode. - fn read(&self, blk: fn(x: &T) -> U) -> U { + fn read(&self, blk: &fn(x: &T) -> U) -> U { match *self { RWReadMode((data, ref token)) => { do token.read { blk(data) } diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index 9ed6d285ce6..695b3d01376 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -201,7 +201,7 @@ pub impl Arena { } #[inline(always)] - fn alloc_pod(&self, op: fn() -> T) -> &self/T { + fn alloc_pod(&self, op: &fn() -> T) -> &self/T { unsafe { let tydesc = sys::get_type_desc::(); let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align); @@ -246,7 +246,7 @@ pub impl Arena { } #[inline(always)] - fn alloc_nonpod(&self, op: fn() -> T) -> &self/T { + fn alloc_nonpod(&self, op: &fn() -> T) -> &self/T { unsafe { let tydesc = sys::get_type_desc::(); let (ty_ptr, ptr) = @@ -268,7 +268,7 @@ pub impl Arena { // The external interface #[inline(always)] - fn alloc(&self, op: fn() -> T) -> &self/T { + fn alloc(&self, op: &fn() -> T) -> &self/T { unsafe { if !rusti::needs_drop::() { self.alloc_pod(op) diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 55ec29d2337..8dbdb83698c 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -33,7 +33,7 @@ pub impl SmallBitv { #[inline(always)] fn bits_op(&mut self, right_bits: uint, nbits: uint, - f: fn(uint, uint) -> uint) -> bool { + f: &fn(uint, uint) -> uint) -> bool { let mask = small_mask(nbits); let old_b: uint = self.bits; let new_b = f(old_b, right_bits); @@ -130,7 +130,7 @@ pub impl BigBitv { #[inline(always)] fn process(&mut self, b: &BigBitv, nbits: uint, - op: fn(uint, uint) -> uint) -> bool { + op: &fn(uint, uint) -> uint) -> bool { let len = b.storage.len(); fail_unless!((self.storage.len() == len)); let mut changed = false; @@ -148,7 +148,7 @@ pub impl BigBitv { } #[inline(always)] - fn each_storage(&mut self, op: fn(v: &mut uint) -> bool) { + fn each_storage(&mut self, op: &fn(v: &mut uint) -> bool) { for uint::range(0, self.storage.len()) |i| { let mut w = self.storage[i]; let b = op(&mut w); @@ -392,7 +392,7 @@ pub impl Bitv { } #[inline(always)] - fn each(&self, f: fn(bool) -> bool) { + fn each(&self, f: &fn(bool) -> bool) { let mut i = 0; while i < self.nbits { if !f(self.get(i)) { break; } @@ -493,7 +493,7 @@ pub impl Bitv { true } - fn ones(&self, f: fn(uint) -> bool) { + fn ones(&self, f: &fn(uint) -> bool) { for uint::range(0, self.nbits) |i| { if self.get(i) { if !f(i) { break } @@ -546,7 +546,7 @@ pub fn from_bools(bools: &[bool]) -> Bitv { * Create a bitv of the specified length where the value at each * index is f(index). */ -pub fn from_fn(len: uint, f: fn(index: uint) -> bool) -> Bitv { +pub fn from_fn(len: uint, f: &fn(index: uint) -> bool) -> Bitv { let mut bitv = Bitv::new(len, false); for uint::range(0, len) |i| { bitv.set(i, f(i)); @@ -561,7 +561,7 @@ impl ops::Index for Bitv { } #[inline(always)] -pure fn iterate_bits(base: uint, bits: uint, f: fn(uint) -> bool) -> bool { +pure fn iterate_bits(base: uint, bits: uint, f: &fn(uint) -> bool) -> bool { if bits == 0 { return true; } @@ -622,7 +622,7 @@ pub impl BitvSet { } #[inline(always)] - priv fn other_op(&mut self, other: &BitvSet, f: fn(uint, uint) -> uint) { + priv fn other_op(&mut self, other: &BitvSet, f: &fn(uint, uint) -> uint) { fn nbits(mut w: uint) -> uint { let mut bits = 0; for uint::bits.times { @@ -669,7 +669,7 @@ pub impl BitvSet { impl BaseIter for BitvSet { pure fn size_hint(&self) -> Option { Some(self.len()) } - pure fn each(&self, blk: fn(v: &uint) -> bool) { + pure fn each(&self, blk: &fn(v: &uint) -> bool) { for self.bitv.storage.eachi |i, &w| { if !iterate_bits(i * uint::bits, w, |b| blk(&b)) { return; @@ -778,7 +778,7 @@ impl Set for BitvSet { other.is_subset(self) } - pure fn difference(&self, other: &BitvSet, f: fn(&uint) -> bool) { + pure fn difference(&self, other: &BitvSet, f: &fn(&uint) -> bool) { for self.each_common(other) |i, w1, w2| { if !iterate_bits(i, w1 & !w2, |b| f(&b)) { return; @@ -791,7 +791,7 @@ impl Set for BitvSet { } pure fn symmetric_difference(&self, other: &BitvSet, - f: fn(&uint) -> bool) { + f: &fn(&uint) -> bool) { for self.each_common(other) |i, w1, w2| { if !iterate_bits(i, w1 ^ w2, |b| f(&b)) { return; @@ -802,7 +802,7 @@ impl Set for BitvSet { ); } - pure fn intersection(&self, other: &BitvSet, f: fn(&uint) -> bool) { + pure fn intersection(&self, other: &BitvSet, f: &fn(&uint) -> bool) { for self.each_common(other) |i, w1, w2| { if !iterate_bits(i, w1 & w2, |b| f(&b)) { return; @@ -810,7 +810,7 @@ impl Set for BitvSet { } } - pure fn union(&self, other: &BitvSet, f: fn(&uint) -> bool) { + pure fn union(&self, other: &BitvSet, f: &fn(&uint) -> bool) { for self.each_common(other) |i, w1, w2| { if !iterate_bits(i, w1 | w2, |b| f(&b)) { return; @@ -828,7 +828,7 @@ priv impl BitvSet { /// w1, w2) where the bit location is the number of bits offset so far, /// and w1/w2 are the words coming from the two vectors self, other. pure fn each_common(&self, other: &BitvSet, - f: fn(uint, uint, uint) -> bool) { + f: &fn(uint, uint, uint) -> bool) { let min = uint::min(self.bitv.storage.len(), other.bitv.storage.len()); for self.bitv.storage.view(0, min).eachi |i, &w| { @@ -846,7 +846,7 @@ priv impl BitvSet { /// is true if the word comes from 'self', and false if it comes from /// 'other'. pure fn each_outlier(&self, other: &BitvSet, - f: fn(bool, uint, uint) -> bool) { + f: &fn(bool, uint, uint) -> bool) { let len1 = self.bitv.storage.len(); let len2 = other.bitv.storage.len(); let min = uint::min(len1, len2); diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 44461ae06ff..a55d4bc97ec 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -142,7 +142,7 @@ pub mod reader { } } - pub fn docs(d: Doc, it: fn(uint, Doc) -> bool) { + pub fn docs(d: Doc, it: &fn(uint, Doc) -> bool) { let mut pos = d.start; while pos < d.end { let elt_tag = vuint_at(*d.data, pos); @@ -155,7 +155,7 @@ pub mod reader { } } - pub fn tagged_docs(d: Doc, tg: uint, it: fn(Doc) -> bool) { + pub fn tagged_docs(d: Doc, tg: uint, it: &fn(Doc) -> bool) { let mut pos = d.start; while pos < d.end { let elt_tag = vuint_at(*d.data, pos); @@ -175,7 +175,7 @@ pub mod reader { vec::slice::(*d.data, d.start, d.end).to_vec() } - pub fn with_doc_data(d: Doc, f: fn(x: &[u8]) -> T) -> T { + pub fn with_doc_data(d: Doc, f: &fn(x: &[u8]) -> T) -> T { f(vec::slice(*d.data, d.start, d.end)) } @@ -255,7 +255,7 @@ pub mod reader { r_doc } - fn push_doc(&self, d: Doc, f: fn() -> T) -> T { + fn push_doc(&self, d: Doc, f: &fn() -> T) -> T { let old_parent = self.parent; let old_pos = self.pos; self.parent = d; @@ -274,7 +274,7 @@ pub mod reader { } pub impl Decoder { - fn read_opaque(&self, op: fn(Doc) -> R) -> R { + fn read_opaque(&self, op: &fn(Doc) -> R) -> R { do self.push_doc(self.next_doc(EsOpaque)) { op(copy self.parent) } @@ -321,23 +321,23 @@ pub mod reader { fn read_managed_str(&self) -> @str { fail!(~"read_managed_str()"); } // Compound types: - fn read_owned(&self, f: fn() -> T) -> T { + fn read_owned(&self, f: &fn() -> T) -> T { debug!("read_owned()"); f() } - fn read_managed(&self, f: fn() -> T) -> T { + fn read_managed(&self, f: &fn() -> T) -> T { debug!("read_managed()"); f() } - fn read_enum(&self, name: &str, f: fn() -> T) -> T { + fn read_enum(&self, name: &str, f: &fn() -> T) -> T { debug!("read_enum(%s)", name); self._check_label(name); self.push_doc(self.next_doc(EsEnum), f) } - fn read_enum_variant(&self, f: fn(uint) -> T) -> T { + fn read_enum_variant(&self, f: &fn(uint) -> T) -> T { debug!("read_enum_variant()"); let idx = self._next_uint(EsEnumVid); debug!(" idx=%u", idx); @@ -346,12 +346,12 @@ pub mod reader { } } - fn read_enum_variant_arg(&self, idx: uint, f: fn() -> T) -> T { + fn read_enum_variant_arg(&self, idx: uint, f: &fn() -> T) -> T { debug!("read_enum_variant_arg(idx=%u)", idx); f() } - fn read_owned_vec(&self, f: fn(uint) -> T) -> T { + fn read_owned_vec(&self, f: &fn(uint) -> T) -> T { debug!("read_owned_vec()"); do self.push_doc(self.next_doc(EsVec)) { let len = self._next_uint(EsVecLen); @@ -360,7 +360,7 @@ pub mod reader { } } - fn read_managed_vec(&self, f: fn(uint) -> T) -> T { + fn read_managed_vec(&self, f: &fn(uint) -> T) -> T { debug!("read_managed_vec()"); do self.push_doc(self.next_doc(EsVec)) { let len = self._next_uint(EsVecLen); @@ -369,33 +369,33 @@ pub mod reader { } } - fn read_vec_elt(&self, idx: uint, f: fn() -> T) -> T { + fn read_vec_elt(&self, idx: uint, f: &fn() -> T) -> T { debug!("read_vec_elt(idx=%u)", idx); self.push_doc(self.next_doc(EsVecElt), f) } - fn read_rec(&self, f: fn() -> T) -> T { + fn read_rec(&self, f: &fn() -> T) -> T { debug!("read_rec()"); f() } - fn read_struct(&self, name: &str, _len: uint, f: fn() -> T) -> T { + fn read_struct(&self, name: &str, _len: uint, f: &fn() -> T) -> T { debug!("read_struct(name=%s)", name); f() } - fn read_field(&self, name: &str, idx: uint, f: fn() -> T) -> T { + fn read_field(&self, name: &str, idx: uint, f: &fn() -> T) -> T { debug!("read_field(name=%s, idx=%u)", name, idx); self._check_label(name); f() } - fn read_tup(&self, len: uint, f: fn() -> T) -> T { + fn read_tup(&self, len: uint, f: &fn() -> T) -> T { debug!("read_tup(len=%u)", len); f() } - fn read_tup_elt(&self, idx: uint, f: fn() -> T) -> T { + fn read_tup_elt(&self, idx: uint, f: &fn() -> T) -> T { debug!("read_tup_elt(idx=%u)", idx); f() } @@ -469,7 +469,7 @@ pub mod writer { debug!("End tag (size = %u)", size); } - fn wr_tag(&self, tag_id: uint, blk: fn()) { + fn wr_tag(&self, tag_id: uint, blk: &fn()) { self.start_tag(tag_id); blk(); self.end_tag(); @@ -566,7 +566,7 @@ pub mod writer { } pub impl Encoder { - fn emit_opaque(&self, f: fn()) { + fn emit_opaque(&self, f: &fn()) { do self.wr_tag(EsOpaque as uint) { f() } @@ -623,49 +623,49 @@ pub mod writer { self.emit_borrowed_str(v) } - fn emit_borrowed(&self, f: fn()) { f() } - fn emit_owned(&self, f: fn()) { f() } - fn emit_managed(&self, f: fn()) { f() } + fn emit_borrowed(&self, f: &fn()) { f() } + fn emit_owned(&self, f: &fn()) { f() } + fn emit_managed(&self, f: &fn()) { f() } - fn emit_enum(&self, name: &str, f: fn()) { + fn emit_enum(&self, name: &str, f: &fn()) { self._emit_label(name); self.wr_tag(EsEnum as uint, f) } fn emit_enum_variant(&self, _v_name: &str, v_id: uint, _cnt: uint, - f: fn()) { + f: &fn()) { self._emit_tagged_uint(EsEnumVid, v_id); self.wr_tag(EsEnumBody as uint, f) } - fn emit_enum_variant_arg(&self, _idx: uint, f: fn()) { f() } + fn emit_enum_variant_arg(&self, _idx: uint, f: &fn()) { f() } - fn emit_borrowed_vec(&self, len: uint, f: fn()) { + fn emit_borrowed_vec(&self, len: uint, f: &fn()) { do self.wr_tag(EsVec as uint) { self._emit_tagged_uint(EsVecLen, len); f() } } - fn emit_owned_vec(&self, len: uint, f: fn()) { + fn emit_owned_vec(&self, len: uint, f: &fn()) { self.emit_borrowed_vec(len, f) } - fn emit_managed_vec(&self, len: uint, f: fn()) { + fn emit_managed_vec(&self, len: uint, f: &fn()) { self.emit_borrowed_vec(len, f) } - fn emit_vec_elt(&self, _idx: uint, f: fn()) { + fn emit_vec_elt(&self, _idx: uint, f: &fn()) { self.wr_tag(EsVecElt as uint, f) } - fn emit_rec(&self, f: fn()) { f() } - fn emit_struct(&self, _name: &str, _len: uint, f: fn()) { f() } - fn emit_field(&self, name: &str, _idx: uint, f: fn()) { + fn emit_rec(&self, f: &fn()) { f() } + fn emit_struct(&self, _name: &str, _len: uint, f: &fn()) { f() } + fn emit_field(&self, name: &str, _idx: uint, f: &fn()) { self._emit_label(name); f() } - fn emit_tup(&self, _len: uint, f: fn()) { f() } - fn emit_tup_elt(&self, _idx: uint, f: fn()) { f() } + fn emit_tup(&self, _len: uint, f: &fn()) { f() } + fn emit_tup_elt(&self, _idx: uint, f: &fn()) { f() } } } diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index 0729987958a..735f86b34ec 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -61,7 +61,7 @@ pub fn find(m: Treemap, k: K) -> Option { } /// Visit all pairs in the map in order. -pub fn traverse(m: Treemap, f: fn(&K, &V)) { +pub fn traverse(m: Treemap, f: &fn(&K, &V)) { match *m { Empty => (), /* diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 9208d415971..8c6a870b98c 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -116,15 +116,15 @@ impl serialize::Encoder for Encoder { fn emit_owned_str(&self, v: &str) { self.emit_borrowed_str(v) } fn emit_managed_str(&self, v: &str) { self.emit_borrowed_str(v) } - fn emit_borrowed(&self, f: fn()) { f() } - fn emit_owned(&self, f: fn()) { f() } - fn emit_managed(&self, f: fn()) { f() } + fn emit_borrowed(&self, f: &fn()) { f() } + fn emit_owned(&self, f: &fn()) { f() } + fn emit_managed(&self, f: &fn()) { f() } - fn emit_enum(&self, _name: &str, f: fn()) { + fn emit_enum(&self, _name: &str, f: &fn()) { f() } - fn emit_enum_variant(&self, name: &str, _id: uint, _cnt: uint, f: fn()) { + fn emit_enum_variant(&self, name: &str, _id: uint, _cnt: uint, f: &fn()) { // encoding of enums is special-cased for Option. Specifically: // Some(34) => 34 // None => null @@ -160,49 +160,49 @@ impl serialize::Encoder for Encoder { } } - fn emit_enum_variant_arg(&self, idx: uint, f: fn()) { + fn emit_enum_variant_arg(&self, idx: uint, f: &fn()) { if (idx != 0) {self.wr.write_char(',');} f(); } - fn emit_borrowed_vec(&self, _len: uint, f: fn()) { + fn emit_borrowed_vec(&self, _len: uint, f: &fn()) { self.wr.write_char('['); f(); self.wr.write_char(']'); } - fn emit_owned_vec(&self, len: uint, f: fn()) { + fn emit_owned_vec(&self, len: uint, f: &fn()) { self.emit_borrowed_vec(len, f) } - fn emit_managed_vec(&self, len: uint, f: fn()) { + fn emit_managed_vec(&self, len: uint, f: &fn()) { self.emit_borrowed_vec(len, f) } - fn emit_vec_elt(&self, idx: uint, f: fn()) { + fn emit_vec_elt(&self, idx: uint, f: &fn()) { if idx != 0 { self.wr.write_char(','); } f() } - fn emit_rec(&self, f: fn()) { + fn emit_rec(&self, f: &fn()) { self.wr.write_char('{'); f(); self.wr.write_char('}'); } - fn emit_struct(&self, _name: &str, _len: uint, f: fn()) { + fn emit_struct(&self, _name: &str, _len: uint, f: &fn()) { self.wr.write_char('{'); f(); self.wr.write_char('}'); } - fn emit_field(&self, name: &str, idx: uint, f: fn()) { + fn emit_field(&self, name: &str, idx: uint, f: &fn()) { if idx != 0 { self.wr.write_char(','); } self.wr.write_str(escape_str(name)); self.wr.write_char(':'); f(); } - fn emit_tup(&self, len: uint, f: fn()) { + fn emit_tup(&self, len: uint, f: &fn()) { self.emit_borrowed_vec(len, f); } - fn emit_tup_elt(&self, idx: uint, f: fn()) { + fn emit_tup_elt(&self, idx: uint, f: &fn()) { self.emit_vec_elt(idx, f) } } @@ -251,39 +251,39 @@ impl serialize::Encoder for PrettyEncoder { fn emit_owned_str(&self, v: &str) { self.emit_borrowed_str(v) } fn emit_managed_str(&self, v: &str) { self.emit_borrowed_str(v) } - fn emit_borrowed(&self, f: fn()) { f() } - fn emit_owned(&self, f: fn()) { f() } - fn emit_managed(&self, f: fn()) { f() } + fn emit_borrowed(&self, f: &fn()) { f() } + fn emit_owned(&self, f: &fn()) { f() } + fn emit_managed(&self, f: &fn()) { f() } - fn emit_enum(&self, name: &str, f: fn()) { + fn emit_enum(&self, name: &str, f: &fn()) { if name != "option" { fail!(~"only supports option enum") } f() } - fn emit_enum_variant(&self, _name: &str, id: uint, _cnt: uint, f: fn()) { + fn emit_enum_variant(&self, _name: &str, id: uint, _cnt: uint, f: &fn()) { if id == 0 { self.emit_nil(); } else { f() } } - fn emit_enum_variant_arg(&self, _idx: uint, f: fn()) { + fn emit_enum_variant_arg(&self, _idx: uint, f: &fn()) { f() } - fn emit_borrowed_vec(&self, _len: uint, f: fn()) { + fn emit_borrowed_vec(&self, _len: uint, f: &fn()) { self.wr.write_char('['); self.indent += 2; f(); self.indent -= 2; self.wr.write_char(']'); } - fn emit_owned_vec(&self, len: uint, f: fn()) { + fn emit_owned_vec(&self, len: uint, f: &fn()) { self.emit_borrowed_vec(len, f) } - fn emit_managed_vec(&self, len: uint, f: fn()) { + fn emit_managed_vec(&self, len: uint, f: &fn()) { self.emit_borrowed_vec(len, f) } - fn emit_vec_elt(&self, idx: uint, f: fn()) { + fn emit_vec_elt(&self, idx: uint, f: &fn()) { if idx == 0 { self.wr.write_char('\n'); } else { @@ -293,17 +293,17 @@ impl serialize::Encoder for PrettyEncoder { f() } - fn emit_rec(&self, f: fn()) { + fn emit_rec(&self, f: &fn()) { self.wr.write_char('{'); self.indent += 2; f(); self.indent -= 2; self.wr.write_char('}'); } - fn emit_struct(&self, _name: &str, _len: uint, f: fn()) { + fn emit_struct(&self, _name: &str, _len: uint, f: &fn()) { self.emit_rec(f) } - fn emit_field(&self, name: &str, idx: uint, f: fn()) { + fn emit_field(&self, name: &str, idx: uint, f: &fn()) { if idx == 0 { self.wr.write_char('\n'); } else { @@ -314,10 +314,10 @@ impl serialize::Encoder for PrettyEncoder { self.wr.write_str(": "); f(); } - fn emit_tup(&self, sz: uint, f: fn()) { + fn emit_tup(&self, sz: uint, f: &fn()) { self.emit_borrowed_vec(sz, f); } - fn emit_tup_elt(&self, idx: uint, f: fn()) { + fn emit_tup_elt(&self, idx: uint, f: &fn()) { self.emit_vec_elt(idx, f) } } @@ -828,23 +828,23 @@ impl serialize::Decoder for Decoder/&self { } } - fn read_owned(&self, f: fn() -> T) -> T { + fn read_owned(&self, f: &fn() -> T) -> T { debug!("read_owned()"); f() } - fn read_managed(&self, f: fn() -> T) -> T { + fn read_managed(&self, f: &fn() -> T) -> T { debug!("read_managed()"); f() } - fn read_enum(&self, name: &str, f: fn() -> T) -> T { + fn read_enum(&self, name: &str, f: &fn() -> T) -> T { debug!("read_enum(%s)", name); if name != ~"option" { fail!(~"only supports the option enum") } f() } - fn read_enum_variant(&self, f: fn(uint) -> T) -> T { + fn read_enum_variant(&self, f: &fn(uint) -> T) -> T { debug!("read_enum_variant()"); let idx = match *self.peek() { Null => 0, @@ -853,13 +853,13 @@ impl serialize::Decoder for Decoder/&self { f(idx) } - fn read_enum_variant_arg(&self, idx: uint, f: fn() -> T) -> T { + fn read_enum_variant_arg(&self, idx: uint, f: &fn() -> T) -> T { debug!("read_enum_variant_arg(idx=%u)", idx); if idx != 0 { fail!(~"unknown index") } f() } - fn read_owned_vec(&self, f: fn(uint) -> T) -> T { + fn read_owned_vec(&self, f: &fn(uint) -> T) -> T { debug!("read_owned_vec()"); let len = match *self.peek() { List(ref list) => list.len(), @@ -870,7 +870,7 @@ impl serialize::Decoder for Decoder/&self { res } - fn read_managed_vec(&self, f: fn(uint) -> T) -> T { + fn read_managed_vec(&self, f: &fn(uint) -> T) -> T { debug!("read_owned_vec()"); let len = match *self.peek() { List(ref list) => list.len(), @@ -881,7 +881,7 @@ impl serialize::Decoder for Decoder/&self { res } - fn read_vec_elt(&self, idx: uint, f: fn() -> T) -> T { + fn read_vec_elt(&self, idx: uint, f: &fn() -> T) -> T { debug!("read_vec_elt(idx=%u)", idx); match *self.peek() { List(ref list) => { @@ -892,21 +892,21 @@ impl serialize::Decoder for Decoder/&self { } } - fn read_rec(&self, f: fn() -> T) -> T { + fn read_rec(&self, f: &fn() -> T) -> T { debug!("read_rec()"); let value = f(); self.pop(); value } - fn read_struct(&self, _name: &str, _len: uint, f: fn() -> T) -> T { + fn read_struct(&self, _name: &str, _len: uint, f: &fn() -> T) -> T { debug!("read_struct()"); let value = f(); self.pop(); value } - fn read_field(&self, name: &str, idx: uint, f: fn() -> T) -> T { + fn read_field(&self, name: &str, idx: uint, f: &fn() -> T) -> T { debug!("read_rec_field(%s, idx=%u)", name, idx); let top = self.peek(); match *top { @@ -929,14 +929,14 @@ impl serialize::Decoder for Decoder/&self { } } - fn read_tup(&self, len: uint, f: fn() -> T) -> T { + fn read_tup(&self, len: uint, f: &fn() -> T) -> T { debug!("read_tup(len=%u)", len); let value = f(); self.pop(); value } - fn read_tup_elt(&self, idx: uint, f: fn() -> T) -> T { + fn read_tup_elt(&self, idx: uint, f: &fn() -> T) -> T { debug!("read_tup_elt(idx=%u)", idx); match *self.peek() { List(ref list) => { diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 5ab1722ae83..3a0f299257e 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -39,7 +39,7 @@ pub pure fn from_vec(v: &[T]) -> @List { * * z - The initial value * * f - The function to apply */ -pub fn foldl(z: T, ls: @List, f: fn(&T, &U) -> T) -> T { +pub fn foldl(z: T, ls: @List, f: &fn(&T, &U) -> T) -> T { let mut accum: T = z; do iter(ls) |elt| { accum = f(&accum, elt);} accum @@ -52,7 +52,7 @@ pub fn foldl(z: T, ls: @List, f: fn(&T, &U) -> T) -> T { * When function `f` returns true then an option containing the element * is returned. If `f` matches no elements then none is returned. */ -pub pure fn find(ls: @List, f: fn(&T) -> bool) -> Option { +pub pure fn find(ls: @List, f: &fn(&T) -> bool) -> Option { let mut ls = ls; loop { ls = match *ls { @@ -125,7 +125,7 @@ pure fn push(ll: &mut @list, vv: T) { */ /// Iterate over a list -pub pure fn iter(l: @List, f: fn(&T)) { +pub pure fn iter(l: @List, f: &fn(&T)) { let mut cur = l; loop { cur = match *cur { @@ -139,7 +139,7 @@ pub pure fn iter(l: @List, f: fn(&T)) { } /// Iterate over a list -pub pure fn each(l: @List, f: fn(&T) -> bool) { +pub pure fn each(l: @List, f: &fn(&T) -> bool) { let mut cur = l; loop { cur = match *cur { diff --git a/src/libstd/md4.rs b/src/libstd/md4.rs index eb4bd6fe23f..df254543512 100644 --- a/src/libstd/md4.rs +++ b/src/libstd/md4.rs @@ -105,7 +105,7 @@ pub pure fn md4(msg: &[u8]) -> Quad { pub pure fn md4_str(msg: &[u8]) -> ~str { let Quad {a, b, c, d} = md4(msg); - pure fn app(a: u32, b: u32, c: u32, d: u32, f: fn(u32)) { + pure fn app(a: u32, b: u32, c: u32, d: u32, f: &fn(u32)) { f(a); f(b); f(c); f(d); } let mut result = ~""; diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs index 0f6434f1b2b..18527cfece1 100644 --- a/src/libstd/oldmap.rs +++ b/src/libstd/oldmap.rs @@ -134,7 +134,7 @@ pub mod chained { } pub impl T { - pure fn each_entry(&self, blk: fn(@Entry) -> bool) { + pure fn each_entry(&self, blk: &fn(@Entry) -> bool) { // n.b. we can't use vec::iter() here because self.chains // is stored in a mutable location. let mut i = 0u, n = self.chains.len(); @@ -236,17 +236,17 @@ pub mod chained { } } - pure fn each(&self, blk: fn(key: &K, value: &V) -> bool) { + pure fn each(&self, blk: &fn(key: &K, value: &V) -> bool) { for self.each_entry |entry| { if !blk(&entry.key, &entry.value) { break; } } } - pure fn each_key(&self, blk: fn(key: &K) -> bool) { + pure fn each_key(&self, blk: &fn(key: &K) -> bool) { self.each(|k, _v| blk(k)) } - pure fn each_value(&self, blk: fn(value: &V) -> bool) { + pure fn each_value(&self, blk: &fn(value: &V) -> bool) { self.each(|_k, v| blk(v)) } } @@ -260,8 +260,8 @@ pub mod chained { } } - fn update_with_key(&self, key: K, newval: V, ff: fn(K, V, V) -> V) - -> bool { + fn update_with_key(&self, key: K, newval: V, ff: &fn(K, V, V) -> V) + -> bool { /* match self.find(key) { None => return self.insert(key, val), @@ -312,7 +312,7 @@ pub mod chained { } } - fn update(&self, key: K, newval: V, ff: fn(V, V) -> V) -> bool { + fn update(&self, key: K, newval: V, ff: &fn(V, V) -> V) -> bool { return self.update_with_key(key, newval, |_k, v, v1| ff(v,v1)); } diff --git a/src/libstd/prettyprint.rs b/src/libstd/prettyprint.rs index ed02ea87dac..d2d80eb7da8 100644 --- a/src/libstd/prettyprint.rs +++ b/src/libstd/prettyprint.rs @@ -98,87 +98,87 @@ impl serialize::Encoder for Serializer { self.wr.write_str(fmt!("@%?", v)); } - fn emit_borrowed(&self, f: fn()) { + fn emit_borrowed(&self, f: &fn()) { self.wr.write_str(~"&"); f(); } - fn emit_owned(&self, f: fn()) { + fn emit_owned(&self, f: &fn()) { self.wr.write_str(~"~"); f(); } - fn emit_managed(&self, f: fn()) { + fn emit_managed(&self, f: &fn()) { self.wr.write_str(~"@"); f(); } - fn emit_enum(&self, _name: &str, f: fn()) { + fn emit_enum(&self, _name: &str, f: &fn()) { f(); } fn emit_enum_variant(&self, v_name: &str, _v_id: uint, sz: uint, - f: fn()) { + f: &fn()) { self.wr.write_str(v_name); if sz > 0u { self.wr.write_str(~"("); } f(); if sz > 0u { self.wr.write_str(~")"); } } - fn emit_enum_variant_arg(&self, idx: uint, f: fn()) { + fn emit_enum_variant_arg(&self, idx: uint, f: &fn()) { if idx > 0u { self.wr.write_str(~", "); } f(); } - fn emit_borrowed_vec(&self, _len: uint, f: fn()) { + fn emit_borrowed_vec(&self, _len: uint, f: &fn()) { self.wr.write_str(~"&["); f(); self.wr.write_str(~"]"); } - fn emit_owned_vec(&self, _len: uint, f: fn()) { + fn emit_owned_vec(&self, _len: uint, f: &fn()) { self.wr.write_str(~"~["); f(); self.wr.write_str(~"]"); } - fn emit_managed_vec(&self, _len: uint, f: fn()) { + fn emit_managed_vec(&self, _len: uint, f: &fn()) { self.wr.write_str(~"@["); f(); self.wr.write_str(~"]"); } - fn emit_vec_elt(&self, idx: uint, f: fn()) { + fn emit_vec_elt(&self, idx: uint, f: &fn()) { if idx > 0u { self.wr.write_str(~", "); } f(); } - fn emit_rec(&self, f: fn()) { + fn emit_rec(&self, f: &fn()) { self.wr.write_str(~"{"); f(); self.wr.write_str(~"}"); } - fn emit_struct(&self, name: &str, _len: uint, f: fn()) { + fn emit_struct(&self, name: &str, _len: uint, f: &fn()) { self.wr.write_str(fmt!("%s {", name)); f(); self.wr.write_str(~"}"); } - fn emit_field(&self, name: &str, idx: uint, f: fn()) { + fn emit_field(&self, name: &str, idx: uint, f: &fn()) { if idx > 0u { self.wr.write_str(~", "); } self.wr.write_str(name); self.wr.write_str(~": "); f(); } - fn emit_tup(&self, _len: uint, f: fn()) { + fn emit_tup(&self, _len: uint, f: &fn()) { self.wr.write_str(~"("); f(); self.wr.write_str(~")"); } - fn emit_tup_elt(&self, idx: uint, f: fn()) { + fn emit_tup_elt(&self, idx: uint, f: &fn()) { if idx > 0u { self.wr.write_str(~", "); } f(); } diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs index 676bc68e4e5..31f29ce23f2 100644 --- a/src/libstd/priority_queue.rs +++ b/src/libstd/priority_queue.rs @@ -31,7 +31,7 @@ impl BaseIter for PriorityQueue { /// Visit all values in the underlying vector. /// /// The values are **not** visited in order. - pure fn each(&self, f: fn(&T) -> bool) { self.data.each(f) } + pure fn each(&self, f: &fn(&T) -> bool) { self.data.each(f) } pure fn size_hint(&self) -> Option { self.data.size_hint() } } diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index d511ac9744e..dd2f5b58fb9 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -393,7 +393,7 @@ Section: Iterating * `true` If execution proceeded correctly, `false` if it was interrupted, * that is if `it` returned `false` at any point. */ -pub fn loop_chars(rope: Rope, it: fn(c: char) -> bool) -> bool { +pub fn loop_chars(rope: Rope, it: &fn(c: char) -> bool) -> bool { match (rope) { node::Empty => return true, node::Content(x) => return node::loop_chars(x, it) @@ -407,7 +407,7 @@ pub fn loop_chars(rope: Rope, it: fn(c: char) -> bool) -> bool { * * rope - A rope to traverse. It may be empty * * it - A block to execute with each consecutive character of the rope. */ -pub fn iter_chars(rope: Rope, it: fn(char)) { +pub fn iter_chars(rope: Rope, it: &fn(char)) { do loop_chars(rope) |x| { it(x); true @@ -436,7 +436,7 @@ pub fn iter_chars(rope: Rope, it: fn(char)) { * `true` If execution proceeded correctly, `false` if it was interrupted, * that is if `it` returned `false` at any point. */ -pub fn loop_leaves(rope: Rope, it: fn(node::Leaf) -> bool) -> bool{ +pub fn loop_leaves(rope: Rope, it: &fn(node::Leaf) -> bool) -> bool{ match (rope) { node::Empty => return true, node::Content(x) => return node::loop_leaves(x, it) @@ -1078,7 +1078,7 @@ pub mod node { return result; } - pub fn loop_chars(node: @Node, it: fn(c: char) -> bool) -> bool { + pub fn loop_chars(node: @Node, it: &fn(c: char) -> bool) -> bool { return loop_leaves(node,|leaf| { str::all_between(*leaf.content, leaf.byte_offset, @@ -1100,7 +1100,7 @@ pub mod node { * `true` If execution proceeded correctly, `false` if it was interrupted, * that is if `it` returned `false` at any point. */ - pub fn loop_leaves(node: @Node, it: fn(Leaf) -> bool) -> bool{ + pub fn loop_leaves(node: @Node, it: &fn(Leaf) -> bool) -> bool{ let mut current = node; loop { match (*current) { diff --git a/src/libstd/semver.rs b/src/libstd/semver.rs index bf4091e1e90..7b8a06f1b93 100644 --- a/src/libstd/semver.rs +++ b/src/libstd/semver.rs @@ -140,7 +140,7 @@ condition! { fn take_nonempty_prefix(rdr: io::Reader, ch: char, - pred: fn(char) -> bool) -> (~str, char) { + pred: &fn(char) -> bool) -> (~str, char) { let mut buf = ~""; let mut ch = ch; while pred(ch) { diff --git a/src/libstd/serialize.rs b/src/libstd/serialize.rs index 5bbd926ba6b..0288155d29e 100644 --- a/src/libstd/serialize.rs +++ b/src/libstd/serialize.rs @@ -43,25 +43,25 @@ pub trait Encoder { fn emit_managed_str(&self, v: &str); // Compound types: - fn emit_borrowed(&self, f: fn()); - fn emit_owned(&self, f: fn()); - fn emit_managed(&self, f: fn()); + fn emit_borrowed(&self, f: &fn()); + fn emit_owned(&self, f: &fn()); + fn emit_managed(&self, f: &fn()); - fn emit_enum(&self, name: &str, f: fn()); - fn emit_enum_variant(&self, v_name: &str, v_id: uint, sz: uint, f: fn()); - fn emit_enum_variant_arg(&self, idx: uint, f: fn()); + fn emit_enum(&self, name: &str, f: &fn()); + fn emit_enum_variant(&self, v_name: &str, v_id: uint, sz: uint, f: &fn()); + fn emit_enum_variant_arg(&self, idx: uint, f: &fn()); - fn emit_borrowed_vec(&self, len: uint, f: fn()); - fn emit_owned_vec(&self, len: uint, f: fn()); - fn emit_managed_vec(&self, len: uint, f: fn()); - fn emit_vec_elt(&self, idx: uint, f: fn()); + fn emit_borrowed_vec(&self, len: uint, f: &fn()); + fn emit_owned_vec(&self, len: uint, f: &fn()); + fn emit_managed_vec(&self, len: uint, f: &fn()); + fn emit_vec_elt(&self, idx: uint, f: &fn()); - fn emit_rec(&self, f: fn()); - fn emit_struct(&self, name: &str, _len: uint, f: fn()); - fn emit_field(&self, f_name: &str, f_idx: uint, f: fn()); + fn emit_rec(&self, f: &fn()); + fn emit_struct(&self, name: &str, _len: uint, f: &fn()); + fn emit_field(&self, f_name: &str, f_idx: uint, f: &fn()); - fn emit_tup(&self, len: uint, f: fn()); - fn emit_tup_elt(&self, idx: uint, f: fn()); + fn emit_tup(&self, len: uint, f: &fn()); + fn emit_tup_elt(&self, idx: uint, f: &fn()); } pub trait Decoder { @@ -86,23 +86,23 @@ pub trait Decoder { fn read_managed_str(&self) -> @str; // Compound types: - fn read_enum(&self, name: &str, f: fn() -> T) -> T; - fn read_enum_variant(&self, f: fn(uint) -> T) -> T; - fn read_enum_variant_arg(&self, idx: uint, f: fn() -> T) -> T; + fn read_enum(&self, name: &str, f: &fn() -> T) -> T; + fn read_enum_variant(&self, f: &fn(uint) -> T) -> T; + fn read_enum_variant_arg(&self, idx: uint, f: &fn() -> T) -> T; - fn read_owned(&self, f: fn() -> T) -> T; - fn read_managed(&self, f: fn() -> T) -> T; + fn read_owned(&self, f: &fn() -> T) -> T; + fn read_managed(&self, f: &fn() -> T) -> T; - fn read_owned_vec(&self, f: fn(uint) -> T) -> T; - fn read_managed_vec(&self, f: fn(uint) -> T) -> T; - fn read_vec_elt(&self, idx: uint, f: fn() -> T) -> T; + fn read_owned_vec(&self, f: &fn(uint) -> T) -> T; + fn read_managed_vec(&self, f: &fn(uint) -> T) -> T; + fn read_vec_elt(&self, idx: uint, f: &fn() -> T) -> T; - fn read_rec(&self, f: fn() -> T) -> T; - fn read_struct(&self, name: &str, _len: uint, f: fn() -> T) -> T; - fn read_field(&self, name: &str, idx: uint, f: fn() -> T) -> T; + fn read_rec(&self, f: &fn() -> T) -> T; + fn read_struct(&self, name: &str, _len: uint, f: &fn() -> T) -> T; + fn read_field(&self, name: &str, idx: uint, f: &fn() -> T) -> T; - fn read_tup(&self, sz: uint, f: fn() -> T) -> T; - fn read_tup_elt(&self, idx: uint, f: fn() -> T) -> T; + fn read_tup(&self, sz: uint, f: &fn() -> T) -> T; + fn read_tup_elt(&self, idx: uint, f: &fn() -> T) -> T; } pub trait Encodable { @@ -547,11 +547,11 @@ impl< // In some cases, these should eventually be coded as traits. pub trait EncoderHelpers { - fn emit_from_vec(&self, v: &[T], f: fn(v: &T)); + fn emit_from_vec(&self, v: &[T], f: &fn(v: &T)); } impl EncoderHelpers for S { - fn emit_from_vec(&self, v: &[T], f: fn(v: &T)) { + fn emit_from_vec(&self, v: &[T], f: &fn(v: &T)) { do self.emit_owned_vec(v.len()) { for v.eachi |i, e| { do self.emit_vec_elt(i) { @@ -563,11 +563,11 @@ impl EncoderHelpers for S { } pub trait DecoderHelpers { - fn read_to_vec(&self, f: fn() -> T) -> ~[T]; + fn read_to_vec(&self, f: &fn() -> T) -> ~[T]; } impl DecoderHelpers for D { - fn read_to_vec(&self, f: fn() -> T) -> ~[T] { + fn read_to_vec(&self, f: &fn() -> T) -> ~[T] { do self.read_owned_vec |len| { do vec::from_fn(len) |i| { self.read_vec_elt(i, || f()) diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 84600ac74ee..726e7c36abd 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -24,7 +24,7 @@ pub struct SmallIntMap { impl BaseIter<(uint, &self/V)> for SmallIntMap { /// Visit all key-value pairs in order - pure fn each(&self, it: fn(&(uint, &self/V)) -> bool) { + pure fn each(&self, it: &fn(&(uint, &self/V)) -> bool) { for uint::range(0, self.v.len()) |i| { match self.v[i] { Some(ref elt) => if !it(&(i, elt)) { break }, @@ -38,7 +38,7 @@ impl BaseIter<(uint, &self/V)> for SmallIntMap { impl ReverseIter<(uint, &self/V)> for SmallIntMap { /// Visit all key-value pairs in reverse order - pure fn each_reverse(&self, it: fn(&(uint, &self/V)) -> bool) { + pure fn each_reverse(&self, it: &fn(&(uint, &self/V)) -> bool) { for uint::range_rev(self.v.len(), 0) |i| { match self.v[i - 1] { Some(ref elt) => if !it(&(i - 1, elt)) { break }, @@ -76,12 +76,12 @@ impl Map for SmallIntMap { } /// Visit all keys in order - pure fn each_key(&self, blk: fn(key: &uint) -> bool) { + pure fn each_key(&self, blk: &fn(key: &uint) -> bool) { self.each(|&(k, _)| blk(&k)) } /// Visit all values in order - pure fn each_value(&self, blk: fn(value: &V) -> bool) { + pure fn each_value(&self, blk: &fn(value: &V) -> bool) { self.each(|&(_, v)| blk(v)) } @@ -133,7 +133,7 @@ pub impl SmallIntMap { pub impl SmallIntMap { fn update_with_key(&mut self, key: uint, val: V, - ff: fn(uint, V, V) -> V) -> bool { + ff: &fn(uint, V, V) -> V) -> bool { let new_val = match self.find(&key) { None => val, Some(orig) => ff(key, *orig, val) @@ -141,7 +141,7 @@ pub impl SmallIntMap { self.insert(key, new_val) } - fn update(&mut self, key: uint, newval: V, ff: fn(V, V) -> V) -> bool { + fn update(&mut self, key: uint, newval: V, ff: &fn(V, V) -> V) -> bool { self.update_with_key(key, newval, |_k, v, v1| ff(v,v1)) } } diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index d143c665d83..a68fe5f10a3 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -135,7 +135,7 @@ pub impl &self/Sem { // FIXME(#3154) move both copies of this into Sem, and unify the 2 structs #[doc(hidden)] pub impl &self/Sem<()> { - fn access(&self, blk: fn() -> U) -> U { + fn access(&self, blk: &fn() -> U) -> U { let mut release = None; unsafe { do task::unkillable { @@ -148,7 +148,7 @@ pub impl &self/Sem<()> { } #[doc(hidden)] pub impl &self/Sem<~[Waitqueue]> { - fn access(&self, blk: fn() -> U) -> U { + fn access(&self, blk: &fn() -> U) -> U { let mut release = None; unsafe { do task::unkillable { @@ -332,7 +332,7 @@ pub impl Condvar/&self { #[inline(always)] #[doc(hidden)] fn check_cvar_bounds(out_of_bounds: Option, id: uint, act: &str, - blk: fn() -> U) -> U { + blk: &fn() -> U) -> U { match out_of_bounds { Some(0) => fail!(fmt!("%s with illegal ID %u - this lock has no condvars!", @@ -347,7 +347,7 @@ fn check_cvar_bounds(out_of_bounds: Option, id: uint, act: &str, #[doc(hidden)] pub impl Sem<~[Waitqueue]> { // The only other place that condvars get built is rwlock_write_mode. - fn access_cond(&self, blk: fn(c: &Condvar) -> U) -> U { + fn access_cond(&self, blk: &fn(c: &Condvar) -> U) -> U { do self.access { blk(&Condvar { sem: self }) } } } @@ -385,7 +385,7 @@ pub impl Semaphore { fn release(&self) { (&self.sem).release() } /// Run a function with ownership of one of the semaphore's resources. - fn access(&self, blk: fn() -> U) -> U { (&self.sem).access(blk) } + fn access(&self, blk: &fn() -> U) -> U { (&self.sem).access(blk) } } /**************************************************************************** @@ -421,10 +421,10 @@ impl Clone for Mutex { pub impl Mutex { /// Run a function with ownership of the mutex. - fn lock(&self, blk: fn() -> U) -> U { (&self.sem).access(blk) } + fn lock(&self, blk: &fn() -> U) -> U { (&self.sem).access(blk) } /// Run a function with ownership of the mutex and a handle to a condvar. - fn lock_cond(&self, blk: fn(c: &Condvar) -> U) -> U { + fn lock_cond(&self, blk: &fn(c: &Condvar) -> U) -> U { (&self.sem).access_cond(blk) } } @@ -480,7 +480,7 @@ pub impl RWlock { * Run a function with the rwlock in read mode. Calls to 'read' from other * tasks may run concurrently with this one. */ - fn read(&self, blk: fn() -> U) -> U { + fn read(&self, blk: &fn() -> U) -> U { let mut release = None; unsafe { do task::unkillable { @@ -511,7 +511,7 @@ pub impl RWlock { * Run a function with the rwlock in write mode. No calls to 'read' or * 'write' from other tasks will run concurrently with this one. */ - fn write(&self, blk: fn() -> U) -> U { + fn write(&self, blk: &fn() -> U) -> U { unsafe { do task::unkillable { (&self.order_lock).acquire(); @@ -529,7 +529,7 @@ pub impl RWlock { * the waiting task is signalled. (Note: a writer that waited and then * was signalled might reacquire the lock before other waiting writers.) */ - fn write_cond(&self, blk: fn(c: &Condvar) -> U) -> U { + fn write_cond(&self, blk: &fn(c: &Condvar) -> U) -> U { // NB: You might think I should thread the order_lock into the cond // wait call, so that it gets waited on before access_lock gets // reacquired upon being woken up. However, (a) this would be not @@ -564,7 +564,7 @@ pub impl RWlock { * } * ~~~ */ - fn write_downgrade(&self, blk: fn(v: RWlockWriteMode) -> U) -> U { + fn write_downgrade(&self, blk: &fn(v: RWlockWriteMode) -> U) -> U { // Implementation slightly different from the slicker 'write's above. // The exit path is conditional on whether the caller downgrades. let mut _release = None; @@ -692,16 +692,16 @@ impl Drop for RWlockReadMode/&self { fn finalize(&self) {} } pub impl RWlockWriteMode/&self { /// Access the pre-downgrade rwlock in write mode. - fn write(&self, blk: fn() -> U) -> U { blk() } + fn write(&self, blk: &fn() -> U) -> U { blk() } /// Access the pre-downgrade rwlock in write mode with a condvar. - fn write_cond(&self, blk: fn(c: &Condvar) -> U) -> U { + fn write_cond(&self, blk: &fn(c: &Condvar) -> U) -> U { blk(&Condvar { sem: &self.lock.access_lock }) } } pub impl RWlockReadMode/&self { /// Access the post-downgrade rwlock in read mode. - fn read(&self, blk: fn() -> U) -> U { blk() } + fn read(&self, blk: &fn() -> U) -> U { blk() } } /**************************************************************************** @@ -1082,7 +1082,7 @@ mod tests { #[cfg(test)] pub enum RWlockMode { Read, Write, Downgrade, DowngradeRead } #[cfg(test)] - pub fn lock_rwlock_in_mode(x: &RWlock, mode: RWlockMode, blk: fn()) { + pub fn lock_rwlock_in_mode(x: &RWlock, mode: RWlockMode, blk: &fn()) { match mode { Read => x.read(blk), Write => x.write(blk), @@ -1239,7 +1239,7 @@ mod tests { dg1: bool, dg2: bool) { // Much like the mutex broadcast test. Downgrade-enabled. - fn lock_cond(x: &RWlock, downgrade: bool, blk: fn(c: &Condvar)) { + fn lock_cond(x: &RWlock, downgrade: bool, blk: &fn(c: &Condvar)) { if downgrade { do x.write_downgrade |mode| { (&mode).write_cond(blk) diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index f06f64dde01..f053bcfd397 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -96,7 +96,7 @@ impl Ord for TreeMap { impl<'self, K: TotalOrd, V> BaseIter<(&'self K, &'self V)> for TreeMap { /// Visit all key-value pairs in order - pure fn each(&self, f: fn(&(&self/K, &self/V)) -> bool) { + pure fn each(&self, f: &fn(&(&self/K, &self/V)) -> bool) { each(&self.root, f) } pure fn size_hint(&self) -> Option { Some(self.len()) } @@ -107,7 +107,7 @@ impl<'self, K: TotalOrd, V> for TreeMap { /// Visit all key-value pairs in reverse order - pure fn each_reverse(&self, f: fn(&(&self/K, &self/V)) -> bool) { + pure fn each_reverse(&self, f: &fn(&(&self/K, &self/V)) -> bool) { each_reverse(&self.root, f); } } @@ -135,10 +135,10 @@ impl Map for TreeMap { } /// Visit all keys in order - pure fn each_key(&self, f: fn(&K) -> bool) { self.each(|&(k, _)| f(k)) } + pure fn each_key(&self, f: &fn(&K) -> bool) { self.each(|&(k, _)| f(k)) } /// Visit all values in order - pure fn each_value(&self, f: fn(&V) -> bool) { self.each(|&(_, v)| f(v)) } + pure fn each_value(&self, f: &fn(&V) -> bool) { self.each(|&(_, v)| f(v)) } /// Return the value corresponding to the key in the map pure fn find(&self, key: &K) -> Option<&self/V> { @@ -180,12 +180,12 @@ pub impl TreeMap { static pure fn new() -> TreeMap { TreeMap{root: None, length: 0} } /// Visit all keys in reverse order - pure fn each_key_reverse(&self, f: fn(&K) -> bool) { + pure fn each_key_reverse(&self, f: &fn(&K) -> bool) { self.each_reverse(|&(k, _)| f(k)) } /// Visit all values in reverse order - pure fn each_value_reverse(&self, f: fn(&V) -> bool) { + pure fn each_value_reverse(&self, f: &fn(&V) -> bool) { self.each_reverse(|&(_, v)| f(v)) } @@ -225,7 +225,7 @@ pub fn map_next(iter: &mut TreeMapIterator/&r) /// Advance the iterator through the map pub fn map_advance(iter: &mut TreeMapIterator/&r, - f: fn((&r/K, &r/V)) -> bool) { + f: &fn((&r/K, &r/V)) -> bool) { loop { match map_next(iter) { Some(x) => { @@ -242,13 +242,13 @@ pub struct TreeSet { impl BaseIter for TreeSet { /// Visit all values in order - pure fn each(&self, f: fn(&T) -> bool) { self.map.each_key(f) } + pure fn each(&self, f: &fn(&T) -> bool) { self.map.each_key(f) } pure fn size_hint(&self) -> Option { Some(self.len()) } } impl ReverseIter for TreeSet { /// Visit all values in reverse order - pure fn each_reverse(&self, f: fn(&T) -> bool) { + pure fn each_reverse(&self, f: &fn(&T) -> bool) { self.map.each_key_reverse(f) } } @@ -350,7 +350,7 @@ impl Set for TreeSet { } /// Visit the values (in-order) representing the difference - pure fn difference(&self, other: &TreeSet, f: fn(&T) -> bool) { + pure fn difference(&self, other: &TreeSet, f: &fn(&T) -> bool) { let mut x = self.iter(); let mut y = other.iter(); @@ -383,7 +383,7 @@ impl Set for TreeSet { /// Visit the values (in-order) representing the symmetric difference pure fn symmetric_difference(&self, other: &TreeSet, - f: fn(&T) -> bool) { + f: &fn(&T) -> bool) { let mut x = self.iter(); let mut y = other.iter(); @@ -422,7 +422,7 @@ impl Set for TreeSet { } /// Visit the values (in-order) representing the intersection - pure fn intersection(&self, other: &TreeSet, f: fn(&T) -> bool) { + pure fn intersection(&self, other: &TreeSet, f: &fn(&T) -> bool) { let mut x = self.iter(); let mut y = other.iter(); @@ -449,7 +449,7 @@ impl Set for TreeSet { } /// Visit the values (in-order) representing the union - pure fn union(&self, other: &TreeSet, f: fn(&T) -> bool) { + pure fn union(&self, other: &TreeSet, f: &fn(&T) -> bool) { let mut x = self.iter(); let mut y = other.iter(); @@ -508,7 +508,7 @@ pub fn set_next(iter: &mut TreeSetIterator/&r) -> Option<&r/T> { /// Advance the iterator through the set fn set_advance(iter: &mut TreeSetIterator/&r, - f: fn(&r/T) -> bool) { + f: &fn(&r/T) -> bool) { do map_advance(&mut iter.iter) |(k, _)| { f(k) } } @@ -530,7 +530,7 @@ pub impl TreeNode { } pure fn each(node: &r/Option<~TreeNode>, - f: fn(&(&r/K, &r/V)) -> bool) { + f: &fn(&(&r/K, &r/V)) -> bool) { for node.each |x| { each(&x.left, f); if f(&(&x.key, &x.value)) { each(&x.right, f) } @@ -538,7 +538,7 @@ pure fn each(node: &r/Option<~TreeNode>, } pure fn each_reverse(node: &r/Option<~TreeNode>, - f: fn(&(&r/K, &r/V)) -> bool) { + f: &fn(&(&r/K, &r/V)) -> bool) { for node.each |x| { each_reverse(&x.right, f); if f(&(&x.key, &x.value)) { each_reverse(&x.left, f) } diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index eac6e090f1f..68a6f8effaa 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -269,7 +269,7 @@ pub impl Context { Decodable>( // FIXME(#5121) @self, fn_name:&str, - blk: fn(@Mut)->Work) -> Work { + blk: &fn(@Mut)->Work) -> Work { let p = @Mut(Prep {ctxt: self, fn_name: fn_name.to_owned(), declared_inputs: LinearMap::new()}); -- cgit 1.4.1-3-g733a5 From bd2d17e4a1f75bc7e451fc1054d98ff13c456850 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 7 Mar 2013 15:44:21 -0800 Subject: libsyntax: Stop parsing bare functions in preparation for switching them over --- src/libcore/hashmap.rs | 4 +++- src/libcore/num/uint-template.rs | 5 ++++- src/libcore/str.rs | 12 +++++++++--- src/libcore/trie.rs | 5 ++++- src/libstd/rl.rs | 2 +- src/libstd/treemap.rs | 4 +++- src/libsyntax/parse/obsolete.rs | 5 +++++ src/libsyntax/parse/parser.rs | 12 +++++++++++- 8 files changed, 40 insertions(+), 9 deletions(-) (limited to 'src/libstd') diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs index 6f63cdbabb5..2adcee495a7 100644 --- a/src/libcore/hashmap.rs +++ b/src/libcore/hashmap.rs @@ -599,7 +599,9 @@ pub mod linear { } /// Visit the values representing the intersection - pure fn intersection(&self, other: &LinearSet, f: &fn(&T) -> bool) { + pure fn intersection(&self, + other: &LinearSet, + f: &fn(&T) -> bool) { for self.each |v| { if other.contains(v) { if !f(v) { return } diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs index 9a141bfd341..9abbfb03d7a 100644 --- a/src/libcore/num/uint-template.rs +++ b/src/libcore/num/uint-template.rs @@ -67,7 +67,10 @@ pub pure fn is_nonnegative(x: T) -> bool { x >= 0 as T } * Iterate over the range [`start`,`start`+`step`..`stop`) * */ -pub pure fn range_step(start: T, stop: T, step: T_SIGNED, it: &fn(T) -> bool) { +pub pure fn range_step(start: T, + stop: T, + step: T_SIGNED, + it: &fn(T) -> bool) { let mut i = start; if step == 0 { fail!(~"range_step called with step == 0"); diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 415c12e33a8..ae778cb7649 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -491,7 +491,10 @@ pub pure fn split(s: &str, sepfn: &fn(char) -> bool) -> ~[~str] { * Splits a string into substrings using a character function, cutting at * most `count` times. */ -pub pure fn splitn(s: &str, sepfn: &fn(char) -> bool, count: uint) -> ~[~str] { +pub pure fn splitn(s: &str, + sepfn: &fn(char) -> bool, + count: uint) + -> ~[~str] { split_inner(s, sepfn, count, true) } @@ -1246,8 +1249,11 @@ pub pure fn find_from(s: &str, start: uint, f: &fn(char) * or equal to `len(s)`. `start` must be the index of a character * boundary, as defined by `is_char_boundary`. */ -pub pure fn find_between(s: &str, start: uint, end: uint, f: &fn(char) -> bool) - -> Option { +pub pure fn find_between(s: &str, + start: uint, + end: uint, + f: &fn(char) -> bool) + -> Option { fail_unless!(start <= end); fail_unless!(end <= len(s)); fail_unless!(is_char_boundary(s, start)); diff --git a/src/libcore/trie.rs b/src/libcore/trie.rs index 4bd751adc3c..7dc85cba297 100644 --- a/src/libcore/trie.rs +++ b/src/libcore/trie.rs @@ -81,7 +81,10 @@ impl Map for TrieMap { /// Visit all values in order #[inline(always)] - pure fn each_value(&self, f: &fn(&T) -> bool) { self.each(|&(_, v)| f(v)) } + pure fn each_value(&self, + f: &fn(&T) -> bool) { + self.each(|&(_, v)| f(v)) + } /// Return the value corresponding to the key in the map #[inline(hint)] diff --git a/src/libstd/rl.rs b/src/libstd/rl.rs index b2b30c1057e..a8b25767ce5 100644 --- a/src/libstd/rl.rs +++ b/src/libstd/rl.rs @@ -68,7 +68,7 @@ pub unsafe fn read(prompt: ~str) -> Option<~str> { } } -pub type CompletionCb = @fn(~str, fn(~str)); +pub type CompletionCb<'self> = @fn(~str, &'self fn(~str)); fn complete_key(_v: @CompletionCb) {} diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index f053bcfd397..72351aac339 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -138,7 +138,9 @@ impl Map for TreeMap { pure fn each_key(&self, f: &fn(&K) -> bool) { self.each(|&(k, _)| f(k)) } /// Visit all values in order - pure fn each_value(&self, f: &fn(&V) -> bool) { self.each(|&(_, v)| f(v)) } + pure fn each_value(&self, f: &fn(&V) -> bool) { + self.each(|&(_, v)| f(v)) + } /// Return the value corresponding to the key in the map pure fn find(&self, key: &K) -> Option<&self/V> { diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 97ff175da07..757df713fc0 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -53,6 +53,7 @@ pub enum ObsoleteSyntax { ObsoleteRecordPattern, ObsoleteAssertion, ObsoletePostFnTySigil, + ObsoleteBareFnType, } impl to_bytes::IterBytes for ObsoleteSyntax { @@ -166,6 +167,10 @@ pub impl Parser { "Rather than `fn@`, `fn~`, or `fn&`, \ write `@fn`, `~fn`, and `&fn` respectively" ), + ObsoleteBareFnType => ( + "bare function type", + "use `&fn` or `extern fn` instead" + ), }; self.report(sp, kind, kind_str, desc); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 92ff83a3975..1c3d906e164 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -76,7 +76,11 @@ use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax}; use parse::obsolete::{ObsoleteTraitBoundSeparator, ObsoleteMutOwnedPointer}; use parse::obsolete::{ObsoleteMutVector, ObsoleteTraitImplVisibility}; use parse::obsolete::{ObsoleteRecordType, ObsoleteRecordPattern}; +<<<<<<< HEAD use parse::obsolete::{ObsoleteAssertion, ObsoletePostFnTySigil}; +======= +use parse::obsolete::{ObsoleteAssertion, ObsoleteBareFnType}; +>>>>>>> libsyntax: Stop parsing bare functions in preparation for switching them over use parse::prec::{as_prec, token_to_binop}; use parse::token::{can_begin_expr, is_ident, is_ident_or_path}; use parse::token::{is_plain_ident, INTERPOLATED, special_idents}; @@ -647,8 +651,14 @@ pub impl Parser { } else if self.eat_keyword(&~"extern") { self.parse_ty_bare_fn() } else if self.token_is_closure_keyword(© *self.token) { +<<<<<<< HEAD // self.warn(fmt!("Old-school closure keyword")); self.parse_ty_closure(ast::BorrowedSigil, None) +======= + let result = self.parse_ty_closure(None, None); + self.obsolete(*self.last_span, ObsoleteBareFnType); + result +>>>>>>> libsyntax: Stop parsing bare functions in preparation for switching them over } else if *self.token == token::MOD_SEP || is_ident_or_path(&*self.token) { let path = self.parse_path_with_tps(colons_before_params); @@ -2813,7 +2823,7 @@ pub impl Parser { fn parse_fn_decl_with_self( &self, parse_arg_fn: - fn(&Parser) -> arg_or_capture_item + &fn(&Parser) -> arg_or_capture_item ) -> (self_ty, fn_decl) { fn maybe_parse_self_ty( cnstr: &fn(+v: mutability) -> ast::self_ty_, -- cgit 1.4.1-3-g733a5 From 4faf63e472f1cd8721be6c498e4db97760665e90 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 7 Mar 2013 17:23:14 -0800 Subject: libstd: Remove all newtype enums from std and core. --- src/libcore/task/spawn.rs | 2 +- src/librustdoc/extract.rs | 3 +-- src/libstd/arc.rs | 51 +++++++++++++++++++++++++++++++++++------------ src/libstd/sync.rs | 3 ++- 4 files changed, 42 insertions(+), 17 deletions(-) (limited to 'src/libstd') diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 617149f7fd5..a0db2525441 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -151,7 +151,7 @@ struct AncestorNode { mut ancestors: AncestorList, } -enum AncestorList = Option>; +struct AncestorList(Option>); // Accessors for taskgroup arcs and ancestor arcs that wrap the unsafety. #[inline(always)] diff --git a/src/librustdoc/extract.rs b/src/librustdoc/extract.rs index fc784722b25..5e5c843da26 100644 --- a/src/librustdoc/extract.rs +++ b/src/librustdoc/extract.rs @@ -322,8 +322,7 @@ fn structdoc_from_struct( fields: do struct_def.fields.map |field| { match field.node.kind { ast::named_field(ident, _, _) => to_str(ident), - ast::unnamed_field => fail!( - ~"what is an unnamed struct field?") + ast::unnamed_field => ~"(unnamed)", } }, sig: None diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 46e6980be58..d7d878fa192 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -365,9 +365,11 @@ pub impl RWARC { let state = get_shared_mutable_state(&self.x); do (*borrow_rwlock(state)).write_downgrade |write_mode| { check_poison(false, (*state).failed); - blk(RWWriteMode((&mut (*state).data, - write_mode, - PoisonOnFail(&mut (*state).failed)))) + blk(RWWriteMode { + data: &mut (*state).data, + token: write_mode, + poison: PoisonOnFail(&mut (*state).failed) + }) } } } @@ -376,7 +378,11 @@ pub impl RWARC { fn downgrade(&self, token: RWWriteMode/&a) -> RWReadMode/&a { // The rwlock should assert that the token belongs to us for us. let state = unsafe { get_shared_immutable_state(&self.x) }; - let RWWriteMode((data, t, _poison)) = token; + let RWWriteMode { + data: data, + token: t, + poison: _poison + } = token; // Let readers in let new_token = (&state.lock).downgrade(t); // Whatever region the input reference had, it will be safe to use @@ -386,7 +392,10 @@ pub impl RWARC { // Downgrade ensured the token belonged to us. Just a sanity check. fail_unless!(ptr::ref_eq(&state.data, new_data)); // Produce new token - RWReadMode((new_data, new_token)) + RWReadMode { + data: new_data, + token: new_token, + } } } @@ -398,19 +407,28 @@ fn borrow_rwlock(state: *const RWARCInner) -> *RWlock { unsafe { cast::transmute(&const (*state).lock) } } -// FIXME (#3154) ice with struct/& prevents these from being structs. - /// The "write permission" token used for RWARC.write_downgrade(). -pub enum RWWriteMode = - (&self/mut T, sync::RWlockWriteMode/&self, PoisonOnFail); +pub struct RWWriteMode<'self, T> { + data: &'self mut T, + token: sync::RWlockWriteMode<'self>, + poison: PoisonOnFail, +} + /// The "read permission" token used for RWARC.write_downgrade(). -pub enum RWReadMode = (&self/T, sync::RWlockReadMode/&self); +pub struct RWReadMode<'self, T> { + data: &'self T, + token: sync::RWlockReadMode<'self>, +} pub impl RWWriteMode/&self { /// Access the pre-downgrade RWARC in write mode. fn write(&self, blk: &fn(x: &mut T) -> U) -> U { match *self { - RWWriteMode((ref data, ref token, _)) => { + RWWriteMode { + data: ref data, + token: ref token, + poison: _ + } => { do token.write { blk(&mut **data) } @@ -420,7 +438,11 @@ pub impl RWWriteMode/&self { /// Access the pre-downgrade RWARC in write mode with a condvar. fn write_cond(&self, blk: &fn(x: &x/mut T, c: &c/Condvar) -> U) -> U { match *self { - RWWriteMode((ref data, ref token, ref poison)) => { + RWWriteMode { + data: ref data, + token: ref token, + poison: ref poison + } => { do token.write_cond |cond| { unsafe { let cvar = Condvar { @@ -440,7 +462,10 @@ pub impl RWReadMode/&self { /// Access the post-downgrade rwlock in read mode. fn read(&self, blk: &fn(x: &T) -> U) -> U { match *self { - RWReadMode((data, ref token)) => { + RWReadMode { + data: data, + token: ref token + } => { do token.read { blk(data) } } } diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index a68fe5f10a3..2190475d943 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -79,8 +79,9 @@ struct SemInner { // a condition variable attached, others should. blocked: Q } + #[doc(hidden)] -enum Sem = Exclusive>; +struct Sem(Exclusive>); #[doc(hidden)] fn new_sem(count: int, q: Q) -> Sem { -- cgit 1.4.1-3-g733a5