-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
tidy: enforce comment blocks to have an even number of backticks #108726
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
r? @Nilstrieb |
ac50e29
to
1af3b8c
Compare
Have you measured the runtime impact of this change? |
Doing it now, I don't really see much of an impact. The three times I measured all of tidy before:
after:
That is, running |
1af3b8c
to
4612baf
Compare
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.
r=me with or without removing the FIXME
(I guess technically T-bootstrap is in charge of tidy? But this is just for the compiler, seems fine to me. whatever.)
@Nilstrieb note that there is a second fixme, see the "add two fixmes" commit. |
ab70d3e
to
4b04f76
Compare
the second one can just be deleted i guess, that comment isn't complete anyways. |
Some comments may be formed like: // This function takes a tuple `(Vec<String>, // Box<[u8]>)` and transforms it into `Vec<u8>`. where the "back-ticked" section wraps around. Therefore, we can't make a single-line based lint. We also cannot make the lint paragraph based, as it would otherwise complain about inline code blocks: /// ``` /// use super::Foo; /// /// fn main() { Foo::new(); } /// ``` For the future, one could introduce some checks to treat code blocks specially, but such code would make the check even more complicated.
Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
@Nilstrieb it should be ready now! |
4b04f76
to
b2aeb07
Compare
@bors r+ |
…r=Nilstrieb tidy: enforce comment blocks to have an even number of backticks After PR rust-lang#108694, most unmatched backticks in `compiler/` comments have been eliminated. This PR adds a tidy lint to ensure no new unmatched backticks are added, and either addresses the lint in the remaining instances it found, or allows it. Very often, backtick containing sections wrap around lines, for example: ```Rust // This function takes a tuple `(Vec<String>, // Box<[u8]>)` and transforms it into `Vec<u8>`. ``` The lint is implemented to work on top of blocks, counting each line with a `//` into a block, and counting if there are an odd or even number of backticks in the entire block, instead of looking at just a single line.
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#108726 (tidy: enforce comment blocks to have an even number of backticks) - rust-lang#108797 (Allow binary files to go through the `FileLoader`) - rust-lang#108841 (Add suggestion to diagnostic when user has array but trait wants slice. (rebased)) - rust-lang#108984 (bootstrap: document tidy) - rust-lang#109013 (Give proper error message when tcx wasn't passed to decoder) - rust-lang#109017 (remove duplicated calls to sort_string) - rust-lang#109018 (Expand on the allocator comment in `rustc-main`) - rust-lang#109028 (Add eslint checks for rustdoc-js tester) - rust-lang#109034 (Commit some tests for the new solver + lazy norm) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
After PR #108694, most unmatched backticks in
compiler/
comments have been eliminated. This PR adds a tidy lint to ensure no new unmatched backticks are added, and either addresses the lint in the remaining instances it found, or allows it.Very often, backtick containing sections wrap around lines, for example:
The lint is implemented to work on top of blocks, counting each line with a
//
into a block, and counting if there are an odd or even number of backticks in the entire block, instead of looking at just a single line.