-
Notifications
You must be signed in to change notification settings - Fork 1.7k
incompatible_msrv
: lint function calls with any argument count
#14216
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b04242c
to
ab08d1a
Compare
90bc6d3
to
efad358
Compare
r? @llogiq |
3fb9b88
to
c3d5f65
Compare
The lint for function calls was previously restricted to functions taking exactly one argument. This was not documented. Generalizing the lint to an arbitrary number of arguments in the function call requires special casing some macro expansions from the standard library. Macros such as `panic!()` or `assert_eq!()` exist since Rust 1.0.0, but modern stdlib expand those macros into calls to functions introduced in later Rust versions. While it is desirable to lint code inside macros, using MSRV-incompatible functions coming from `core` in macro expansions has been special-cased to not trigger this lint. Also, code coming from compiler desugaring may contain function calls (for example, `a..=b` is now desugared into `RangeInclusive::new(a, b)`. Those should not be linted either as the compiler is allowed to use unstable function calls.
c3d5f65
to
4f0e507
Compare
Rebased |
r? @Centri3 |
Will look tomorrow. |
GuillaumeGomez
approved these changes
Mar 12, 2025
Centri3
approved these changes
Mar 13, 2025
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.
oops, immediately forgot about this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The lint for function calls was previously restricted to functions taking exactly one argument. This was not documented.
Generalizing the lint to an arbitrary number of arguments in the function call requires special casing some macro expansions from the standard library. Macros such as
panic!()
orassert_eq!()
exist since Rust 1.0.0, but modern stdlib expand those macros into calls to functions introduced in later Rust versions. While it is desirable to lint code inside macros, using MSRV-incompatible functions coming fromcore
in macro expansions has been special-cased to not trigger this lint.Also, code coming from compiler desugaring may contain function calls (for example,
a..=b
is now desugared intoRangeInclusive::new(a, b)
. Those should not be linted either as the compiler is allowed to use unstable function calls.Fix #14212
changelog: [
incompatible_msrv
]: lint function calls with any argument count