Skip to content

Commit 250a301

Browse files
authored
Rollup merge of rust-lang#134536 - Urgau:fn-ptr-option, r=compiler-errors,traviscross
Lint on fn pointers comparisons in external macros This PR extends the recently stabilized `unpredictable_function_pointer_comparisons` lint ~~to also lint on `Option<{function pointer}>` and~~ as well as linting in external macros (as to catch `assert_eq!` and others). ```rust assert_eq!(Some::<FnPtr>(func), Some(func as unsafe extern "C" fn())); //~^ WARN function pointer comparisons #[derive(PartialEq, Eq)] struct A { f: fn(), //~^ WARN function pointer comparisons } ``` Fixes rust-lang#134527
2 parents 7e06ea4 + 8c8ed8f commit 250a301

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

core/src/task/wake.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl RawWaker {
104104
/// synchronization. This is because [`LocalWaker`] is not thread safe itself, so it cannot
105105
/// be sent across threads.
106106
#[stable(feature = "futures_api", since = "1.36.0")]
107+
#[allow(unpredictable_function_pointer_comparisons)]
107108
#[derive(PartialEq, Copy, Clone, Debug)]
108109
pub struct RawWakerVTable {
109110
/// This function will be called when the [`RawWaker`] gets cloned, e.g. when

0 commit comments

Comments
 (0)