Skip to content

Commit b938394

Browse files
committed
new test
1 parent e0f59e8 commit b938394

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// xfail-fast (compile-flags unsupported on windows)
2+
// compile-flags:--borrowck=err
3+
4+
fn impure(_i: int) {}
5+
6+
fn foo(v: &const option<int>) {
7+
alt *v {
8+
some(i) {
9+
//!^ NOTE pure context is required due to an illegal borrow: enum variant in aliasable, mutable location
10+
// check that unchecked alone does not override borrowck:
11+
unchecked {
12+
impure(i); //! ERROR access to non-pure functions prohibited in a pure context
13+
}
14+
}
15+
none {
16+
}
17+
}
18+
}
19+
20+
fn bar(v: &const option<int>) {
21+
alt *v {
22+
some(i) {
23+
unsafe {
24+
impure(i);
25+
}
26+
}
27+
none {
28+
}
29+
}
30+
}
31+
32+
fn main() {
33+
}

0 commit comments

Comments
 (0)