os-rust/tests/ui/borrowck/borrowck-fn-in-const-a.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
274 B
Rust
Raw Normal View History

// Check that we check fns appearing in constant declarations.
// Issue #22382.
const MOVE: fn(&String) -> String = {
fn broken(x: &String) -> String {
return *x //~ ERROR cannot move
}
broken
};
fn main() {
2024-03-13 00:02:45 +00:00
println!("{}", MOVE(&String::new()));
}