File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
compiler/rustc_error_codes/src/error_codes Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1- ` #[track_caller] ` and ` #[naked] ` cannot both be applied to the same function.
1+ Functions marked with the ` #[naked] ` attribute are restricted in what other
2+ code generation attributes they may be marked with.
3+
4+ The following code generation attributes are incompatible with ` #[naked] ` :
5+
6+ * ` #[inline] `
7+ * ` #[track_caller] `
8+ * ` #[target_feature] `
29
310Erroneous code example:
411
512``` compile_fail,E0736
13+ #[inline]
614#[naked]
7- #[track_caller]
815fn foo() {}
916```
1017
11- This is primarily due to ABI incompatibilities between the two attributes.
12- See [ RFC 2091] for details on this and other limitations.
18+ These incompatibilities are due to the fact that naked functions deliberately
19+ impose strict restrictions regarding the code that the compiler is
20+ allowed to produce for this function.
21+
22+ See [ the reference page for codegen attributes] for more information.
1323
14- [ RFC 2091 ] : https://github.com/ rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
24+ [ the reference page for codegen attributes ] : https://doc. rust-lang.org/reference/attributes/codegen.html
Original file line number Diff line number Diff line change 1- ` #[track_caller] ` can not be applied on struct.
1+ ` #[track_caller] ` must be applied to a function
22
33Erroneous code example:
44
You can’t perform that action at this time.
0 commit comments