-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove rustc::existing_doc_keyword
lint
#134202
Conversation
Details in individual commits. |
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This comment has been minimized.
This comment has been minimized.
7a0a3f2
to
353aff4
Compare
Some changes occurred in GUI tests. |
This comment has been minimized.
This comment has been minimized.
@@ -156,7 +156,7 @@ pub enum AnEnum { | |||
WithVariants { and: usize, sub: usize, variants: usize }, | |||
} | |||
|
|||
#[doc(keyword = "CookieMonster")] | |||
#[doc(keyword = "auto")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test now fails if the value isn't a valid keyword.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that brings this question: why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously the "is it a valid keyword?" test was done by the lint. It has now moved to check_doc_keyword
and it runs in several test cases where the lint did not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I mean, doc(keyword)
was voluntarily left "open" in what kind of keyword we could define. You changed this behaviour. That's the part I don't understand. I don't mind changing it away from being a lint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lint checked this:
fn is_doc_keyword(s: Symbol) -> bool {
s <= kw::Union
}
That hasn't changed (well, sym::SelfTy
is now also accepted, for the exception). What has changed is how often this check is being applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, my bad.
@@ -15,6 +15,6 @@ pub mod foo {} | |||
|
|||
//@ !has "$.index[*][?(@.name=='hello')]" | |||
//@ !has "$.index[*][?(@.name=='bar')]" | |||
#[doc(keyword = "hello")] | |||
#[doc(keyword = "break")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@GuillaumeGomez: the It seems like I should just be able to change
Keywords that are similar to I have viewed the generated docs in a browser. They always work fine no matter what keyword I use, and the search always works as expected. So I'm baffled. I just want to change |
// 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 auto") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's checking here the first search result. Considering that auto
might not be the first item, we'll need to tweak it a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked for that, auto
is the first item. ZookieMonster
was too, as were a bunch of other things I tried.
@@ -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", "auto") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try:
write-into: (".search-input", "auto") | |
write-into: (".search-input", "keyword:auto") |
Also you can open the generated docs with a web browser with build/[arch]/tests/rustdoc-gui/doc/lib2/index.html
and test it manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try the keyword change on Monday. I did already try testing manually in a browser, it always worked fine no matter what I tried. That's why it was so baffling why some things worked but most didn't -- I could find an explanation to explain the success/failure differences.
Found the issue in |
I pushed a fix to your branch. To keep the |
Thank you! It was the |
I'm happy for this to merge if you are. |
I am too so let's go! @bors r=GuillaumeGomez,nnethercote |
…d, r=GuillaumeGomez,nnethercote Remove `rustc::existing_doc_keyword` lint The check doesn't require a lint. r? `@GuillaumeGomez`
…llaumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#134111 (Fix `--nocapture` for run-make tests) - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134314 (Make sure to use normalized ty for unevaluated const in default struct value) - rust-lang#134329 (Add m68k_target_feature) - rust-lang#134342 (crashes: more tests) - rust-lang#134354 (Handle fndef rendering together with signature rendering) Failed merges: - rust-lang#133265 (Add a range argument to vec.extract_if) r? `@ghost` `@rustbot` modify labels: rollup
…d, r=GuillaumeGomez,nnethercote Remove `rustc::existing_doc_keyword` lint The check doesn't require a lint. r? ``@GuillaumeGomez``
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134314 (Make sure to use normalized ty for unevaluated const in default struct value) - rust-lang#134342 (crashes: more tests) - rust-lang#134354 (Handle fndef rendering together with signature rendering) r? `@ghost` `@rustbot` modify labels: rollup
…d, r=GuillaumeGomez,nnethercote Remove `rustc::existing_doc_keyword` lint The check doesn't require a lint. r? ```@GuillaumeGomez```
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134354 (Handle fndef rendering together with signature rendering) - rust-lang#134368 (Use links to edition guide for edition migrations) - rust-lang#134371 (Check for array lengths that aren't actually `usize`) - rust-lang#134378 (An octuple of polonius fact generation cleanups) Failed merges: - rust-lang#134365 (Rename `rustc_mir_build::build` to `builder`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134354 (Handle fndef rendering together with signature rendering) - rust-lang#134368 (Use links to edition guide for edition migrations) - rust-lang#134371 (Check for array lengths that aren't actually `usize`) - rust-lang#134378 (An octuple of polonius fact generation cleanups) Failed merges: - rust-lang#134365 (Rename `rustc_mir_build::build` to `builder`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134354 (Handle fndef rendering together with signature rendering) - rust-lang#134368 (Use links to edition guide for edition migrations) - rust-lang#134371 (Check for array lengths that aren't actually `usize`) - rust-lang#134378 (An octuple of polonius fact generation cleanups) Failed merges: - rust-lang#134365 (Rename `rustc_mir_build::build` to `builder`) r? `@ghost` `@rustbot` modify labels: rollup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bors r- until rustdoc-json text fixed.
@bors r- |
All the other unconditional keywords are in the alphabetical order, but `while` is for some reason not.
`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>
bdbaeae
to
121e87b
Compare
@bors r=GuillaumeGomez |
…d, r=GuillaumeGomez Remove `rustc::existing_doc_keyword` lint The check doesn't require a lint. r? `@GuillaumeGomez`
Rollup of 9 pull requests Successful merges: - rust-lang#133265 (Add a range argument to vec.extract_if) - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134354 (Handle fndef rendering together with signature rendering) - rust-lang#134365 (Rename `rustc_mir_build::build` to `builder`) - rust-lang#134368 (Use links to edition guide for edition migrations) - rust-lang#134388 (Update books) - rust-lang#134397 (rustc_borrowck: Suggest changing `&raw const` to `&raw mut` if applicable) - rust-lang#134398 (AIX: add alignment info for test) - rust-lang#134400 (Fix some comments related to upvars handling) Failed merges: - rust-lang#134399 (Do not do if ! else, use unnegated cond and swap the branches instead) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134354 (Handle fndef rendering together with signature rendering) - rust-lang#134365 (Rename `rustc_mir_build::build` to `builder`) - rust-lang#134368 (Use links to edition guide for edition migrations) - rust-lang#134397 (rustc_borrowck: Suggest changing `&raw const` to `&raw mut` if applicable) - rust-lang#134398 (AIX: add alignment info for test) - rust-lang#134400 (Fix some comments related to upvars handling) - rust-lang#134406 (Fix `-Z input-stats` ordering) - rust-lang#134409 (bootstrap: fix a comment) - rust-lang#134412 (small borrowck cleanup) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134202 - nnethercote:rm-existing_doc_keyword, r=GuillaumeGomez Remove `rustc::existing_doc_keyword` lint The check doesn't require a lint. r? ``@GuillaumeGomez``
The check doesn't require a lint.
r? @GuillaumeGomez