mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +00:00
17 lines
261 B
Rust
17 lines
261 B
Rust
// run-pass
|
|
|
|
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];
|
|
}
|