rust/src/test/compile-fail/borrowck-unchecked-with-borrow.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

30 lines
535 B
Rust

fn impure(_i: int) {}
// check that unchecked alone does not override borrowck:
fn foo(v: &const option<int>) {
alt *v {
some(i) {
//~^ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location
unchecked {
impure(i); //~ NOTE impure due to access to impure function
}
}
none {
}
}
}
fn bar(v: &const option<int>) {
alt *v {
some(i) {
unsafe {
impure(i);
}
}
none {
}
}
}
fn main() {
}