mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
22 lines
307 B
Rust
22 lines
307 B
Rust
|
// check-pass
|
||
|
|
||
|
union URes<R: Copy> {
|
||
|
uninit: (),
|
||
|
init: R,
|
||
|
}
|
||
|
|
||
|
struct Params<F, R: Copy> {
|
||
|
function: F,
|
||
|
result: URes<R>,
|
||
|
}
|
||
|
|
||
|
unsafe extern "C" fn do_call<F, R>(params: *mut Params<F, R>)
|
||
|
where
|
||
|
R: Copy,
|
||
|
F: Fn() -> R,
|
||
|
{
|
||
|
(*params).result.init = ((*params).function)();
|
||
|
}
|
||
|
|
||
|
fn main() {}
|