Uh oh!
There was an error while loading. Please reload this page.
Validate use of parameters in naked functions - #79411
Conversation
* Reject use of parameters inside naked function body. * Reject use of patterns inside function parameters, to emphasize role of parameters a signature declaration (mirroring existing behaviour for function declarations) and avoid generating code introducing specified bindings.
rust-highfive
commented
Nov 25, 2020
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
lcnr
commented
Nov 25, 2020
impl looks good, don't know enough about how maybe r? @bjorn3 as they get recommended by github? |
tmiasko
commented
Nov 25, 2020
The overall direction of this changes is to constrain the use of naked functions towards cases that can be reliably supported. The next step would be to permit only assembly inside the naked functions. |
bjorn3
commented
Nov 25, 2020
I probably got recommended as I recently changed
Maybe it should be allowed for
Makes sense. |
Amanieu
commented
Nov 25, 2020
No, you're supposed to access parameters directly through registers or the stack based on the function ABI. |
Amanieu
commented
Nov 25, 2020
Should we consider adding additional checks to this pass, such as the requirement that a naked function only contain a single |
tmiasko
commented
Nov 25, 2020
Yes, I think we should have additional checks along those lines. I didn't think through all the details to propose one yet. There is also a question of compatibility with |
Amanieu
commented
Nov 25, 2020
@bors r+ |
bors
commented
Nov 25, 2020
📌 Commit 22d3431 has been approved by |
bors
commented
Nov 25, 2020
bors
commented
Nov 25, 2020
☀️ Test successful - checks-actions |
Validate naked functions definitions Validate that naked functions are defined in terms of a single inline assembly block that uses only `const` and `sym` operands and has `noreturn` option. Implemented as future incompatibility lint with intention to migrate it into hard error. When it becomes a hard error it will ensure that naked functions are either unsafe or contain an unsafe block around the inline assembly. It will guarantee that naked functions do not reference functions parameters (obsoleting part of existing checks from rust-lang#79411). It will limit the definitions of naked functions to what can be reliably supported. It will also reject naked functions implemented using legacy LLVM style assembly since it cannot satisfy those conditions. rust-lang/rfcs#2774rust-lang/rfcs#2972
of parameters a signature declaration (mirroring existing behaviour
for function declarations) and avoid generating code introducing
specified bindings.
Closes issues below by considering input to be ill-formed.
Closes#75922.
Closes#77848.
Closes#79350.