diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-12-12 13:57:46 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-12-17 13:56:10 +1100 |
| commit | 121e87bf1490f0258bdb354eb8c4e891ebb7e7e7 (patch) | |
| tree | 949a273bcd41aaceee9a86689e885effc5e0160a /tests/rustdoc-gui | |
| parent | f10169c4ec5cc7b059217db7471cb13448b1207e (diff) | |
| download | rust-121e87bf1490f0258bdb354eb8c4e891ebb7e7e7.tar.gz rust-121e87bf1490f0258bdb354eb8c4e891ebb7e7e7.zip | |
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-gui')
| -rw-r--r-- | tests/rustdoc-gui/search-result-color.goml | 3 | ||||
| -rw-r--r-- | tests/rustdoc-gui/search-result-keyword.goml | 4 | ||||
| -rw-r--r-- | tests/rustdoc-gui/search-tab.goml | 2 | ||||
| -rw-r--r-- | tests/rustdoc-gui/src/test_docs/lib.rs | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index e8da43eb896..e6dd504d703 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -140,7 +140,8 @@ define-function: ( }, ) -go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo" +// Searching for the `for` keyword +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=fo" // This is needed so that the text color is computed. show-text: true diff --git a/tests/rustdoc-gui/search-result-keyword.goml b/tests/rustdoc-gui/search-result-keyword.goml index 370edce2ddd..02305f2587c 100644 --- a/tests/rustdoc-gui/search-result-keyword.goml +++ b/tests/rustdoc-gui/search-result-keyword.goml @@ -1,8 +1,8 @@ // Checks that the "keyword" results have the expected text alongside them. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write-into: (".search-input", "CookieMonster") +write-into: (".search-input", "for") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... wait-for: "#search-tabs" -assert-text: (".result-keyword .result-name", "keyword CookieMonster") +assert-text: (".result-keyword .result-name", "keyword for") diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml index 4329726398c..3879c127fd0 100644 --- a/tests/rustdoc-gui/search-tab.goml +++ b/tests/rustdoc-gui/search-tab.goml @@ -78,7 +78,7 @@ call-function: ("check-colors", { set-window-size: (851, 600) // Check the size and count in tabs -assert-text: ("#search-tabs > button:nth-child(1) > .count", " (25) ") +assert-text: ("#search-tabs > button:nth-child(1) > .count", " (26) ") assert-text: ("#search-tabs > button:nth-child(2) > .count", " (6) ") assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0) ") store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth}) diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index 91aa2c3fae5..dae13d9ac18 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -156,7 +156,7 @@ pub enum AnEnum { WithVariants { and: usize, sub: usize, variants: usize }, } -#[doc(keyword = "CookieMonster")] +#[doc(keyword = "for")] /// Some keyword. pub mod keyword {} |
