librustc: Separate most trait bounds with '+'. rs=plussing

This commit is contained in:
Patrick Walton 2013-02-20 17:07:17 -08:00
parent a307608781
commit bf2a225c0b
204 changed files with 729 additions and 726 deletions

View File

@ -56,14 +56,14 @@ pub mod linear {
((capacity as float) * 3. / 4.) as uint
}
pub fn linear_map_with_capacity<K: Eq Hash, V>(
pub fn linear_map_with_capacity<K:Eq + Hash,V>(
initial_capacity: uint) -> LinearMap<K, V> {
let r = rand::task_rng();
linear_map_with_capacity_and_keys(r.gen_u64(), r.gen_u64(),
initial_capacity)
}
pure fn linear_map_with_capacity_and_keys<K: Eq Hash, V>(
pure fn linear_map_with_capacity_and_keys<K:Eq + Hash,V>(
k0: u64, k1: u64,
initial_capacity: uint) -> LinearMap<K, V> {
LinearMap {
@ -74,7 +74,7 @@ pub mod linear {
}
}
priv impl<K: Hash IterBytes Eq, V> LinearMap<K, V> {
priv impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
#[inline(always)]
pure fn to_bucket(&self, h: uint) -> uint {
// A good hash function with entropy spread over all of the
@ -246,7 +246,7 @@ pub mod linear {
}
}
impl<K: Hash IterBytes Eq, V> BaseIter<(&K, &V)> for LinearMap<K, V> {
impl<K:Hash + IterBytes + Eq,V> BaseIter<(&K, &V)> for LinearMap<K, V> {
/// Visit all key-value pairs
pure fn each(&self, blk: fn(&(&self/K, &self/V)) -> bool) {
for uint::range(0, self.buckets.len()) |i| {
@ -263,7 +263,7 @@ pub mod linear {
}
impl<K: Hash IterBytes Eq, V> Container for LinearMap<K, V> {
impl<K:Hash + IterBytes + Eq,V> Container for LinearMap<K, V> {
/// Return the number of elements in the map
pure fn len(&self) -> uint { self.size }
@ -271,7 +271,7 @@ pub mod linear {
pure fn is_empty(&self) -> bool { self.len() == 0 }
}
impl<K: Hash IterBytes Eq, V> Mutable for LinearMap<K, V> {
impl<K:Hash + IterBytes + Eq,V> Mutable for LinearMap<K, V> {
/// Clear the map, removing all key-value pairs.
fn clear(&mut self) {
for uint::range(0, self.buckets.len()) |idx| {
@ -281,7 +281,7 @@ pub mod linear {
}
}
impl<K: Hash IterBytes Eq, V> Map<K, V> for LinearMap<K, V> {
impl<K:Hash + IterBytes + Eq,V> Map<K, V> for LinearMap<K, V> {
/// Return true if the map contains a value for the specified key
pure fn contains_key(&self, k: &K) -> bool {
match self.bucket_for_key(k) {
@ -333,7 +333,7 @@ pub mod linear {
}
}
pub impl<K:Hash IterBytes Eq, V> LinearMap<K, V> {
pub impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
/// Create an empty LinearMap
static fn new() -> LinearMap<K, V> {
linear_map_with_capacity(INITIAL_CAPACITY)
@ -457,7 +457,7 @@ pub mod linear {
}
}
impl<K: Hash IterBytes Eq, V: Eq> Eq for LinearMap<K, V> {
impl<K:Hash + IterBytes + Eq,V:Eq> Eq for LinearMap<K, V> {
pure fn eq(&self, other: &LinearMap<K, V>) -> bool {
if self.len() != other.len() { return false; }
@ -478,13 +478,13 @@ pub mod linear {
priv map: LinearMap<T, ()>
}
impl<T: Hash IterBytes Eq> BaseIter<T> for LinearSet<T> {
impl<T:Hash + IterBytes + Eq> BaseIter<T> for LinearSet<T> {
/// Visit all values in order
pure fn each(&self, f: fn(&T) -> bool) { self.map.each_key(f) }
pure fn size_hint(&self) -> Option<uint> { Some(self.len()) }
}
impl<T: Hash IterBytes Eq> Eq for LinearSet<T> {
impl<T:Hash + IterBytes + Eq> Eq for LinearSet<T> {
pure fn eq(&self, other: &LinearSet<T>) -> bool {
self.map == other.map
}
@ -493,7 +493,7 @@ pub mod linear {
}
}
impl<T: Hash IterBytes Eq> Container for LinearSet<T> {
impl<T:Hash + IterBytes + Eq> Container for LinearSet<T> {
/// Return the number of elements in the set
pure fn len(&self) -> uint { self.map.len() }
@ -501,12 +501,12 @@ pub mod linear {
pure fn is_empty(&self) -> bool { self.map.is_empty() }
}
impl<T: Hash IterBytes Eq> Mutable for LinearSet<T> {
impl<T:Hash + IterBytes + Eq> Mutable for LinearSet<T> {
/// Clear the set, removing all values.
fn clear(&mut self) { self.map.clear() }
}
impl<T: Hash IterBytes Eq> Set<T> for LinearSet<T> {
impl<T:Hash + IterBytes + Eq> Set<T> for LinearSet<T> {
/// Return true if the set contains a value
pure fn contains(&self, value: &T) -> bool {
self.map.contains_key(value)
@ -575,7 +575,7 @@ pub mod linear {
}
}
pub impl <T: Hash IterBytes Eq> LinearSet<T> {
pub impl <T:Hash + IterBytes + Eq> LinearSet<T> {
/// Create an empty LinearSet
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }

View File

@ -80,7 +80,7 @@ impl<A: Copy> iter::CopyableIter<A> for IMPL_T<A> {
}
}
impl<A: Copy Ord> iter::CopyableOrderedIter<A> for IMPL_T<A> {
impl<A:Copy + Ord> iter::CopyableOrderedIter<A> for IMPL_T<A> {
#[inline(always)]
pure fn min(&self) -> A { iter::min(self) }
#[inline(always)]

View File

@ -57,7 +57,7 @@ pub trait CopyableIter<A:Copy> {
pure fn find(&self, p: fn(&A) -> bool) -> Option<A>;
}
pub trait CopyableOrderedIter<A:Copy Ord> {
pub trait CopyableOrderedIter<A:Copy + Ord> {
pure fn min(&self) -> A;
pure fn max(&self) -> A;
}
@ -211,7 +211,7 @@ pub pure fn repeat(times: uint, blk: fn() -> bool) {
}
#[inline(always)]
pub pure fn min<A:Copy Ord,IA:BaseIter<A>>(self: &IA) -> A {
pub pure fn min<A:Copy + Ord,IA:BaseIter<A>>(self: &IA) -> A {
match do foldl::<A,Option<A>,IA>(self, None) |a, b| {
match a {
&Some(ref a_) if *a_ < *b => {
@ -226,7 +226,7 @@ pub pure fn min<A:Copy Ord,IA:BaseIter<A>>(self: &IA) -> A {
}
#[inline(always)]
pub pure fn max<A:Copy Ord,IA:BaseIter<A>>(self: &IA) -> A {
pub pure fn max<A:Copy + Ord,IA:BaseIter<A>>(self: &IA) -> A {
match do foldl::<A,Option<A>,IA>(self, None) |a, b| {
match a {
&Some(ref a_) if *a_ > *b => {

View File

@ -207,7 +207,7 @@ pub pure fn is_some<T>(opt: &Option<T>) -> bool {
}
#[inline(always)]
pub pure fn get_or_zero<T: Copy Zero>(opt: Option<T>) -> T {
pub pure fn get_or_zero<T:Copy + Zero>(opt: Option<T>) -> T {
//! Returns the contained value or zero (for this type)
match opt { Some(copy x) => x, None => Zero::zero() }
@ -421,7 +421,7 @@ impl<T: Copy> Option<T> {
}
}
impl<T: Copy Zero> Option<T> {
impl<T:Copy + Zero> Option<T> {
#[inline(always)]
pure fn get_or_zero(self) -> T { get_or_zero(self) }
}

View File

@ -43,7 +43,7 @@ use uint;
pub type GlobalDataKey<T> = &fn(v: T);
pub unsafe fn global_data_clone_create<T: Owned Clone>(
pub unsafe fn global_data_clone_create<T:Owned + Clone>(
key: GlobalDataKey<T>, create: &fn() -> ~T) -> T {
/*!
* Clone a global value or, if it has not been created,
@ -59,7 +59,7 @@ pub unsafe fn global_data_clone_create<T: Owned Clone>(
global_data_clone_create_(key_ptr(key), create)
}
unsafe fn global_data_clone_create_<T: Owned Clone>(
unsafe fn global_data_clone_create_<T:Owned + Clone>(
key: uint, create: &fn() -> ~T) -> T {
let mut clone_value: Option<T> = None;
@ -124,7 +124,7 @@ unsafe fn global_data_modify_<T: Owned>(
}
}
pub unsafe fn global_data_clone<T: Owned Clone>(
pub unsafe fn global_data_clone<T:Owned + Clone>(
key: GlobalDataKey<T>) -> Option<T> {
let mut maybe_clone: Option<T> = None;
do global_data_modify(key) |current| {

View File

@ -41,11 +41,11 @@ pub fn align(size: uint, align: uint) -> uint {
pub struct MovePtrAdaptor<V> {
inner: V
}
pub fn MovePtrAdaptor<V: TyVisitor MovePtr>(v: V) -> MovePtrAdaptor<V> {
pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
MovePtrAdaptor { inner: v }
}
impl<V: TyVisitor MovePtr> MovePtrAdaptor<V> {
impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
#[inline(always)]
fn bump(sz: uint) {
do self.inner.move_ptr() |p| {
@ -72,7 +72,7 @@ impl<V: TyVisitor MovePtr> MovePtrAdaptor<V> {
}
/// Abstract type-directed pointer-movement using the MovePtr trait
impl<V: TyVisitor MovePtr> TyVisitor for MovePtrAdaptor<V> {
impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
fn visit_bot(&self) -> bool {
self.align_to::<()>();
if ! self.inner.visit_bot() { return false; }

View File

@ -2373,19 +2373,19 @@ impl<A: Copy> iter::CopyableIter<A> for @[A] {
}
}
impl<A: Copy Ord> iter::CopyableOrderedIter<A> for &[A] {
impl<A:Copy + Ord> iter::CopyableOrderedIter<A> for &[A] {
pure fn min(&self) -> A { iter::min(self) }
pure fn max(&self) -> A { iter::max(self) }
}
// FIXME(#4148): This should be redundant
impl<A: Copy Ord> iter::CopyableOrderedIter<A> for ~[A] {
impl<A:Copy + Ord> iter::CopyableOrderedIter<A> for ~[A] {
pure fn min(&self) -> A { iter::min(self) }
pure fn max(&self) -> A { iter::max(self) }
}
// FIXME(#4148): This should be redundant
impl<A: Copy Ord> iter::CopyableOrderedIter<A> for @[A] {
impl<A:Copy + Ord> iter::CopyableOrderedIter<A> for @[A] {
pure fn min(&self) -> A { iter::min(self) }
pure fn max(&self) -> A { iter::max(self) }
}

View File

@ -969,7 +969,7 @@ fn encode_info_for_items(ecx: @EncodeContext, ebml_w: writer::Encoder,
// Path and definition ID indexing
fn create_index<T: Copy Hash IterBytes>(index: ~[entry<T>]) ->
fn create_index<T:Copy + Hash + IterBytes>(index: ~[entry<T>]) ->
~[@~[entry<T>]] {
let mut buckets: ~[@mut ~[entry<T>]] = ~[];
for uint::range(0u, 256u) |_i| { buckets.push(@mut ~[]); };

View File

@ -3326,7 +3326,7 @@ pub fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) {
// Maintains a little union-set tree for inferred modes. `canon()` returns
// the current head value for `m0`.
fn canon<T:Copy cmp::Eq>(tbl: HashMap<ast::node_id, ast::inferable<T>>,
fn canon<T:Copy + cmp::Eq>(tbl: HashMap<ast::node_id, ast::inferable<T>>,
+m0: ast::inferable<T>) -> ast::inferable<T> {
match m0 {
ast::infer(id) => match tbl.find(&id) {

View File

@ -94,7 +94,7 @@ pub fn get_region_reporting_err(tcx: ty::ctxt,
}
}
pub fn ast_region_to_region<AC: AstConv, RS: region_scope Copy Durable>(
pub fn ast_region_to_region<AC:AstConv,RS:region_scope + Copy + Durable>(
self: @mut AC,
rscope: RS,
span: span,
@ -110,7 +110,7 @@ pub fn ast_region_to_region<AC: AstConv, RS: region_scope Copy Durable>(
get_region_reporting_err(self.tcx(), span, res)
}
pub fn ast_path_to_substs_and_ty<AC: AstConv, RS: region_scope Copy Durable>(
pub fn ast_path_to_substs_and_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
self: @mut AC,
rscope: RS,
did: ast::def_id,
@ -166,7 +166,7 @@ pub fn ast_path_to_substs_and_ty<AC: AstConv, RS: region_scope Copy Durable>(
ty_param_substs_and_ty { substs: substs, ty: ty }
}
pub fn ast_path_to_ty<AC: AstConv, RS: region_scope Copy Durable>(
pub fn ast_path_to_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
self: @mut AC,
rscope: RS,
did: ast::def_id,
@ -192,10 +192,10 @@ pub const NO_TPS: uint = 2;
// Parses the programmer's textual representation of a type into our
// internal notion of a type. `getter` is a function that returns the type
// corresponding to a definition ID:
pub fn ast_ty_to_ty<AC: AstConv, RS: region_scope Copy Durable>(
pub fn ast_ty_to_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
self: @mut AC, rscope: RS, &&ast_ty: @ast::Ty) -> ty::t {
fn ast_mt_to_mt<AC: AstConv, RS: region_scope Copy Durable>(
fn ast_mt_to_mt<AC:AstConv,RS:region_scope + Copy + Durable>(
self: @mut AC, rscope: RS, mt: ast::mt) -> ty::mt {
ty::mt {ty: ast_ty_to_ty(self, rscope, mt.ty), mutbl: mt.mutbl}
@ -204,7 +204,7 @@ pub fn ast_ty_to_ty<AC: AstConv, RS: region_scope Copy Durable>(
// Handle @, ~, and & being able to mean estrs and evecs.
// If a_seq_ty is a str or a vec, make it an estr/evec.
// Also handle function sigils and first-class trait types.
fn mk_pointer<AC: AstConv, RS: region_scope Copy Durable>(
fn mk_pointer<AC:AstConv,RS:region_scope + Copy + Durable>(
self: @mut AC,
rscope: RS,
a_seq_ty: ast::mt,
@ -420,7 +420,7 @@ pub fn ast_ty_to_ty<AC: AstConv, RS: region_scope Copy Durable>(
return typ;
}
pub fn ty_of_arg<AC: AstConv, RS: region_scope Copy Durable>(
pub fn ty_of_arg<AC:AstConv,RS:region_scope + Copy + Durable>(
self: @mut AC,
rscope: RS,
a: ast::arg,
@ -468,7 +468,7 @@ pub fn ty_of_arg<AC: AstConv, RS: region_scope Copy Durable>(
arg {mode: mode, ty: ty}
}
pub fn ty_of_bare_fn<AC: AstConv, RS: region_scope Copy Durable>(
pub fn ty_of_bare_fn<AC:AstConv,RS:region_scope + Copy + Durable>(
self: @mut AC,
rscope: RS,
purity: ast::purity,
@ -494,7 +494,7 @@ pub fn ty_of_bare_fn<AC: AstConv, RS: region_scope Copy Durable>(
}
}
pub fn ty_of_closure<AC: AstConv, RS: region_scope Copy Durable>(
pub fn ty_of_closure<AC:AstConv,RS:region_scope + Copy + Durable>(
self: @mut AC,
rscope: RS,
sigil: ast::Sigil,

View File

@ -115,7 +115,7 @@ pub fn collect_item_types(ccx: @mut CrateCtxt, crate: @ast::crate) {
}
pub impl @mut CrateCtxt {
fn to_ty<RS: region_scope Copy Durable>(rs: RS, ast_ty: @ast::Ty)
fn to_ty<RS:region_scope + Copy + Durable>(rs: RS, ast_ty: @ast::Ty)
-> ty::t {
ast_ty_to_ty(self, rs, ast_ty)
}

View File

@ -173,7 +173,7 @@ pub impl CombineFields {
b_id, a_bounds, b_bounds, node_b.rank)
}
fn merge_bnd<T:Copy InferStr LatticeValue>(
fn merge_bnd<T:Copy + InferStr + LatticeValue>(
&self,
a: &Bound<T>,
b: &Bound<T>,
@ -263,7 +263,7 @@ pub impl CombineFields {
uok()
}
fn bnds<T:Copy InferStr LatticeValue>(
fn bnds<T:Copy + InferStr + LatticeValue>(
&self,
a: &Bound<T>,
b: &Bound<T>) -> ures
@ -329,7 +329,7 @@ pub impl TyLatticeDir for Glb {
}
}
pub fn super_lattice_tys<L:LatticeDir TyLatticeDir Combine>(
pub fn super_lattice_tys<L:LatticeDir + TyLatticeDir + Combine>(
self: &L,
a: ty::t,
b: ty::t) -> cres<ty::t> {

View File

@ -517,7 +517,7 @@ trait CresCompare<T> {
fn compare(t: T, f: fn() -> ty::type_err) -> cres<T>;
}
impl<T:Copy Eq> CresCompare<T> for cres<T> {
impl<T:Copy + Eq> CresCompare<T> for cres<T> {
fn compare(t: T, f: fn() -> ty::type_err) -> cres<T> {
do self.chain |s| {
if s == t {
@ -533,7 +533,7 @@ pub fn uok() -> ures {
Ok(())
}
fn rollback_to<V:Copy Vid, T:Copy>(
fn rollback_to<V:Copy + Vid,T:Copy>(
vb: &mut ValsAndBindings<V, T>,
len: uint)
{

View File

@ -71,7 +71,7 @@ pub impl<T:InferStr> InferStr for Bounds<T> {
}
}
pub impl<V:Vid ToStr, T:InferStr> InferStr for VarValue<V, T> {
pub impl<V:Vid + ToStr,T:InferStr> InferStr for VarValue<V, T> {
fn inf_str(&self, cx: &InferCtxt) -> ~str {
match *self {
Redirect(ref vid) => fmt!("Redirect(%s)", vid.to_str()),

View File

@ -89,7 +89,7 @@ pub impl InferCtxt {
}
}
fn set<T:Copy InferStr, V:Copy Vid ToStr UnifyVid<T>>(
fn set<T:Copy + InferStr,V:Copy + Vid + ToStr + UnifyVid<T>>(
&mut self,
+vid: V,
+new_v: VarValue<V, T>) {
@ -109,7 +109,7 @@ pub impl InferCtxt {
}
}
fn unify<T:Copy InferStr, V:Copy Vid ToStr UnifyVid<T>>(
fn unify<T:Copy + InferStr,V:Copy + Vid + ToStr + UnifyVid<T>>(
&mut self,
node_a: &Node<V, T>,
node_b: &Node<V, T>) -> (V, uint)

View File

@ -69,7 +69,8 @@ pub fn bound_self_region(rp: Option<ty::region_variance>)
}
pub struct anon_rscope { anon: ty::Region, base: region_scope }
pub fn in_anon_rscope<RS: region_scope Copy Durable>(self: RS, r: ty::Region)
pub fn in_anon_rscope<RS:region_scope + Copy + Durable>(self: RS,
r: ty::Region)
-> @anon_rscope {
@anon_rscope {anon: r, base: self as region_scope}
}
@ -91,7 +92,7 @@ pub struct binding_rscope {
anon_bindings: uint,
}
pub fn in_binding_rscope<RS: region_scope Copy Durable>(self: RS)
pub fn in_binding_rscope<RS:region_scope + Copy + Durable>(self: RS)
-> @mut binding_rscope {
let base = self as region_scope;
@mut binding_rscope { base: base, anon_bindings: 0 }

View File

@ -80,7 +80,7 @@ impl &Condvar {
struct ARC<T> { x: SharedMutableState<T> }
/// Create an atomically reference counted wrapper.
pub fn ARC<T: Const Owned>(data: T) -> ARC<T> {
pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
ARC { x: unsafe { shared_mutable_state(data) } }
}
@ -88,7 +88,7 @@ pub fn ARC<T: Const Owned>(data: T) -> ARC<T> {
* Access the underlying data in an atomically reference counted
* wrapper.
*/
pub fn get<T: Const Owned>(rc: &a/ARC<T>) -> &a/T {
pub fn get<T:Const + Owned>(rc: &a/ARC<T>) -> &a/T {
unsafe { get_shared_immutable_state(&rc.x) }
}
@ -99,7 +99,7 @@ pub fn get<T: Const Owned>(rc: &a/ARC<T>) -> &a/T {
* object. However, one of the `arc` objects can be sent to another task,
* allowing them to share the underlying data.
*/
pub fn clone<T: Const Owned>(rc: &ARC<T>) -> ARC<T> {
pub fn clone<T:Const + Owned>(rc: &ARC<T>) -> ARC<T> {
ARC { x: unsafe { clone_shared_mutable_state(&rc.x) } }
}
@ -112,12 +112,12 @@ pub fn clone<T: Const Owned>(rc: &ARC<T>) -> ARC<T> {
* unwrap from a task that holds another reference to the same ARC; it is
* guaranteed to deadlock.
*/
pub fn unwrap<T: Const Owned>(rc: ARC<T>) -> T {
pub fn unwrap<T:Const + Owned>(rc: ARC<T>) -> T {
let ARC { x: x } = rc;
unsafe { unwrap_shared_mutable_state(x) }
}
impl<T: Const Owned> Clone for ARC<T> {
impl<T:Const + Owned> Clone for ARC<T> {
fn clone(&self) -> ARC<T> {
clone(self)
}
@ -283,14 +283,14 @@ struct RWARC<T> {
}
/// Create a reader/writer ARC with the supplied data.
pub fn RWARC<T: Const Owned>(user_data: T) -> RWARC<T> {
pub fn RWARC<T:Const + Owned>(user_data: T) -> RWARC<T> {
rw_arc_with_condvars(user_data, 1)
}
/**
* Create a reader/writer ARC with the supplied data and a specified number
* of condvars (as sync::rwlock_with_condvars).
*/
pub fn rw_arc_with_condvars<T: Const Owned>(
pub fn rw_arc_with_condvars<T:Const + Owned>(
user_data: T,
num_condvars: uint) -> RWARC<T>
{
@ -300,7 +300,7 @@ pub fn rw_arc_with_condvars<T: Const Owned>(
RWARC { x: unsafe { shared_mutable_state(data) }, cant_nest: () }
}
impl<T: Const Owned> RWARC<T> {
impl<T:Const + Owned> RWARC<T> {
/// Duplicate a rwlock-protected ARC, as arc::clone.
fn clone(&self) -> RWARC<T> {
RWARC { x: unsafe { clone_shared_mutable_state(&self.x) },
@ -309,7 +309,7 @@ impl<T: Const Owned> RWARC<T> {
}
impl<T: Const Owned> &RWARC<T> {
impl<T:Const + Owned> &RWARC<T> {
/**
* Access the underlying data mutably. Locks the rwlock in write mode;
* other readers and writers will block.
@ -418,7 +418,7 @@ impl<T: Const Owned> &RWARC<T> {
* in write mode.
*/
// FIXME(#3724) make this a by-move method on the arc
pub fn unwrap_rw_arc<T: Const Owned>(arc: RWARC<T>) -> T {
pub fn unwrap_rw_arc<T:Const + Owned>(arc: RWARC<T>) -> T {
let RWARC { x: x, _ } = arc;
let inner = unsafe { unwrap_shared_mutable_state(x) };
let RWARCInner { failed: failed, data: data, _ } = inner;
@ -432,7 +432,7 @@ pub fn unwrap_rw_arc<T: Const Owned>(arc: RWARC<T>) -> T {
// lock it. This wraps the unsafety, with the justification that the 'lock'
// field is never overwritten; only 'failed' and 'data'.
#[doc(hidden)]
fn borrow_rwlock<T: Const Owned>(state: *const RWARCInner<T>) -> *RWlock {
fn borrow_rwlock<T:Const + Owned>(state: *const RWARCInner<T>) -> *RWlock {
unsafe { cast::transmute(&const (*state).lock) }
}
@ -444,7 +444,7 @@ pub enum RWWriteMode<T> =
/// The "read permission" token used for RWARC.write_downgrade().
pub enum RWReadMode<T> = (&T, sync::RWlockReadMode);
impl<T: Const Owned> &RWWriteMode<T> {
impl<T:Const + Owned> &RWWriteMode<T> {
/// Access the pre-downgrade RWARC in write mode.
fn write<U>(blk: fn(x: &mut T) -> U) -> U {
match *self {
@ -474,7 +474,7 @@ impl<T: Const Owned> &RWWriteMode<T> {
}
}
impl<T: Const Owned> &RWReadMode<T> {
impl<T:Const + Owned> &RWReadMode<T> {
/// Access the post-downgrade rwlock in read mode.
fn read<U>(blk: fn(x: &T) -> U) -> U {
match *self {

View File

@ -198,7 +198,7 @@ mod tests {
assert *deq.get(3) == d;
}
fn test_parameterized<T: Copy Eq Durable>(a: T, b: T, c: T, d: T) {
fn test_parameterized<T:Copy + Eq + Durable>(a: T, b: T, c: T, d: T) {
let mut deq = Deque::new();
assert deq.len() == 0;
deq.add_front(a);

View File

@ -189,7 +189,7 @@ pub mod pod {
pub type PipeChan<T> = FlatChan<T, PodFlattener<T>, PipeByteChan>;
/// Create a `FlatPort` from a `Reader`
pub fn reader_port<T: Copy Owned, R: Reader>(
pub fn reader_port<T:Copy + Owned,R:Reader>(
reader: R
) -> ReaderPort<T, R> {
let unflat: PodUnflattener<T> = PodUnflattener::new();
@ -198,7 +198,7 @@ pub mod pod {
}
/// Create a `FlatChan` from a `Writer`
pub fn writer_chan<T: Copy Owned, W: Writer>(
pub fn writer_chan<T:Copy + Owned,W:Writer>(
writer: W
) -> WriterChan<T, W> {
let flat: PodFlattener<T> = PodFlattener::new();
@ -207,21 +207,21 @@ pub mod pod {
}
/// Create a `FlatPort` from a `Port<~[u8]>`
pub fn pipe_port<T: Copy Owned>(port: Port<~[u8]>) -> PipePort<T> {
pub fn pipe_port<T:Copy + Owned>(port: Port<~[u8]>) -> PipePort<T> {
let unflat: PodUnflattener<T> = PodUnflattener::new();
let byte_port = PipeBytePort::new(port);
FlatPort::new(unflat, byte_port)
}
/// Create a `FlatChan` from a `Chan<~[u8]>`
pub fn pipe_chan<T: Copy Owned>(chan: Chan<~[u8]>) -> PipeChan<T> {
pub fn pipe_chan<T:Copy + Owned>(chan: Chan<~[u8]>) -> PipeChan<T> {
let flat: PodFlattener<T> = PodFlattener::new();
let byte_chan = PipeByteChan::new(chan);
FlatChan::new(flat, byte_chan)
}
/// Create a pair of `FlatChan` and `FlatPort`, backed by pipes
pub fn pipe_stream<T: Copy Owned>() -> (PipePort<T>, PipeChan<T>) {
pub fn pipe_stream<T:Copy + Owned>() -> (PipePort<T>, PipeChan<T>) {
let (port, chan) = pipes::stream();
return (pipe_port(port), pipe_chan(chan));
}
@ -358,7 +358,7 @@ pub mod flatteners {
bogus: ()
}
pub impl<T: Copy Owned> Unflattener<T> for PodUnflattener<T> {
pub impl<T:Copy + Owned> Unflattener<T> for PodUnflattener<T> {
fn unflatten(&self, buf: ~[u8]) -> T {
assert size_of::<T>() != 0;
assert size_of::<T>() == buf.len();
@ -368,7 +368,7 @@ pub mod flatteners {
}
}
pub impl<T: Copy Owned> Flattener<T> for PodFlattener<T> {
pub impl<T:Copy + Owned> Flattener<T> for PodFlattener<T> {
fn flatten(&self, val: T) -> ~[u8] {
assert size_of::<T>() != 0;
let val: *T = ptr::to_unsafe_ptr(&val);
@ -377,7 +377,7 @@ pub mod flatteners {
}
}
pub impl<T: Copy Owned> PodUnflattener<T> {
pub impl<T:Copy + Owned> PodUnflattener<T> {
static fn new() -> PodUnflattener<T> {
PodUnflattener {
bogus: ()
@ -385,7 +385,7 @@ pub mod flatteners {
}
}
pub impl<T: Copy Owned> PodFlattener<T> {
pub impl<T:Copy + Owned> PodFlattener<T> {
static fn new() -> PodFlattener<T> {
PodFlattener {
bogus: ()

View File

@ -34,7 +34,7 @@ enum TreeNode<K, V> {
pub fn init<K, V>() -> Treemap<K, V> { @Empty }
/// Insert a value into the map
pub fn insert<K: Copy Eq Ord, V: Copy>(m: Treemap<K, V>, k: K, v: V)
pub fn insert<K:Copy + Eq + Ord,V:Copy>(m: Treemap<K, V>, k: K, v: V)
-> Treemap<K, V> {
@match m {
@Empty => Node(@k, @v, @Empty, @Empty),
@ -49,7 +49,7 @@ pub fn insert<K: Copy Eq Ord, V: Copy>(m: Treemap<K, V>, k: K, v: V)
}
/// Find a value based on the key
pub fn find<K: Eq Ord, V: Copy>(m: Treemap<K, V>, k: K) -> Option<V> {
pub fn find<K:Eq + Ord,V:Copy>(m: Treemap<K, V>, k: K) -> Option<V> {
match *m {
Empty => None,
Node(@ref kk, @copy v, left, right) => {

View File

@ -1174,7 +1174,7 @@ impl<A: ToJson> ToJson for ~[A] {
fn to_json() -> Json { List(self.map(|elt| elt.to_json())) }
}
impl<A: ToJson Copy> ToJson for LinearMap<~str, A> {
impl<A:ToJson + Copy> ToJson for LinearMap<~str, A> {
fn to_json() -> Json {
let mut d = LinearMap::new();
for self.each |&(key, value)| {

View File

@ -67,7 +67,7 @@ pub pure fn find<T: Copy>(ls: @List<T>, f: fn(&T) -> bool) -> Option<T> {
}
/// Returns true if a list contains an element with the given value
pub fn has<T: Copy Eq>(ls: @List<T>, elt: T) -> bool {
pub fn has<T:Copy + Eq>(ls: @List<T>, elt: T) -> bool {
for each(ls) |e| {
if *e == elt { return true; }
}

View File

@ -76,7 +76,7 @@ pub mod chained {
FoundAfter(@Entry<K,V>, @Entry<K,V>)
}
priv impl<K:Eq IterBytes Hash, V> T<K, V> {
priv impl<K:Eq + IterBytes + Hash,V> T<K, V> {
pure fn search_rem(k: &K, h: uint, idx: uint,
e_root: @Entry<K,V>) -> SearchResult<K,V> {
let mut e0 = e_root;
@ -156,19 +156,19 @@ pub mod chained {
}
}
impl<K: Eq IterBytes Hash, V> Container for T<K, V> {
impl<K:Eq + IterBytes + Hash,V> Container for T<K, V> {
pure fn len(&self) -> uint { self.count }
pure fn is_empty(&self) -> bool { self.count == 0 }
}
impl<K: Eq IterBytes Hash, V> Mutable for T<K, V> {
impl<K:Eq + IterBytes + Hash,V> Mutable for T<K, V> {
fn clear(&mut self) {
self.count = 0u;
self.chains = chains(initial_capacity);
}
}
impl<K: Eq IterBytes Hash, V> T<K, V> {
impl<K:Eq + IterBytes + Hash,V> T<K, V> {
pure fn contains_key(&self, k: &K) -> bool {
let hash = k.hash_keyed(0,0) as uint;
match self.search_tbl(k, hash) {
@ -252,7 +252,7 @@ pub mod chained {
}
}
impl<K: Eq IterBytes Hash Copy, V: Copy> T<K, V> {
impl<K:Eq + IterBytes + Hash + Copy,V:Copy> T<K, V> {
pure fn find(&self, k: &K) -> Option<V> {
match self.search_tbl(k, k.hash_keyed(0,0) as uint) {
NotFound => None,
@ -325,7 +325,7 @@ pub mod chained {
}
}
impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> T<K, V> {
impl<K:Eq + IterBytes + Hash + Copy + ToStr,V:ToStr + Copy> T<K, V> {
fn to_writer(wr: io::Writer) {
if self.count == 0u {
wr.write_str(~"{}");
@ -347,7 +347,8 @@ pub mod chained {
}
}
impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> ToStr for T<K, V> {
impl<K:Eq + IterBytes + Hash + Copy + ToStr,V:ToStr + Copy> ToStr
for T<K, V> {
pure fn to_str(&self) -> ~str {
unsafe {
// Meh -- this should be safe
@ -356,7 +357,7 @@ pub mod chained {
}
}
impl<K:Eq IterBytes Hash Copy, V: Copy> ops::Index<K, V> for T<K, V> {
impl<K:Eq + IterBytes + Hash + Copy,V:Copy> ops::Index<K, V> for T<K, V> {
pure fn index(&self, k: K) -> V {
self.get(&k)
}
@ -366,7 +367,7 @@ pub mod chained {
vec::from_elem(nchains, None)
}
pub fn mk<K:Eq IterBytes Hash, V: Copy>() -> T<K,V> {
pub fn mk<K:Eq + IterBytes + Hash,V:Copy>() -> T<K,V> {
let slf: T<K, V> = @HashMap_ {count: 0u,
chains: chains(initial_capacity)};
slf
@ -378,18 +379,19 @@ Function: hashmap
Construct a hashmap.
*/
pub fn HashMap<K:Eq IterBytes Hash Const, V: Copy>()
pub fn HashMap<K:Eq + IterBytes + Hash + Const,V:Copy>()
-> HashMap<K, V> {
chained::mk()
}
/// Convenience function for adding keys to a hashmap with nil type keys
pub fn set_add<K:Eq IterBytes Hash Const Copy>(set: Set<K>, key: K) -> bool {
pub fn set_add<K:Eq + IterBytes + Hash + Const + Copy>(set: Set<K>, key: K)
-> bool {
set.insert(key, ())
}
/// Convert a set into a vector.
pub pure fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] {
pub pure fn vec_from_set<T:Eq + IterBytes + Hash + Copy>(s: Set<T>) -> ~[T] {
do vec::build_sized(s.len()) |push| {
for s.each_key() |&k| {
push(k);
@ -398,7 +400,7 @@ pub pure fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] {
}
/// Construct a hashmap from a vector
pub fn hash_from_vec<K: Eq IterBytes Hash Const Copy, V: Copy>(
pub fn hash_from_vec<K:Eq + IterBytes + Hash + Const + Copy,V:Copy>(
items: &[(K, V)]) -> HashMap<K, V> {
let map = HashMap();
for vec::each(items) |item| {

View File

@ -34,7 +34,7 @@ const min_granularity : uint = 1024u;
* This is used to build most of the other parallel vector functions,
* like map or alli.
*/
fn map_slices<A: Copy Owned, B: Copy Owned>(
fn map_slices<A:Copy + Owned,B:Copy + Owned>(
xs: &[A],
f: &fn() -> ~fn(uint, v: &[A]) -> B)
-> ~[B] {
@ -90,7 +90,7 @@ fn map_slices<A: Copy Owned, B: Copy Owned>(
}
/// A parallel version of map.
pub fn map<A: Copy Owned, B: Copy Owned>(
pub fn map<A:Copy + Owned,B:Copy + Owned>(
xs: &[A], fn_factory: &fn() -> ~fn(&A) -> B) -> ~[B] {
vec::concat(map_slices(xs, || {
let f = fn_factory();
@ -101,7 +101,7 @@ pub fn map<A: Copy Owned, B: Copy Owned>(
}
/// A parallel version of mapi.
pub fn mapi<A: Copy Owned, B: Copy Owned>(
pub fn mapi<A:Copy + Owned,B:Copy + Owned>(
xs: &[A],
fn_factory: &fn() -> ~fn(uint, &A) -> B) -> ~[B]
{
@ -120,7 +120,7 @@ pub fn mapi<A: Copy Owned, B: Copy Owned>(
}
/// Returns true if the function holds for all elements in the vector.
pub fn alli<A: Copy Owned>(
pub fn alli<A:Copy + Owned>(
xs: &[A],
fn_factory: &fn() -> ~fn(uint, &A) -> bool) -> bool
{
@ -135,7 +135,7 @@ pub fn alli<A: Copy Owned>(
}
/// Returns true if the function holds for any elements in the vector.
pub fn any<A: Copy Owned>(
pub fn any<A:Copy + Owned>(
xs: &[A],
fn_factory: &fn() -> ~fn(&A) -> bool) -> bool {
do vec::any(map_slices(xs, || {

View File

@ -103,7 +103,7 @@ pub fn quick_sort<T>(arr: &mut [T], compare_func: Le<T>) {
qsort::<T>(arr, 0u, len::<T>(arr) - 1u, compare_func);
}
fn qsort3<T: Copy Ord Eq>(arr: &mut [T], left: int, right: int) {
fn qsort3<T:Copy + Ord + Eq>(arr: &mut [T], left: int, right: int) {
if right <= left { return; }
let v: T = arr[right];
let mut i: int = left - 1;
@ -160,7 +160,7 @@ fn qsort3<T: Copy Ord Eq>(arr: &mut [T], left: int, right: int) {
*
* This is an unstable sort.
*/
pub fn quick_sort3<T: Copy Ord Eq>(arr: &mut [T]) {
pub fn quick_sort3<T:Copy + Ord + Eq>(arr: &mut [T]) {
if arr.len() <= 1 { return; }
qsort3(arr, 0, (arr.len() - 1) as int);
}
@ -169,7 +169,7 @@ pub trait Sort {
fn qsort(self);
}
impl<T: Copy Ord Eq> Sort for &mut [T] {
impl<T:Copy + Ord + Eq> Sort for &mut [T] {
fn qsort(self) { quick_sort3(self); }
}
@ -177,7 +177,7 @@ const MIN_MERGE: uint = 64;
const MIN_GALLOP: uint = 7;
const INITIAL_TMP_STORAGE: uint = 128;
pub fn tim_sort<T: Copy Ord>(array: &mut [T]) {
pub fn tim_sort<T:Copy + Ord>(array: &mut [T]) {
let size = array.len();
if size < 2 {
return;
@ -216,7 +216,7 @@ pub fn tim_sort<T: Copy Ord>(array: &mut [T]) {
ms.merge_force_collapse(array);
}
fn binarysort<T: Copy Ord>(array: &mut [T], start: uint) {
fn binarysort<T:Copy + Ord>(array: &mut [T], start: uint) {
let size = array.len();
let mut start = start;
assert start <= size;
@ -266,7 +266,7 @@ pure fn min_run_length(n: uint) -> uint {
return n + r;
}
fn count_run_ascending<T: Copy Ord>(array: &mut [T]) -> uint {
fn count_run_ascending<T:Copy + Ord>(array: &mut [T]) -> uint {
let size = array.len();
assert size > 0;
if size == 1 { return 1; }
@ -286,7 +286,7 @@ fn count_run_ascending<T: Copy Ord>(array: &mut [T]) -> uint {
return run;
}
pure fn gallop_left<T: Copy Ord>(key: &const T, array: &[const T],
pure fn gallop_left<T:Copy + Ord>(key: &const T, array: &[const T],
hint: uint) -> uint {
let size = array.len();
assert size != 0 && hint < size;
@ -335,7 +335,7 @@ pure fn gallop_left<T: Copy Ord>(key: &const T, array: &[const T],
return ofs;
}
pure fn gallop_right<T: Copy Ord>(key: &const T, array: &[const T],
pure fn gallop_right<T:Copy + Ord>(key: &const T, array: &[const T],
hint: uint) -> uint {
let size = array.len();
assert size != 0 && hint < size;
@ -404,7 +404,7 @@ fn MergeState<T>() -> MergeState<T> {
}
}
impl<T: Copy Ord> MergeState<T> {
impl<T:Copy + Ord> MergeState<T> {
fn push_run(&self, run_base: uint, run_len: uint) {
let tmp = RunState{base: run_base, len: run_len};
self.runs.push(tmp);

View File

@ -123,7 +123,7 @@ pub fn sleep(iotask: &IoTask, msecs: uint) {
* on the provided port in the allotted timeout period, then the result will
* be a `Some(T)`. If not, then `None` will be returned.
*/
pub fn recv_timeout<T: Copy Owned>(iotask: &IoTask,
pub fn recv_timeout<T:Copy + Owned>(iotask: &IoTask,
msecs: uint,
wait_po: &Port<T>)
-> Option<T> {

View File

@ -39,7 +39,7 @@ pub struct TreeMap<K, V> {
priv length: uint
}
impl<K: Eq Ord, V: Eq> Eq for TreeMap<K, V> {
impl<K:Eq + Ord,V:Eq> Eq for TreeMap<K, V> {
pure fn eq(&self, other: &TreeMap<K, V>) -> bool {
if self.len() != other.len() {
false
@ -259,7 +259,7 @@ impl<T: Ord> ReverseIter<T> for TreeSet<T> {
}
}
impl<T: Eq Ord> Eq for TreeSet<T> {
impl<T:Eq + Ord> Eq for TreeSet<T> {
pure fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map }
pure fn ne(&self, other: &TreeSet<T>) -> bool { self.map != other.map }
}
@ -772,7 +772,7 @@ mod test_treemap {
assert m.find(&k1) == Some(&v1);
}
fn check_equal<K: Eq Ord, V: Eq>(ctrl: &[(K, V)], map: &TreeMap<K, V>) {
fn check_equal<K:Eq + Ord,V:Eq>(ctrl: &[(K, V)], map: &TreeMap<K, V>) {
assert ctrl.is_empty() == map.is_empty();
for ctrl.each |x| {
let &(k, v) = x;

View File

@ -23,7 +23,7 @@ pub struct Interner<T> {
}
// when traits can extend traits, we should extend index<uint,T> to get []
pub impl<T: Eq IterBytes Hash Const Copy> Interner<T> {
pub impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> {
static fn new() -> Interner<T> {
Interner {
map: LinearMap::new(),

View File

@ -10,7 +10,7 @@
use core::pipes::*;
pub fn foo<T: Owned Copy>(x: T) -> Port<T> {
pub fn foo<T:Owned + Copy>(x: T) -> Port<T> {
let (p, c) = stream();
do task::spawn() {
c.send(x);

View File

@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub fn to_closure<A: Durable Copy>(x: A) -> @fn() -> A {
pub fn to_closure<A:Durable + Copy>(x: A) -> @fn() -> A {
fn@() -> A { copy x }
}

View File

@ -33,7 +33,7 @@ impl read for bool {
}
}
pub fn read<T: read Copy>(s: ~str) -> T {
pub fn read<T:read + Copy>(s: ~str) -> T {
match read::readMaybe(s) {
Some(x) => x,
_ => fail!(~"read failed!")

View File

@ -14,4 +14,4 @@ trait Baz { fn h() -> int; }
trait Quux: Foo Bar Baz { }
impl<T: Foo Bar Baz> Quux for T { }
impl<T:Foo + Bar + Baz> Quux for T { }

View File

@ -27,14 +27,14 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
return (xx as float) * 100f / (yy as float);
}
pure fn le_by_val<TT: Copy, UU: Copy Ord>(kv0: &(TT,UU),
pure fn le_by_val<TT:Copy,UU:Copy + Ord>(kv0: &(TT,UU),
kv1: &(TT,UU)) -> bool {
let (_, v0) = *kv0;
let (_, v1) = *kv1;
return v0 >= v1;
}
pure fn le_by_key<TT: Copy Ord, UU: Copy>(kv0: &(TT,UU),
pure fn le_by_key<TT:Copy + Ord,UU:Copy>(kv0: &(TT,UU),
kv1: &(TT,UU)) -> bool {
let (k0, _) = *kv0;
let (k1, _) = *kv1;
@ -42,7 +42,7 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
}
// sort by key, then by value
fn sortKV<TT: Copy Ord, UU: Copy Ord>(orig: ~[(TT,UU)]) -> ~[(TT,UU)] {
fn sortKV<TT:Copy + Ord,UU:Copy + Ord>(orig: ~[(TT,UU)]) -> ~[(TT,UU)] {
return sort::merge_sort(sort::merge_sort(orig, le_by_key), le_by_val);
}

View File

@ -11,7 +11,7 @@
trait A { fn foo(); }
trait B { fn foo(); }
fn foo<T: A B>(t: T) {
fn foo<T:A + B>(t: T) {
t.foo(); //~ ERROR multiple applicable methods in scope
//~^ NOTE candidate #1 derives from the bound `A`
//~^^ NOTE candidate #2 derives from the bound `B`

View File

@ -16,7 +16,7 @@
use iter::BaseIter;
trait A {
fn b<C:Copy Const, D>(x: C) -> C;
fn b<C:Copy + Const,D>(x: C) -> C;
}
struct E {

View File

@ -21,7 +21,7 @@ struct E {
}
impl A for E {
fn b<F:Copy Const, G>(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 2 bounds, but
fn b<F:Copy + Const,G>(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 2 bounds, but
}
fn main() {}

View File

@ -35,7 +35,7 @@ fn to_foo_2<T:Copy>(t: T) -> foo {
{f:t} as foo //~ ERROR value may contain borrowed pointers; use `&static` bound
}
fn to_foo_3<T:Copy &static>(t: T) -> foo {
fn to_foo_3<T:Copy + &static>(t: T) -> foo {
// OK---T may escape as part of the returned foo value, but it is
// owned and hence does not contain borrowed ptrs
{f:t} as foo

View File

@ -10,11 +10,11 @@
trait foo { fn foo(); }
fn to_foo<T: Copy foo>(t: T) -> foo {
fn to_foo<T:Copy + foo>(t: T) -> foo {
t as foo //~ ERROR value may contain borrowed pointers; use `&static` bound
}
fn to_foo2<T: Copy foo &static>(t: T) -> foo {
fn to_foo2<T:Copy + foo + &static>(t: T) -> foo {
t as foo
}

View File

@ -12,7 +12,7 @@ fn copy1<T: Copy>(t: T) -> fn@() -> T {
fn@() -> T { t } //~ ERROR value may contain borrowed pointers
}
fn copy2<T: Copy &static>(t: T) -> fn@() -> T {
fn copy2<T:Copy + &static>(t: T) -> fn@() -> T {
fn@() -> T { t }
}

View File

@ -12,7 +12,7 @@ type pair<A,B> = {
a: A, b: B
};
fn f<A:Copy &static>(a: A, b: u16) -> fn@() -> (A, u16) {
fn f<A:Copy + &static>(a: A, b: u16) -> fn@() -> (A, u16) {
fn@() -> (A, u16) { (a, b) }
}

View File

@ -23,7 +23,7 @@ fn make_cycle<A:Copy>(a: A) {
g.rec = Some(g);
}
fn f<A:Owned Copy, B:Owned Copy>(a: A, b: B) -> fn@() -> (A, B) {
fn f<A:Owned + Copy,B:Owned + Copy>(a: A, b: B) -> fn@() -> (A, B) {
fn@() -> (A, B) { (a, b) }
}

View File

@ -13,7 +13,7 @@
extern mod std;
use std::oldmap::{map, hashmap, int_hash};
class keys<K: Copy, V: Copy, M: Copy map<K,V>>
class keys<K:Copy,V:Copy,M:Copy + map<K,V>>
: iter::base_iter<K> {
let map: M;

View File

@ -16,7 +16,7 @@ type pair<A,B> = {
a: A, b: B
};
fn f<A:Copy &static>(a: A, b: u16) -> fn@() -> (A, u16) {
fn f<A:Copy + &static>(a: A, b: u16) -> fn@() -> (A, u16) {
fn@() -> (A, u16) { (a, b) }
}

View File

@ -12,7 +12,7 @@
// are const.
fn foo<T: Copy Const>(x: T) -> T { x }
fn foo<T:Copy + Const>(x: T) -> T { x }
struct F { field: int }

View File

@ -10,7 +10,7 @@
fn id<T: Copy Owned>(t: T) -> T { return t; }
fn id<T:Copy + Owned>(t: T) -> T { return t; }
pub fn main() {
let expected = ~100;

View File

@ -23,7 +23,7 @@ impl Serializable for int {
struct F<A> { a: A }
impl<A: Copy Serializable> Serializable for F<A> {
impl<A:Copy + Serializable> Serializable for F<A> {
fn serialize<S:Serializer>(s: S) {
self.a.serialize(s);
}

View File

@ -31,7 +31,7 @@ fn align(size: uint, align: uint) -> uint {
enum ptr_visit_adaptor<V> = Inner<V>;
impl<V: TyVisitor movable_ptr> ptr_visit_adaptor<V> {
impl<V:TyVisitor + movable_ptr> ptr_visit_adaptor<V> {
#[inline(always)]
fn bump(sz: uint) {
@ -59,7 +59,7 @@ impl<V: TyVisitor movable_ptr> ptr_visit_adaptor<V> {
}
impl<V: TyVisitor movable_ptr> TyVisitor for ptr_visit_adaptor<V> {
impl<V:TyVisitor + movable_ptr> TyVisitor for ptr_visit_adaptor<V> {
fn visit_bot(&self) -> bool {
self.align_to::<()>();

View File

@ -21,7 +21,7 @@ fn iter<T>(v: ~[T], it: fn(T) -> bool) {
}
}
fn find_pos<T:Eq Copy>(n: T, h: ~[T]) -> Option<uint> {
fn find_pos<T:Eq + Copy>(n: T, h: ~[T]) -> Option<uint> {
let mut i = 0u;
for iter(copy h) |e| {
if e == n { return Some(i); }

View File

@ -17,7 +17,7 @@ trait bool_like {
static fn select<A>(b: Self, +x1: A, +x2: A) -> A;
}
fn andand<T: bool_like Copy>(x1: T, x2: T) -> T {
fn andand<T:bool_like + Copy>(x1: T, x2: T) -> T {
bool_like::select(x1, x2, x1)
}

View File

@ -18,7 +18,7 @@ use aux::{Foo, Bar, Baz, A};
// We want to extend all Foo, Bar, Bazes to Quuxes
pub trait Quux: Foo Bar Baz { }
impl<T: Foo Bar Baz> Quux for T { }
impl<T:Foo + Bar + Baz> Quux for T { }
fn f<T:Quux>(a: &T) {
assert a.f() == 10;

View File

@ -10,7 +10,7 @@
// Testing that this impl turns A into a Quux, because
// A is already a Foo Bar Baz
impl<T: Foo Bar Baz> Quux for T { }
impl<T:Foo + Bar + Baz> Quux for T { }
trait Foo { fn f() -> int; }
trait Bar { fn g() -> int; }

View File

@ -19,7 +19,7 @@ impl B for S { fn b(&self) -> int { 20 } }
impl C for S { fn c(&self) -> int { 30 } }
// Both B and C inherit from A
fn f<T: B C>(x: &T) {
fn f<T:B + C>(x: &T) {
assert x.a() == 10;
assert x.b() == 20;
assert x.c() == 30;

View File

@ -14,7 +14,7 @@
extern mod trait_inheritance_overloading_xc;
use trait_inheritance_overloading_xc::{MyNum, MyInt};
fn f<T:Copy MyNum>(x: T, y: T) -> (T, T, T) {
fn f<T:Copy + MyNum>(x: T, y: T) -> (T, T, T) {
return (x + y, x - y, x * y);
}

View File

@ -33,7 +33,7 @@ impl Eq for MyInt {
impl MyNum for MyInt;
fn f<T:Copy MyNum>(x: T, y: T) -> (T, T, T) {
fn f<T:Copy + MyNum>(x: T, y: T) -> (T, T, T) {
return (x + y, x - y, x * y);
}

View File

@ -21,7 +21,7 @@ impl Bar for A { fn g() -> int { 20 } }
impl Baz for A { fn h() -> int { 30 } }
impl Quux for A;
fn f<T: Quux Foo Bar Baz>(a: &T) {
fn f<T:Quux + Foo + Bar + Baz>(a: &T) {
assert a.f() == 10;
assert a.g() == 20;
assert a.h() == 30;

View File

@ -18,7 +18,7 @@ struct Pointy {
d : fn~() -> uint,
}
fn make_uniq_closure<A:Owned Copy>(a: A) -> fn~() -> uint {
fn make_uniq_closure<A:Owned + Copy>(a: A) -> fn~() -> uint {
fn~() -> uint { ptr::addr_of(&a) as uint }
}

View File

@ -12,11 +12,11 @@ use cmp::Eq;
fn sendable() {
fn f<T: Owned Eq>(i: T, j: T) {
fn f<T:Owned + Eq>(i: T, j: T) {
assert i == j;
}
fn g<T: Owned Eq>(i: T, j: T) {
fn g<T:Owned + Eq>(i: T, j: T) {
assert i != j;
}
@ -30,11 +30,11 @@ fn sendable() {
fn copyable() {
fn f<T: Copy Eq>(i: T, j: T) {
fn f<T:Copy + Eq>(i: T, j: T) {
assert i == j;
}
fn g<T: Copy Eq>(i: T, j: T) {
fn g<T:Copy + Eq>(i: T, j: T) {
assert i != j;
}