about summary refs log tree commit diff
path: root/tests/ui/borrowck/borrowck-fn-in-const-a.rs
blob: d52ec342b1a9034937c4d0d9318606151fc18c2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// 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() {
    println!("{}", MOVE(&String::new()));
}