about summary refs log tree commit diff
path: root/tests/rustdoc-json
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-12-12 13:57:46 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-12-17 13:56:10 +1100
commit121e87bf1490f0258bdb354eb8c4e891ebb7e7e7 (patch)
tree949a273bcd41aaceee9a86689e885effc5e0160a /tests/rustdoc-json
parentf10169c4ec5cc7b059217db7471cb13448b1207e (diff)
Remove `rustc::existing_doc_keyword` lint.
`CheckAttrVisitor::check_doc_keyword` checks `#[doc(keyword = "..")]`
attributes to ensure they are on an empty module, and that the value is
a non-empty identifier.

The `rustc::existing_doc_keyword` lint checks these attributes to ensure
that the value is the name of a keyword.

It's silly to have two different checking mechanisms for these
attributes. This commit does the following.
- Changes `check_doc_keyword` to check that the value is the name of a
  keyword (avoiding the need for the identifier check, which removes a
  dependency on `rustc_lexer`).
- Removes the lint.
- Updates tests accordingly.

There is one hack: the `SelfTy` FIXME case used to used to be handled by
disabling the lint, but now is handled with a special case in
`is_doc_keyword`. That hack will go away if/when the FIXME is fixed.

Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
Diffstat (limited to 'tests/rustdoc-json')
-rw-r--r--tests/rustdoc-json/keyword.rs4
-rw-r--r--tests/rustdoc-json/keyword_private.rs6
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/rustdoc-json/keyword.rs b/tests/rustdoc-json/keyword.rs
index 7a820cd1487..8a2130f1978 100644
--- a/tests/rustdoc-json/keyword.rs
+++ b/tests/rustdoc-json/keyword.rs
@@ -13,8 +13,8 @@
 /// this is a test!
 pub mod foo {}
 
-//@ !has "$.index[*][?(@.name=='hello')]"
+//@ !has "$.index[*][?(@.name=='break')]"
 //@ !has "$.index[*][?(@.name=='bar')]"
-#[doc(keyword = "hello")]
+#[doc(keyword = "break")]
 /// hello
 mod bar {}
diff --git a/tests/rustdoc-json/keyword_private.rs b/tests/rustdoc-json/keyword_private.rs
index 7a030041f7c..2a13bf10d5d 100644
--- a/tests/rustdoc-json/keyword_private.rs
+++ b/tests/rustdoc-json/keyword_private.rs
@@ -11,10 +11,10 @@
 /// this is a test!
 pub mod foo {}
 
-//@ !has "$.index[*][?(@.name=='hello')]"
+//@ !has "$.index[*][?(@.name=='break')]"
 //@ has "$.index[*][?(@.name=='bar')]"
-//@ is   "$.index[*][?(@.name=='bar')].attrs" '["#[doc(keyword = \"hello\")]"]'
+//@ is   "$.index[*][?(@.name=='bar')].attrs" '["#[doc(keyword = \"break\")]"]'
 //@ is   "$.index[*][?(@.name=='bar')].docs" '"hello"'
-#[doc(keyword = "hello")]
+#[doc(keyword = "break")]
 /// hello
 mod bar {}