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] `
2
9
3
10
Erroneous code example:
4
11
5
12
``` compile_fail,E0736
13
+ #[inline]
6
14
#[naked]
7
- #[track_caller]
8
15
fn foo() {}
9
16
```
10
17
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.
13
23
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
2
2
3
3
Erroneous code example:
4
4
You can’t perform that action at this time.
0 commit comments