We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e0f59e8 commit b938394Copy full SHA for b938394
src/test/compile-fail/borrowck-unchecked-with-borrow.rs
@@ -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
22
23
+ unsafe {
24
+ impure(i);
25
26
27
28
29
30
31
32
+fn main() {
33
0 commit comments