new test
This commit is contained in:
parent
e0f59e835e
commit
b93839408c
33
src/test/compile-fail/borrowck-unchecked-with-borrow.rs
Normal file
33
src/test/compile-fail/borrowck-unchecked-with-borrow.rs
Normal file
@ -0,0 +1,33 @@
|
||||
// xfail-fast (compile-flags unsupported on windows)
|
||||
// compile-flags:--borrowck=err
|
||||
|
||||
fn impure(_i: int) {}
|
||||
|
||||
fn foo(v: &const option<int>) {
|
||||
alt *v {
|
||||
some(i) {
|
||||
//!^ NOTE pure context is required due to an illegal borrow: enum variant in aliasable, mutable location
|
||||
// check that unchecked alone does not override borrowck:
|
||||
unchecked {
|
||||
impure(i); //! ERROR access to non-pure functions prohibited in a pure context
|
||||
}
|
||||
}
|
||||
none {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn bar(v: &const option<int>) {
|
||||
alt *v {
|
||||
some(i) {
|
||||
unsafe {
|
||||
impure(i);
|
||||
}
|
||||
}
|
||||
none {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
Loading…
Reference in New Issue
Block a user