rust/tests/ui/consts/const-fn-method.rs

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

17 lines
261 B
Rust
Raw Normal View History

// run-pass
2015-05-29 08:42:32 -05:00
struct Foo { value: u32 }
impl Foo {
const fn new() -> Foo {
Foo { value: 22 }
}
}
const FOO: Foo = Foo::new();
pub fn main() {
assert_eq!(FOO.value, 22);
let _: [&'static str; Foo::new().value as usize] = ["hey"; 22];
}