-
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
Auto-generate lint documentation. #76549
Conversation
I have the following concerns about my approach which I would like some feedback on:
|
0871da1
to
6d82ebb
Compare
This comment has been minimized.
This comment has been minimized.
6d82ebb
to
4e9ff50
Compare
This comment has been minimized.
This comment has been minimized.
4e9ff50
to
8c8337b
Compare
I think the benefit of having the documentation alongside the lint outweighs any concerns I have about the file length. We should just break those files up as they approach the limit.
I personally think the docs are pretty useful to have right next to the definition so I don't mind this.
I'm not opposed to this but I do agree with your concerns.
I think linking to the rustdoc book would be fine.
The scraping is a bit hacky so I think this is a good idea but I don't think it needs to block this PR. I would be ok with landing this as-is and filing an issue for that enhancement if you don't want to do that in this PR. |
8c8337b
to
886b997
Compare
Thanks for the feedback! Sounds good to me. I changed the rustdoc lints to just be links to the rustdoc book. As for the extraction method, I think I'd like to stick with this for now and maybe transition to a |
@bors r+ |
📌 Commit 886b9970eb4e06698b91c848111a628ed3c44dc5 has been approved by |
⌛ Testing commit 886b9970eb4e06698b91c848111a628ed3c44dc5 with merge 7e5161b068ee2258497ed540c0de0e51e7925b94... |
💔 Test failed - checks-actions |
ef47fcf
to
c049735
Compare
…tecture pointer size.
@wesleywiser I forgot to make the |
Looks great! @bors r+ |
📌 Commit 49a61f5 has been approved by |
☀️ Test successful - checks-actions, checks-azure |
…ist, r=alexcrichton Fix cross compiling dist/build invocations I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build. Both commits are standalone; together they should resolve rust-lang#76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in rust-lang#76549.
…ist, r=alexcrichton Fix cross compiling dist/build invocations I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build. Both commits are standalone; together they should resolve rust-lang#76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in rust-lang#76549.
…ist, r=alexcrichton Fix cross compiling dist/build invocations I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build. Both commits are standalone; together they should resolve rust-lang#76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in rust-lang#76549.
…ist, r=alexcrichton Fix cross compiling dist/build invocations I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build. Both commits are standalone; together they should resolve rust-lang#76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in rust-lang#76549.
…ist, r=alexcrichton Fix cross compiling dist/build invocations I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build. Both commits are standalone; together they should resolve rust-lang#76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in rust-lang#76549.
…t, r=alexcrichton Fix cross compiling dist/build invocations I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build. Both commits are standalone; together they should resolve rust-lang#76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in rust-lang#76549.
@ehuss |
Also the check runs on |
@petrochenkov Sorry this is causing problems. I tried to make the documentation on Removing it from I'm not sure I understand the issue about |
Ok, some user experience report! (From #79078).
|
I guess the conclusions are:
|
I see, that does sound frustrating! I'll take a look at a few different things:
|
I moved lint definitions to the new |
…imulacrum Validate lint docs separately. This addresses some concerns raised in rust-lang#76549 (comment) about errors with the lint docs being confusing and cumbersome. Errors from validating the lint documentation were being generated during `x.py doc` (and `x.py dist`), since extraction and validation are being done in a single step. This changes it so that extraction and validation are separated, so that `x.py doc` will not error if there is a validation problem, and tests are moved to `x.py test src/tools/lint-docs`. This includes the following changes: * Separate validation to `x.py test`. * Added some more documentation on how to more easily modify and test the docs. * Added more help to the error messages to hopefully provide more information on how to fix things. The first commit just moves the code around, so you may consider looking at the other commits for a smaller diff.
…imulacrum Validate lint docs separately. This addresses some concerns raised in rust-lang#76549 (comment) about errors with the lint docs being confusing and cumbersome. Errors from validating the lint documentation were being generated during `x.py doc` (and `x.py dist`), since extraction and validation are being done in a single step. This changes it so that extraction and validation are separated, so that `x.py doc` will not error if there is a validation problem, and tests are moved to `x.py test src/tools/lint-docs`. This includes the following changes: * Separate validation to `x.py test`. * Added some more documentation on how to more easily modify and test the docs. * Added more help to the error messages to hopefully provide more information on how to fix things. The first commit just moves the code around, so you may consider looking at the other commits for a smaller diff.
…imulacrum Validate lint docs separately. This addresses some concerns raised in rust-lang#76549 (comment) about errors with the lint docs being confusing and cumbersome. Errors from validating the lint documentation were being generated during `x.py doc` (and `x.py dist`), since extraction and validation are being done in a single step. This changes it so that extraction and validation are separated, so that `x.py doc` will not error if there is a validation problem, and tests are moved to `x.py test src/tools/lint-docs`. This includes the following changes: * Separate validation to `x.py test`. * Added some more documentation on how to more easily modify and test the docs. * Added more help to the error messages to hopefully provide more information on how to fix things. The first commit just moves the code around, so you may consider looking at the other commits for a smaller diff.
This adds a tool which will generate the lint documentation in the rustc book automatically. This is motivated by keeping the documentation up-to-date, and consistently formatted. It also ensures the examples are correct and that they actually generate the expected lint. The lint groups table is also auto-generated. See rust-lang/compiler-team#349 for the original proposal.
An outline of how this works:
declare_lint!
macro now accepts a doc comment where the documentation is written. This is inspired by how clippy works.src/tools/lint-docs
scrapes the documentation and adds it to the rustc book during the build.rustc -W help
.I updated the documentation for all the missing lints. I have also added an "Explanation" section to each lint providing a reason for the lint and suggestions on how to resolve it.
This can lead towards a future enhancement of possibly showing these docs via the
--explain
flag to make them easily accessible and discoverable.