1
Fork 0

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:
Folkert 2024-07-17 10:42:24 +02:00
parent 4d082b77af
commit c6a166bac2
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
16 changed files with 185 additions and 65 deletions

View file

@ -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

View file

@ -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

View file

@ -536,7 +536,6 @@ E0794: 0794,
E0795: 0795,
E0796: 0796,
E0797: 0797,
E0798: 0798,
);
)
}