about summary refs log tree commit diff
path: root/tests/ui/lint/fn-ptr-comparisons-some.rs
blob: c6ddd759baa37614cdffb619baa0b5b24ec87a91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This test checks that we lint on Option of fn ptr.
//
// https://github.com/rust-lang/rust/issues/134527.
//
//@ check-pass

unsafe extern "C" fn func() {}

type FnPtr = unsafe extern "C" fn();

fn main() {
    let _ = Some::<FnPtr>(func) == Some(func as unsafe extern "C" fn());
    //~^ WARN function pointer comparisons

    assert_eq!(Some::<FnPtr>(func), Some(func as unsafe extern "C" fn()));
    //~^ WARN function pointer comparisons
}