From ceec6ddf9e2d4a41828fce4587180029588ae8eb Mon Sep 17 00:00:00 2001 From: Folkert Date: Tue, 16 Jul 2024 22:06:34 +0200 Subject: [PATCH] update text for E0736 and E0739 --- .../src/error_codes/E0736.md | 20 ++++++++++++++----- .../src/error_codes/E0739.md | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_error_codes/src/error_codes/E0736.md b/compiler/rustc_error_codes/src/error_codes/E0736.md index 0f3d41ba66d..08aa85e705d 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0736.md +++ b/compiler/rustc_error_codes/src/error_codes/E0736.md @@ -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 diff --git a/compiler/rustc_error_codes/src/error_codes/E0739.md b/compiler/rustc_error_codes/src/error_codes/E0739.md index 8d9039bef93..406d3d52779 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0739.md +++ b/compiler/rustc_error_codes/src/error_codes/E0739.md @@ -1,4 +1,4 @@ -`#[track_caller]` can not be applied on struct. +`#[track_caller]` must be applied to a function Erroneous code example: