Skip to content

Lint on fn pointers comparisons in external macros#134536

Merged
bors merged 2 commits intorust-lang:masterfrom
Urgau:fn-ptr-option
Jun 13, 2025
Merged

Lint on fn pointers comparisons in external macros#134536
bors merged 2 commits intorust-lang:masterfrom
Urgau:fn-ptr-option

Conversation

@Urgau
Copy link
Copy Markdown
Member

@Urgau Urgau commented Dec 19, 2024

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).

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 #134527

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unpredictable_function_pointer_comparisons doesn't lint against Option<fn()>