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

Disable unused variable lint for naked functions #87740

Merged
merged 2 commits into from
Aug 5, 2021

Conversation

npmccallum
Copy link
Contributor

In most calling conventions, accessing function parameters may require
stack access. However, naked functions have no assembly prelude to set
up stack access. This is why naked functions may only contain a single
asm!() block. All parameter access is done inside the asm!() block,
so we cannot validate the liveness of the input parameters. Therefore,
we should disable the lint for naked functions.

rust-lang/rfcs#2774
rust-lang/rfcs#2972

@joshtriplett @Amanieu @haraldh

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 3, 2021
@npmccallum
Copy link
Contributor Author

r? @Amanieu

This test proves that naked functions are treated the same as regular
functions regarding unused function parameters. We will change this
behavior in the next patch.
In most calling conventions, accessing function parameters may require
stack access. However, naked functions have no assembly prelude to set
up stack access.  This is why naked functions may only contain a single
`asm!()` block. All parameter access is done inside the `asm!()` block,
so we cannot validate the liveness of the input parameters. Therefore,
we should disable the lint for naked functions.

rust-lang/rfcs#2774
rust-lang/rfcs#2972
@Amanieu
Copy link
Member

Amanieu commented Aug 4, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Aug 4, 2021

📌 Commit 9c0147c has been approved by Amanieu

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2021
@bors
Copy link
Contributor

bors commented Aug 5, 2021

⌛ Testing commit 9c0147c with merge e21e1d6...

@bors
Copy link
Contributor

bors commented Aug 5, 2021

☀️ Test successful - checks-actions
Approved by: Amanieu
Pushing e21e1d6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 5, 2021
@bors bors merged commit e21e1d6 into rust-lang:master Aug 5, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 5, 2021
@bstrie bstrie added the A-naked Area: #[naked], prologue and epilogue-free, functions, https://git.io/vAzzS label Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-naked Area: #[naked], prologue and epilogue-free, functions, https://git.io/vAzzS merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants