2012-05-23 06:13:54 -07:00
|
|
|
fn impure(_i: int) {}
|
|
|
|
|
2012-05-23 11:55:32 -07:00
|
|
|
// check that unchecked alone does not override borrowck:
|
2012-05-23 06:13:54 -07:00
|
|
|
fn foo(v: &const option<int>) {
|
|
|
|
alt *v {
|
|
|
|
some(i) {
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ ERROR illegal borrow unless pure: enum variant in aliasable, mutable location
|
2012-05-23 06:13:54 -07:00
|
|
|
unchecked {
|
2012-06-30 12:23:59 +01:00
|
|
|
impure(i); //~ NOTE impure due to access to impure function
|
2012-05-23 06:13:54 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
none {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar(v: &const option<int>) {
|
|
|
|
alt *v {
|
|
|
|
some(i) {
|
|
|
|
unsafe {
|
|
|
|
impure(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
none {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|