]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-fn-in-const-a.rs
Rollup merge of #57859 - GuillaumeGomez:fix-background, r=QuietMisdreavus
[rust.git] / src / test / ui / borrowck / borrowck-fn-in-const-a.rs
1 // revisions: ast mir
2 //[mir]compile-flags: -Z borrowck=mir
3
4 // Check that we check fns appearing in constant declarations.
5 // Issue #22382.
6
7 const MOVE: fn(&String) -> String = {
8     fn broken(x: &String) -> String {
9         return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
10                   //[mir]~^ ERROR [E0507]
11     }
12     broken
13 };
14
15 fn main() {
16 }