Skip to content

Commit

Permalink
oops v2, apparently writing std::comm::stream() doesn't work on check…
Browse files Browse the repository at this point in the history
…-fast; fix this
  • Loading branch information
bblum committed Aug 22, 2013
1 parent 22ad36d commit b795fab
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/test/compile-fail/builtin-superkinds-self-type.rs
Expand Up @@ -11,16 +11,18 @@
// 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`
}
}

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);
}
Expand Up @@ -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);
}
5 changes: 3 additions & 2 deletions src/test/run-pass/builtin-superkinds-capabilities-xc.rs
Expand Up @@ -17,19 +17,20 @@

extern mod trait_superkinds_in_metadata;
use trait_superkinds_in_metadata::{RequiresRequiresFreezeAndSend, RequiresFreeze};
use std::comm;

#[deriving(Eq)]
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));
}
6 changes: 4 additions & 2 deletions src/test/run-pass/builtin-superkinds-capabilities.rs
Expand Up @@ -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);
}
6 changes: 4 additions & 2 deletions src/test/run-pass/builtin-superkinds-self-type.rs
Expand Up @@ -11,16 +11,18 @@
// 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);
}
}

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);
}

5 comments on commit b795fab

@bors
Copy link
Contributor

@bors bors commented on b795fab Aug 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from nikomatsakis
at bblum@b795fab

@bors
Copy link
Contributor

@bors bors commented on b795fab Aug 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging bblum/rust/superkinds = b795fab into auto

@bors
Copy link
Contributor

@bors bors commented on b795fab Aug 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bblum/rust/superkinds = b795fab merged ok, testing candidate = 3ddfb72

@bors
Copy link
Contributor

@bors bors commented on b795fab Aug 22, 2013

@bors
Copy link
Contributor

@bors bors commented on b795fab Aug 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 3ddfb72

Please sign in to comment.