2012-09-18 17:52:21 -05:00
|
|
|
#[legacy_modes];
|
|
|
|
|
2012-03-24 23:24:47 -05:00
|
|
|
fn takes_mut(&&x: @mut int) { }
|
|
|
|
fn takes_const(&&x: @const int) { }
|
|
|
|
fn takes_imm(&&x: @int) { }
|
|
|
|
|
|
|
|
fn apply<T>(t: T, f: fn(T)) {
|
|
|
|
f(t)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2012-06-30 06:23:59 -05:00
|
|
|
apply(@3, takes_mut); //~ ERROR (values differ in mutability)
|
2012-03-24 23:24:47 -05:00
|
|
|
apply(@3, takes_const);
|
|
|
|
apply(@3, takes_imm);
|
|
|
|
|
|
|
|
apply(@mut 3, takes_mut);
|
|
|
|
apply(@mut 3, takes_const);
|
2012-06-30 06:23:59 -05:00
|
|
|
apply(@mut 3, takes_imm); //~ ERROR (values differ in mutability)
|
2012-03-24 23:24:47 -05:00
|
|
|
}
|