about summary refs log tree commit diff
path: root/compiler/rustc_error_codes/src
diff options
context:
space:
mode:
authorFolkert <folkert@folkertdev.nl>2024-07-17 10:42:24 +0200
committerFolkert <folkert@folkertdev.nl>2024-07-27 12:55:39 +0200
commitc6a166bac269eda77b595fdc8ff7290e1372c147 (patch)
tree46b7764813f597d7df6c2de3e89bb8a319b3ed24 /compiler/rustc_error_codes/src
parent4d082b77af1f714df6c407785e1961a9dddd554c (diff)
downloadrust-c6a166bac269eda77b595fdc8ff7290e1372c147.tar.gz
rust-c6a166bac269eda77b595fdc8ff7290e1372c147.zip
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
Diffstat (limited to 'compiler/rustc_error_codes/src')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0736.md15
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0798.md14
-rw-r--r--compiler/rustc_error_codes/src/lib.rs1
3 files changed, 6 insertions, 24 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0736.md b/compiler/rustc_error_codes/src/error_codes/E0736.md
index 08aa85e705d..4660d610744 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0736.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0736.md
@@ -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
diff --git a/compiler/rustc_error_codes/src/error_codes/E0798.md b/compiler/rustc_error_codes/src/error_codes/E0798.md
deleted file mode 100644
index 96f25eb4f0e..00000000000
--- a/compiler/rustc_error_codes/src/error_codes/E0798.md
+++ /dev/null
@@ -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
diff --git a/compiler/rustc_error_codes/src/lib.rs b/compiler/rustc_error_codes/src/lib.rs
index 2a7bc2501c0..d13d5e1bca2 100644
--- a/compiler/rustc_error_codes/src/lib.rs
+++ b/compiler/rustc_error_codes/src/lib.rs
@@ -536,7 +536,6 @@ E0794: 0794,
 E0795: 0795,
 E0796: 0796,
 E0797: 0797,
-E0798: 0798,
         );
     )
 }