rust/tests/ui/union/issue-99375.rs

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

22 lines
308 B
Rust
Raw Normal View History

//@ 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() {}