rust/src/test/compile-fail/purity-infer-fail.rs

7 lines
171 B
Rust
Raw Normal View History

fn something(f: pure fn()) { f(); }
fn main() {
let mut x = ~[];
something(|| vec::push(x, 0) ); //~ ERROR access to impure function prohibited in pure context
}