rust/src/test/run-pass/unique-kinds.rs

62 lines
816 B
Rust
Raw Normal View History

2012-08-27 18:26:35 -05:00
use cmp::Eq;
fn sendable() {
fn f<T: Send Eq>(i: T, j: T) {
assert i == j;
}
fn g<T: Send Eq>(i: T, j: T) {
assert i != j;
}
let i = ~100;
let j = ~100;
f(i, j);
let i = ~100;
let j = ~101;
g(i, j);
}
fn copyable() {
fn f<T: Copy Eq>(i: T, j: T) {
assert i == j;
}
fn g<T: Copy Eq>(i: T, j: T) {
assert i != j;
}
let i = ~100;
let j = ~100;
f(i, j);
let i = ~100;
let j = ~101;
g(i, j);
}
fn noncopyable() {
2012-08-27 18:26:35 -05:00
fn f<T: Eq>(i: T, j: T) {
assert i == j;
}
2012-08-27 18:26:35 -05:00
fn g<T: Eq>(i: T, j: T) {
assert i != j;
}
let i = ~100;
let j = ~100;
f(i, j);
let i = ~100;
let j = ~101;
g(i, j);
}
fn main() {
sendable();
copyable();
noncopyable();
}