rust/src/test/compile-fail/impure-pred.rs

15 lines
195 B
Rust
Raw Normal View History

2011-05-04 11:32:06 -07:00
// -*- rust -*-
2011-07-27 14:19:39 +02:00
fn g() { }
2011-05-04 11:32:06 -07:00
pure fn f(_q: int) -> bool {
2012-05-24 23:44:58 -07:00
g(); //! ERROR access to impure function prohibited in pure context
ret true;
}
2011-05-04 11:32:06 -07:00
fn main() {
2011-07-27 14:19:39 +02:00
let x = 0;
2011-05-04 11:32:06 -07:00
2011-07-27 14:19:39 +02:00
check (f(x));
}