rust/tests/ui/consts/issue-46553.rs

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

22 lines
314 B
Rust
Raw Normal View History

// run-pass
pub struct Data<T> {
function: fn() -> T,
}
impl<T> Data<T> {
pub const fn new(function: fn() -> T) -> Data<T> {
Data {
function: function,
}
}
}
pub static DATA: Data<i32> = Data::new(|| {
413i32
});
fn main() {
print!("{:?}", (DATA.function)());
}