]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-fn-method.rs
Rollup merge of #106949 - compiler-errors:is-poly, r=BoxyUwU
[rust.git] / tests / ui / consts / const-fn-method.rs
1 // run-pass
2
3 struct Foo { value: u32 }
4
5 impl Foo {
6     const fn new() -> Foo {
7         Foo { value: 22 }
8     }
9 }
10
11 const FOO: Foo = Foo::new();
12
13 pub fn main() {
14     assert_eq!(FOO.value, 22);
15     let _: [&'static str; Foo::new().value as usize] = ["hey"; 22];
16 }