switch to an allowlist approach
- merge error codes - use attribute name that is incompatible in error message - add test for conditional incompatible attribute - add `linkage` to the allowlist
This commit is contained in:
parent
4d082b77af
commit
c6a166bac2
16 changed files with 185 additions and 65 deletions
|
@ -1,11 +1,12 @@
|
|||
Functions marked with the `#[naked]` attribute are restricted in what other
|
||||
code generation attributes they may be marked with.
|
||||
attributes they may be marked with.
|
||||
|
||||
The following code generation attributes are incompatible with `#[naked]`:
|
||||
Notable attributes that are incompatible with `#[naked]` are:
|
||||
|
||||
* `#[inline]`
|
||||
* `#[track_caller]`
|
||||
* `#[target_feature]`
|
||||
* `#[inline]`
|
||||
* `#[track_caller]`
|
||||
* `#[target_feature]`
|
||||
* `#[test]`, `#[ignore]`, `#[should_panic]`
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
|
@ -18,7 +19,3 @@ fn foo() {}
|
|||
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.
|
||||
|
||||
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
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
Testing attributes cannot be applied to functions marked with `#[naked]`.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```ignore (requires test runner)
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[naked]
|
||||
fn foo() {}
|
||||
```
|
||||
|
||||
See [the reference page for testing attributes] for more information.
|
||||
|
||||
[the reference page for testing attributes]: https://doc.rust-lang.org/reference/attributes/testing.html
|
|
@ -536,7 +536,6 @@ E0794: 0794,
|
|||
E0795: 0795,
|
||||
E0796: 0796,
|
||||
E0797: 0797,
|
||||
E0798: 0798,
|
||||
);
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue