update text for E0736 and E0739

This commit is contained in:
Folkert 2024-07-16 22:06:34 +02:00
parent d3dd34a1d4
commit ceec6ddf9e
No known key found for this signature in database
GPG Key ID: 1F17F6FFD112B97C
2 changed files with 16 additions and 6 deletions

View File

@ -1,14 +1,24 @@
`#[track_caller]` and `#[naked]` cannot both be applied to the same function.
Functions marked with the `#[naked]` attribute are restricted in what other
code generation attributes they may be marked with.
The following code generation attributes are incompatible with `#[naked]`:
* `#[inline]`
* `#[track_caller]`
* `#[target_feature]`
Erroneous code example:
```compile_fail,E0736
#[inline]
#[naked]
#[track_caller]
fn foo() {}
```
This is primarily due to ABI incompatibilities between the two attributes.
See [RFC 2091] for details on this and other limitations.
These incompatibilities are due to the fact that naked functions deliberately
impose strict restrictions regarding the code that the compiler is
allowed to produce for this function.
[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
See [the reference page for codegen attributes] for more information.
[the reference page for codegen attributes]: https://doc.rust-lang.org/reference/attributes/codegen.html

View File

@ -1,4 +1,4 @@
`#[track_caller]` can not be applied on struct.
`#[track_caller]` must be applied to a function
Erroneous code example: