-
Notifications
You must be signed in to change notification settings - Fork 13.3k
add naked_functions_rustic_abi
feature gate
#139001
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
Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
This comment has been minimized.
This comment has been minimized.
354e101
to
fde1ca2
Compare
This comment has been minimized.
This comment has been minimized.
fde1ca2
to
e10fa77
Compare
e10fa77
to
3513fa8
Compare
declare_lint! { | ||
/// The `undefined_naked_function_abi` lint detects naked function definitions that | ||
/// either do not specify an ABI or specify the Rust ABI. | ||
/// | ||
/// ### Example | ||
/// | ||
/// ```rust | ||
/// #![feature(asm_experimental_arch, naked_functions)] | ||
/// | ||
/// use std::arch::naked_asm; | ||
/// | ||
/// #[naked] | ||
/// pub fn default_abi() -> u32 { | ||
/// unsafe { naked_asm!(""); } | ||
/// } | ||
/// | ||
/// #[naked] | ||
/// pub extern "Rust" fn rust_abi() -> u32 { | ||
/// unsafe { naked_asm!(""); } | ||
/// } | ||
/// ``` | ||
/// | ||
/// {{produces}} | ||
/// | ||
/// ### Explanation | ||
/// | ||
/// The Rust ABI is currently undefined. Therefore, naked functions should | ||
/// specify a non-Rust ABI. | ||
pub UNDEFINED_NAKED_FUNCTION_ABI, | ||
Warn, | ||
"undefined naked function ABI" | ||
} |
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.
Since this lint wasn't gated, it should be removed "properly" and marked as register_removed
over in compiler/rustc_lint/src/lib.rs
.
(Thanks to @compiler-errors for confirming this.)
This looks right in terms of what we asked for as a lang matter. With the requested change to remove the lint properly, the implementation looks reasonable to me, so please have a look and feel free to r? compiler-errors @rustbot author |
Reminder, once the PR becomes ready for a review, use |
3513fa8
to
8866af3
Compare
I've added the @rustbot ready |
@bors r=traviscross,compiler-errors |
…bi, r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: rust-lang#138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? `@traviscross`
…bi, r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: rust-lang#138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? ``@traviscross``
…enton Rollup of 12 pull requests Successful merges: - rust-lang#138744 (Add methods to TCP and UDP sockets to modify hop limit (refresh of rust-lang#94678)) - rust-lang#138962 (Expect an array when expected and acutal types are both arrays during cast) - rust-lang#139001 (add `naked_functions_rustic_abi` feature gate) - rust-lang#139379 (Use delayed bug for normalization errors in drop elaboration) - rust-lang#139582 (Various coercion cleanups) - rust-lang#139628 (Suggest remove redundant `$()?` around `vis`) - rust-lang#139644 (Micro-optimize `InstSimplify`'s `simplify_primitive_clone`) - rust-lang#139666 (cleanup `mir_borrowck`) - rust-lang#139674 (In `rustc_mir_transform`, iterate over index newtypes instead of ints) - rust-lang#139695 (compiletest: consistently use `camino::{Utf8Path,Utf8PathBuf}` throughout) - rust-lang#139722 (Move some things to rustc_type_ir) - rust-lang#139740 (Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test) r? `@ghost` `@rustbot` modify labels: rollup
…bi, r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: rust-lang#138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? ```@traviscross```
Rollup of 11 pull requests Successful merges: - rust-lang#137043 (Initial `UnsafePinned` implementation [Part 1: Libs]) - rust-lang#138962 (Expect an array when expected and acutal types are both arrays during cast) - rust-lang#139001 (add `naked_functions_rustic_abi` feature gate) - rust-lang#139379 (Use delayed bug for normalization errors in drop elaboration) - rust-lang#139582 (Various coercion cleanups) - rust-lang#139628 (Suggest remove redundant `$()?` around `vis`) - rust-lang#139644 (Micro-optimize `InstSimplify`'s `simplify_primitive_clone`) - rust-lang#139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}) - rust-lang#139674 (In `rustc_mir_transform`, iterate over index newtypes instead of ints) - rust-lang#139740 (Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test) - rust-lang#139741 (fix smir's run! doc and import) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - rust-lang#137043 (Initial `UnsafePinned` implementation [Part 1: Libs]) - rust-lang#138962 (Expect an array when expected and acutal types are both arrays during cast) - rust-lang#139001 (add `naked_functions_rustic_abi` feature gate) - rust-lang#139379 (Use delayed bug for normalization errors in drop elaboration) - rust-lang#139582 (Various coercion cleanups) - rust-lang#139628 (Suggest remove redundant `$()?` around `vis`) - rust-lang#139644 (Micro-optimize `InstSimplify`'s `simplify_primitive_clone`) - rust-lang#139674 (In `rustc_mir_transform`, iterate over index newtypes instead of ints) - rust-lang#139740 (Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test) - rust-lang#139741 (fix smir's run! doc and import) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#139001 - folkertdev:naked-function-rustic-abi, r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: rust-lang#138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? ````@traviscross````
tracking issue: #138997
Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable.
r? @traviscross