-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Improve missing_abi lint #132357
Improve missing_abi lint #132357
Conversation
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.
LGTM, and happy to approve this if and when it is approved on the lang side.
Would like to see some explicit tests exercising that this does in fact error in edition 2024, and perhaps also exercising the error on free extern functions (extern fn() {}
) vs extern blocks.
Well, seems like from the RFC that this may be too late for 2024: rust-lang/rfcs#3722 (comment). However, it would be very cool to pull out the edition-independent parts of this -- the change to make the suggestion applicable can still be applied to the lint, and storing the extern span seems nice to do anyways. |
Updated. Removed the edition stuff. This now just improves the lint. I'll send a separate PR to make it warn-by-default that can then be FCP'd. |
extern
in Rust 2024
@bors r+ |
…rrors Improve missing_abi lint This is for the migration lint for rust-lang/rfcs#3722 It is not yet marked as an edition migration lint, because `Edition2027` doesn't exist yet. The lint now includes a machine applicable suggestion: ``` warning: extern declarations without an explicit ABI are deprecated --> src/main.rs:3:1 | 3 | extern fn a() {} | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` | ```
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#131168 (Fix `target_os` for `mipsel-sony-psx`) - rust-lang#132209 (Fix validation when lowering `?` trait bounds) - rust-lang#132357 (Improve missing_abi lint) - rust-lang#132385 (compiler: Move `rustc_target::spec::abi::Abi` to `rustc_abi::ExternAbi`) - rust-lang#132417 (macOS: Document the difference between Clang's `-darwin` and `-macosx` targets) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 9 pull requests Successful merges: - rust-lang#131168 (Fix `target_os` for `mipsel-sony-psx`) - rust-lang#132209 (Fix validation when lowering `?` trait bounds) - rust-lang#132294 (Bump Fuchsia) - rust-lang#132357 (Improve missing_abi lint) - rust-lang#132385 (compiler: Move `rustc_target::spec::abi::Abi` to `rustc_abi::ExternAbi`) - rust-lang#132403 (continue `TypingMode` refactor) - rust-lang#132417 (macOS: Document the difference between Clang's `-darwin` and `-macosx` targets) - rust-lang#132421 (Remove `""` case from RISC-V `llvm_abiname` match statement) - rust-lang#132422 (llvm: Match new LLVM 128-bit integer alignment on sparc) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132357 - m-ou-se:explicit-abi, r=compiler-errors Improve missing_abi lint This is for the migration lint for rust-lang/rfcs#3722 It is not yet marked as an edition migration lint, because `Edition2027` doesn't exist yet. The lint now includes a machine applicable suggestion: ``` warning: extern declarations without an explicit ABI are deprecated --> src/main.rs:3:1 | 3 | extern fn a() {} | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` | ```
This is for the migration lint for rust-lang/rfcs#3722
It is not yet marked as an edition migration lint, because
Edition2027
doesn't exist yet.The lint now includes a machine applicable suggestion: