Skip to content
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

Expand mismatched_target_os lint to check macro position usage #8192

Closed
wants to merge 2 commits into from

Conversation

fanzeyi
Copy link

@fanzeyi fanzeyi commented Dec 29, 2021

changelog: improving [mismatched_target_os] to check cfg! macro usage.

fixes #7839

This PR teaches lint rule `mismatched_target_os` to check for missing
target_os in `cfg!` macros and suggesting fixes with the correct usage.
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 29, 2021
@fanzeyi
Copy link
Author

fanzeyi commented Dec 29, 2021

Oops, there are some panics with the entire test suite. I am working on fixing those now. Sorry about it.

@bors
Copy link
Collaborator

bors commented Dec 30, 2021

☔ The latest upstream changes (presumably #8196) made this pull request unmergeable. Please resolve the merge conflicts.

@flip1995
Copy link
Member

flip1995 commented Jan 12, 2022

I'm not sure if doing this is a good idea. We try to get rid of pre-expansion passes, since they are semi-deprecated in rustc. This would add another dependency on pre-expansion passes. I lean towards not doing this.

EDIT: I asked about this on Zulip

@flip1995 flip1995 added S-needs-discussion Status: Needs further discussion before merging or work can be started and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Jan 12, 2022
@flip1995
Copy link
Member

Even though there wasn't much discussion on the Zulip thread, I think we shouldn't introduce more code into pre-expansion passes.

FYI: This kind of check is planned to get implemented in rustc: rust-lang/rust#82450, with an WIP PR already open here: rust-lang/rust#89346

I'm therefore closing this PR. Thanks for the work you've done so far! (The rustc PR seems stale, so if you want to continue to work on something in that direction, you may offer you're expertise there)

@flip1995 flip1995 closed this Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-needs-discussion Status: Needs further discussion before merging or work can be started
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mismatched_target_os false negative when using the cfg macro instead of the attribute.
4 participants