-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
add naked_functions_rustic_abi
feature gate
#139001
base: master
Are you sure you want to change the base?
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 |
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