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

add naked_functions_rustic_abi feature gate #139001

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

folkertdev
Copy link
Contributor

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

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2025

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

@rust-log-analyzer

This comment has been minimized.

@folkertdev folkertdev force-pushed the naked-function-rustic-abi branch from 354e101 to fde1ca2 Compare March 26, 2025 19:15
@rust-log-analyzer

This comment has been minimized.

@folkertdev folkertdev force-pushed the naked-function-rustic-abi branch from fde1ca2 to e10fa77 Compare March 26, 2025 20:47
@traviscross traviscross force-pushed the naked-function-rustic-abi branch from e10fa77 to 3513fa8 Compare April 6, 2025 15:59
Comment on lines -2833 to -2864
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"
}
Copy link
Contributor

@traviscross traviscross Apr 7, 2025

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.)

@traviscross
Copy link
Contributor

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=me along with your own review:

r? compiler-errors
(since you've already glanced at this)

@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 7, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 7, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 7, 2025
@folkertdev folkertdev force-pushed the naked-function-rustic-abi branch from 3513fa8 to 8866af3 Compare April 7, 2025 19:42
@folkertdev
Copy link
Contributor Author

I've added the register_removed lines, linking to this PR, and the test case that removed lints should have

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants