-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Lint on fn pointers comparisons in external macros #134536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
r? compiler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it could be more generalized, but fine for now.
Specifically linting in macros seems like a much larger extension of the lint, though. Was this ever discussed by T-lang? |
Though I agree with it in theory. |
Yeah, linting on external macros made me hesitate to put it in the same PR as linting on Anyway, cc @traviscross |
@rustbot labels +I-lang-nominated +T-lang We did talk about the Here are some notes on that unanswered question, from an earlier set of minutes:
|
…er-errors Also lint on option of function pointer comparisons This PR is the first part of rust-lang#134536, ie. the linting on `Option<{fn ptr}>` in the `unpredictable_function_pointer_comparisons` lint, which isn't part of the lang nomination that the second part is going trough, and so should be able to be approved independently. Related to rust-lang#134527 r? `@compiler-errors`
Rollup merge of rust-lang#134586 - Urgau:fn-ptr-lint-option, r=compiler-errors Also lint on option of function pointer comparisons This PR is the first part of rust-lang#134536, ie. the linting on `Option<{fn ptr}>` in the `unpredictable_function_pointer_comparisons` lint, which isn't part of the lang nomination that the second part is going trough, and so should be able to be approved independently. Related to rust-lang#134527 r? `@compiler-errors`
This comment was marked as resolved.
This comment was marked as resolved.
I have extracted the This PR is now only about linting in external macros. |
This is still waiting on T-lang @rustbot team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good to go from the lang side. The impl looks good to me. What do you think, @compiler-errors?
@rustbot ready
Based on earlier approval, #134536 (review). @bors r=compiler-errors rollup |
…rors,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
@bors r=compiler-errors,traviscross rollup |
…rors,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
Rollup of 10 pull requests Successful merges: - #134536 (Lint on fn pointers comparisons in external macros) - #138164 (Infrastructure for lints during attribute parsing, specifically duplicate usages of attributes) - #141069 (Suggest mut when possbile for temporary value dropped while borrowed) - #141934 (resolve: Tweak `private_macro_use` lint to be compatible with upcoming macro prelude changes) - #142034 (Detect method not being present that is present in other tuple types) - #142402 (chore(doctest): Remove redundant blank lines) - #142406 (Note when enum variants shadow an associated function) - #142407 (Remove bootstrap adhoc group) - #142408 (Add myself (WaffleLapkin) to review rotation) - #142418 (Remove lower_arg_ty as all callers were passing `None`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - #134536 (Lint on fn pointers comparisons in external macros) - #141069 (Suggest mut when possbile for temporary value dropped while borrowed) - #141934 (resolve: Tweak `private_macro_use` lint to be compatible with upcoming macro prelude changes) - #142034 (Detect method not being present that is present in other tuple types) - #142402 (chore(doctest): Remove redundant blank lines) - #142406 (Note when enum variants shadow an associated function) - #142407 (Remove bootstrap adhoc group) - #142408 (Add myself (WaffleLapkin) to review rotation) - #142418 (Remove lower_arg_ty as all callers were passing `None`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #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 #134527
This PR extends the recently stabilized
unpredictable_function_pointer_comparisons
lintto also lint onas well as linting in external macros (as to catchOption<{function pointer}>
andassert_eq!
and others).Fixes #134527