From 121e87bf1490f0258bdb354eb8c4e891ebb7e7e7 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 12 Dec 2024 13:57:46 +1100 Subject: 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 --- tests/rustdoc/keyword.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/keyword.rs b/tests/rustdoc/keyword.rs index 519e1944bc7..8f86c8ffd38 100644 --- a/tests/rustdoc/keyword.rs +++ b/tests/rustdoc/keyword.rs @@ -16,7 +16,7 @@ /// this is a test! mod foo{} -//@ has foo/keyword.foo.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello' -#[doc(keyword = "foo")] +//@ has foo/keyword.break.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello' +#[doc(keyword = "break")] /// hello mod bar {} -- cgit 1.4.1-3-g733a5