about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/input_stats.rs
AgeCommit message (Collapse)AuthorLines
2025-08-09remove `P`Deadbeef-2/+2
2025-07-13Retire hir::*ItemRef.Camille GILLOT-6/+6
2025-07-13Retire hir::ForeignItemRef.Camille GILLOT-3/+3
2025-07-06compiler: rename {ast,hir}::BareFn* to FnPtr*Jubilee Young-2/+2
Fix some comments and related types and locals where it is obvious, e.g. - bare_fn -> fn_ptr - LifetimeBinderKind::BareFnType -> LifetimeBinderKind::FnPtrType Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2025-06-24Tweak `-Zinput-stats` and `-Zmeta-stats` output.Nicholas Nethercote-6/+7
To make it match `-Zmacro-stats`, and work better if you have enabled it for multiple crates. - Print each crate's name. - Print a `===` banner at the start and end for separation.
2025-06-24Reverse order of `-Zinput-stats` and `-Zmeta-stats` output.Nicholas Nethercote-0/+1
Currently they have the largest items at the end. I believe the rationale is that it saves you scrolling up through terminal output because the important stuff is at the bottom. But it's also surprising and a bit confusing, and I think the obvious order (big things at the top) is better.
2025-06-24Make stats code nicer.Nicholas Nethercote-18/+37
Taking inspiration from `-Zmacro-stats`: - Use "{prefix}" consistently. - Use names for column widths. - Write output in a single `eprint!` call, in an attempt to minimize interleaving of output from different rustc processes. - Use `repeat` for the long `---` banners.
2025-06-12Overhaul the `thousands` module.Nicholas Nethercote-8/+8
It currently only inserts separators into `usize`s, because that's all that has been needed so far. `-Zmacro-stats` will need `isize` and `f64` handling, so this commit adds that.
2025-05-28Avoid over-counting of `UsePath` in the HIR stats.Nicholas Nethercote-2/+8
2025-03-28Add `{ast,hir,thir}::PatKind::Missing` variants.Nicholas Nethercote-0/+2
"Missing" patterns are possible in bare fn types (`fn f(u32)`) and similar places. Currently these are represented in the AST with `ast::PatKind::Ident` with no `by_ref`, no `mut`, an empty ident, and no sub-pattern. This flows through to `{hir,thir}::PatKind::Binding` for HIR and THIR. This is a bit nasty. It's very non-obvious, and easy to forget to check for the exceptional empty identifier case. This commit adds a new variant, `PatKind::Missing`, to do it properly. The process I followed: - Add a `Missing` variant to `{ast,hir,thir}::PatKind`. - Chang `parse_param_general` to produce `ast::PatKind::Missing` instead of `ast::PatKind::Missing`. - Look through `kw::Empty` occurrences to find functions where an existing empty ident check needs replacing with a `PatKind::Missing` check: `print_param`, `check_trait_item`, `is_named_param`. - Add a `PatKind::Missing => unreachable!(),` arm to every exhaustive match identified by the compiler. - Find which arms are actually reachable by running the test suite, changing them to something appropriate, usually by looking at what would happen to a `PatKind::Ident`/`PatKind::Binding` with no ref, no `mut`, an empty ident, and no subpattern. Quite a few of the `unreachable!()` arms were never reached. This makes sense because `PatKind::Missing` can't happen in every pattern, only in places like bare fn tys and trait fn decls. I also tried an alternative approach: modifying `ast::Param::pat` to hold an `Option<P<Pat>>` instead of a `P<Pat>`, but that quickly turned into a very large and painful change. Adding `PatKind::Missing` is much easier.
2025-03-09Rollup merge of #138040 - thaliaarchi:use-prelude-size-of.compiler, ↵Matthias Krüger-2/+2
r=compiler-errors compiler: Use `size_of` from the prelude instead of imported Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. Apply this change across the compiler. These functions were added to all preludes in Rust 1.80. r? ``@compiler-errors``
2025-03-07compiler: Use size_of from the prelude instead of importedThalia Archibald-2/+2
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-03-07Rollup merge of #138150 - nnethercote:streamline-intravisit-visit_id, r=oli-obkMatthias Krüger-2/+2
Streamline HIR intravisit `visit_id` calls for items A small clean up.
2025-03-07Move `visit_id` calls.Nicholas Nethercote-2/+2
In `walk_item`, we call `visit_id` on every item kind. For most of them we do it directly in `walk_item`. But for `ItemKind::Mod`, `ItemKind::Enum`, and `ItemKind::Use` we instead do it in the `walk_*` function called (via the `visit_*` function) from `walk_item`. I can see no reason for this inconsistency, so this commit makes those three cases like all the other cases, moving the `visit_id` calls into `walk_item`. This also avoids the need for a few `HirId` arguments.
2025-03-06Implement .use keyword as an alias of cloneSantiago Pastorino-1/+2
2025-02-18Move methods from `Map` to `TyCtxt`, part 2.Nicholas Nethercote-2/+2
Continuing the work started in #136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.
2025-02-17Move some `Map` methods onto `TyCtxt`.Nicholas Nethercote-13/+9
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
2025-02-08Rustfmtbjorn3-203/+228
2025-01-31Overhaul `to_readable_str`.Nicholas Nethercote-8/+8
It's a function that prints numbers with underscores inserted for readability (e.g. "1_234_567"), used by `-Zmeta-stats` and `-Zinput-stats`. It's the only thing in `rustc_middle::util::common`, which is a bizarre location for it. This commit: - moves it to `rustc_data_structures`, a more logical crate for it; - puts it in a module `thousands`, like the similar crates.io crate; - renames it `format_with_underscores`, which is a clearer name; - rewrites it to be more concise; - slightly improves the testing.
2025-01-29Eliminate PatKind::PathOli Scherer-1/+0
2025-01-23Split hir `TyKind` and `ConstArgKind` in two and update `hir::Visitor`Boxy-4/+3
2025-01-08Rename PatKind::Lit to ExprOli Scherer-2/+2
2024-12-31add guard patterns to HIR and implement loweringMax Niederman-0/+1
2024-12-17Fix `-Z inputs-stats` ordering.Nicholas Nethercote-7/+11
In #129533 the main hash function changed and the order of `-Z input-stats` output changed, which showed that it is dependent on the hash function, even though it is sorted. That's because entries with the same cumulative size are ordered in a way that depends on the hash function. This commit fixes that by using the entry label as the secondary ordering key.
2024-12-15Add hir::AttributeJonathan Dönszelmann-1/+1
2024-12-14(Re-)Implement impl_trait_in_bindingsMichael Goulet-0/+1
2024-12-12Add unwrap_unsafe_binder and wrap_unsafe_binder macro operatorsMichael Goulet-4/+35
2024-12-12Lower AST and resolve lifetimes for unsafe binder typesMichael Goulet-0/+2
2024-12-10Remove more traces of anonymous ADTsMichael Goulet-1/+0
2024-12-08Rollup merge of #133424 - Nadrieril:guard-patterns-parsing, r=fee1-deadMatthias Krüger-0/+1
Parse guard patterns This implements the parsing of [RFC3637 Guard Patterns](https://rust-lang.github.io/rfcs/3637-guard-patterns.html) (see also [tracking issue](https://github.com/rust-lang/rust/issues/129967)). This PR is extracted from https://github.com/rust-lang/rust/pull/129996 with minor modifications. cc `@max-niederman`
2024-11-25Refactor `where` predicates, and reserve for attributes supportFrank King-6/+5
2024-11-24add guard pattern AST nodeMax Niederman-0/+1
2024-11-15Merge `-Zhir-stats` into `-Zinput-stats`Sam Estep-0/+704