-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Reduce HIR debug output #105558
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Reduce HIR debug output #105558
Conversation
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
722f0ed
to
988de66
Compare
it's not great that this looks like a string now. I wasn't able to use |
You can create a new local fn debug_fn(f: impl Fn(&mut fmt::Formatter<'_>) -> fmt::Result) -> impl fmt::Debug {
struct DebugFn<F>(F);
impl<F: Fn(&mut fmt::Formatter<'_>) -> fmt::Result> fmt::Debug for DebugFn<F> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
(self.0)(fmt)
}
}
DebugFn(f)
} Rustdoc seems to also have something similar already: rust/src/librustdoc/html/format.rs Lines 1665 to 1680 in f34356e
|
8855b85
to
bfd0a03
Compare
I didn't think of that, thanks! No idea where the best place would be to put the function, I just put it at the bottom of the file (which is probably a bad idea). |
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.
Thanks. That will definitely be useful. Can we pull this thread a bit more?
HIR debug output is currently very verbose, especially when used with the alternate (`#`) flag. This commit reduces the amount of noisy newlines by forcing a few small key types to stay on one line, which makes the output easier to read and scroll by. ``` $ rustc +after hello_world.rs -Zunpretty=hir-tree | wc -l 582 $ rustc +before hello_world.rs -Zunpretty=hir-tree | wc -l 932 ```
bfd0a03
to
e1787f5
Compare
@bors r+ |
…mpiler-errors Rollup of 8 pull requests Successful merges: - rust-lang#95985 (Add PhantomData marker to Context to make Context !Send and !Sync) - rust-lang#104298 (Add notes and examples about non-intuitive `PathBuf::set_extension` behavior) - rust-lang#105558 (Reduce HIR debug output) - rust-lang#106315 (Cleanup `mingw-tidy` docker job) - rust-lang#106354 (Rustdoc-Json: Report discriminant on all kinds of enum variant.) - rust-lang#106366 (Fix rustdoc ICE on bad typedef with mismatching types) - rust-lang#106376 (Update books) - rust-lang#106383 (Document some of the AST nodes) Failed merges: - rust-lang#106356 (clean: Remove `ctor_kind` from `VariantStruct`.) r? `@ghost` `@rustbot` modify labels: rollup
HIR debug output is currently very verbose, especially when used with the alternate (
#
) flag. This commit reduces the amount of noisy newlines by forcing a few small key types to stay on one line, which makes the output easier to read and scroll by.