rust/src/test/compile-fail/fn-variance-1.rs
Gareth Daniel Smith 6d86969260 change the test suite //! kind syntax to //~ kind in order to avoid a
conflict with the new single-line-sugared-inner-doc-comment (`//! ...`).
2012-06-30 12:23:59 +01:00

18 lines
406 B
Rust

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() {
apply(@3, takes_mut); //~ ERROR (values differ in mutability)
apply(@3, takes_const);
apply(@3, takes_imm);
apply(@mut 3, takes_mut);
apply(@mut 3, takes_const);
apply(@mut 3, takes_imm); //~ ERROR (values differ in mutability)
}