oops v2, apparently writing std::comm::stream() doesn't work on check-fast; fix this

This commit is contained in:
Ben Blum 2013-08-21 20:33:56 -04:00
parent 22ad36d75b
commit b795fab046
5 changed files with 19 additions and 10 deletions

View File

@ -11,8 +11,10 @@
// Tests (negatively) the ability for the Self type in default methods
// to use capabilities granted by builtin kinds as supertraits.
use std::comm;
trait Foo : Freeze {
fn foo(self, chan: std::comm::Chan<Self>) {
fn foo(self, chan: comm::Chan<Self>) {
chan.send(self); //~ ERROR does not fulfill `Send`
}
}
@ -20,7 +22,7 @@ trait Foo : Freeze {
impl <T: Freeze> Foo for T { }
fn main() {
let (p,c) = std::comm::stream();
let (p,c) = comm::stream();
1193182.foo(c);
assert!(p.recv() == 1193182);
}

View File

@ -14,18 +14,20 @@
// a Send. Basically this just makes sure rustc is using
// each_bound_trait_and_supertraits in type_contents correctly.
use std::comm;
trait Bar : Send { }
trait Foo : Bar { }
impl <T: Send> Foo for T { }
impl <T: Send> Bar for T { }
fn foo<T: Foo>(val: T, chan: std::comm::Chan<T>) {
fn foo<T: Foo>(val: T, chan: comm::Chan<T>) {
chan.send(val);
}
fn main() {
let (p,c) = std::comm::stream();
let (p,c) = comm::stream();
foo(31337, c);
assert!(p.recv() == 31337);
}

View File

@ -17,6 +17,7 @@
extern mod trait_superkinds_in_metadata;
use trait_superkinds_in_metadata::{RequiresRequiresFreezeAndSend, RequiresFreeze};
use std::comm;
#[deriving(Eq)]
struct X<T>(T);
@ -24,12 +25,12 @@ struct X<T>(T);
impl <T: Freeze> RequiresFreeze for X<T> { }
impl <T: Freeze+Send> RequiresRequiresFreezeAndSend for X<T> { }
fn foo<T: RequiresRequiresFreezeAndSend>(val: T, chan: std::comm::Chan<T>) {
fn foo<T: RequiresRequiresFreezeAndSend>(val: T, chan: comm::Chan<T>) {
chan.send(val);
}
fn main() {
let (p,c) = std::comm::stream();
let (p,c) = comm::stream();
foo(X(31337), c);
assert!(p.recv() == X(31337));
}

View File

@ -12,16 +12,18 @@
// builtin-kinds, e.g., if a trait requires Send to implement, then
// at usage site of that trait, we know we have the Send capability.
use std::comm;
trait Foo : Send { }
impl <T: Send> Foo for T { }
fn foo<T: Foo>(val: T, chan: std::comm::Chan<T>) {
fn foo<T: Foo>(val: T, chan: comm::Chan<T>) {
chan.send(val);
}
fn main() {
let (p,c) = std::comm::stream();
let (p,c) = comm::stream();
foo(31337, c);
assert!(p.recv() == 31337);
}

View File

@ -11,8 +11,10 @@
// Tests the ability for the Self type in default methods to use
// capabilities granted by builtin kinds as supertraits.
use std::comm;
trait Foo : Send {
fn foo(self, chan: std::comm::Chan<Self>) {
fn foo(self, chan: comm::Chan<Self>) {
chan.send(self);
}
}
@ -20,7 +22,7 @@ trait Foo : Send {
impl <T: Send> Foo for T { }
fn main() {
let (p,c) = std::comm::stream();
let (p,c) = comm::stream();
1193182.foo(c);
assert!(p.recv() == 1193182);
}