2011-11-18 05:39:20 -06:00
|
|
|
fn sendable() {
|
2011-09-22 17:28:49 -05:00
|
|
|
|
2012-01-05 08:35:37 -06:00
|
|
|
fn f<T: send>(i: T, j: T) {
|
2011-09-22 17:28:49 -05:00
|
|
|
assert i == j;
|
|
|
|
}
|
|
|
|
|
2012-01-05 08:35:37 -06:00
|
|
|
fn g<T: send>(i: T, j: T) {
|
2011-09-22 17:28:49 -05:00
|
|
|
assert i != j;
|
|
|
|
}
|
|
|
|
|
|
|
|
let i = ~100;
|
|
|
|
let j = ~100;
|
|
|
|
f(i, j);
|
|
|
|
let i = ~100;
|
|
|
|
let j = ~101;
|
|
|
|
g(i, j);
|
|
|
|
}
|
|
|
|
|
2011-11-18 05:39:20 -06:00
|
|
|
fn copyable() {
|
2011-09-22 17:28:49 -05:00
|
|
|
|
2012-01-05 08:35:37 -06:00
|
|
|
fn f<T: copy>(i: T, j: T) {
|
2011-09-22 17:28:49 -05:00
|
|
|
assert i == j;
|
|
|
|
}
|
|
|
|
|
2012-01-05 08:35:37 -06:00
|
|
|
fn g<T: copy>(i: T, j: T) {
|
2011-09-22 17:28:49 -05:00
|
|
|
assert i != j;
|
|
|
|
}
|
|
|
|
|
|
|
|
let i = ~100;
|
|
|
|
let j = ~100;
|
|
|
|
f(i, j);
|
|
|
|
let i = ~100;
|
|
|
|
let j = ~101;
|
|
|
|
g(i, j);
|
|
|
|
}
|
|
|
|
|
2011-11-18 05:39:20 -06:00
|
|
|
fn noncopyable() {
|
2011-09-22 17:28:49 -05:00
|
|
|
|
2011-11-18 05:39:20 -06:00
|
|
|
fn f<T>(i: T, j: T) {
|
2011-09-22 17:28:49 -05:00
|
|
|
assert i == j;
|
|
|
|
}
|
|
|
|
|
2011-11-18 05:39:20 -06:00
|
|
|
fn g<T>(i: T, j: T) {
|
2011-09-22 17:28:49 -05:00
|
|
|
assert i != j;
|
|
|
|
}
|
|
|
|
|
|
|
|
let i = ~100;
|
|
|
|
let j = ~100;
|
|
|
|
f(i, j);
|
|
|
|
let i = ~100;
|
|
|
|
let j = ~101;
|
|
|
|
g(i, j);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2011-11-18 05:39:20 -06:00
|
|
|
sendable();
|
|
|
|
copyable();
|
|
|
|
noncopyable();
|
|
|
|
}
|