Expand mismatched_target_os lint to check macro position usage#8192
Expand mismatched_target_os lint to check macro position usage#8192fanzeyi wants to merge 2 commits intorust-lang:masterfrom
Conversation
This PR teaches lint rule `mismatched_target_os` to check for missing target_os in `cfg!` macros and suggesting fixes with the correct usage.
|
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. |
|
Oops, there are some panics with the entire test suite. I am working on fixing those now. Sorry about it. |
|
☔ The latest upstream changes (presumably #8196) made this pull request unmergeable. Please resolve the merge conflicts. |
|
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 |
|
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) |
changelog: improving [
mismatched_target_os] to checkcfg!macro usage.fixes #7839