rust/tests/ui/closures/closure-no-fn-3.rs

9 lines
237 B
Rust
Raw Normal View History

2017-02-23 15:31:21 -06:00
// Ensure that capturing closures are never coerced to fns
// Especially interesting as non-capturing closures can be.
fn main() {
let b = 0u8;
let baz: fn() -> u8 = (|| { b }) as fn() -> u8;
2017-06-09 15:04:29 -05:00
//~^ ERROR non-primitive cast
2017-02-23 15:31:21 -06:00
}