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:
@@ -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
|
||||
Reference in New Issue
Block a user