Closed
Description
In C FFI it's very common to use Option<fn()>
for callbacks, but the lint #118833 doesn't fire when Option
s of function pointers are compared:
unsafe extern "C" fn func() {}
type FnPtr = unsafe extern "C" fn();
fn main() {
assert_eq!(Some::<FnPtr>(func), Some(func as unsafe extern "C" fn()));
}
This pattern is used in: https://github.com/ImageOptim/mozjpeg-rust/blob/cff5aad77c726c11f460baefc348c7279d0ee647/src/readsrc.rs#L136
Activity
Urgau commentedon Dec 19, 2024
Looks reasonable to me. Opened #134536
Rollup merge of rust-lang#134586 - Urgau:fn-ptr-lint-option, r=compil…
Unrolled build for rust-lang#134586
Rollup merge of rust-lang#134536 - Urgau:fn-ptr-option, r=compiler-er…
Rollup merge of rust-lang#134536 - Urgau:fn-ptr-option, r=compiler-er…
Rollup merge of rust-lang#134536 - Urgau:fn-ptr-option, r=compiler-er…
Unrolled build for #134536
1 remaining item