rust/tests/ui/coercion/cast-higher-ranked-unsafe-fn-ptr.rs
2024-08-19 21:26:10 -04:00

15 lines
338 B
Rust

//@ check-pass
fn higher_ranked_fndef(ctx: &mut ()) {}
fn test(higher_ranked_fnptr: fn(&mut ())) {
fn as_unsafe<T>(_: unsafe fn(T)) {}
// Make sure that we can cast higher-ranked fn items and pointers to
// a non-higher-ranked target.
as_unsafe(higher_ranked_fndef);
as_unsafe(higher_ranked_fnptr);
}
fn main() {}