diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-25 08:21:28 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-28 10:15:23 +1100 |
| commit | 8d2c63f514a74752a3186b0bf3e8f3aef57dc12e (patch) | |
| tree | 887b83d34fc08db03dd8b3c09fc80183a15734b5 /tests/ui/stats | |
| parent | cfd00f9c16d9b3ab98d6e06125c6baa83dfa4a03 (diff) | |
| download | rust-8d2c63f514a74752a3186b0bf3e8f3aef57dc12e.tar.gz rust-8d2c63f514a74752a3186b0bf3e8f3aef57dc12e.zip | |
Don't use `kw::Empty` in `hir::Lifetime::ident`.
`hir::Lifetime::ident` currently sometimes uses `kw::Empty` for elided lifetimes and sometimes uses `kw::UnderscoreLifetime`, and the distinction is used when creating some error suggestions, e.g. in `Lifetime::suggestion` and `ImplicitLifetimeFinder::visit_ty`. I found this *really* confusing, and it took me a while to understand what was going on. This commit replaces all uses of `kw::Empty` in `hir::Lifetime::ident` with `kw::UnderscoreLifetime`. It adds a new field `hir::Lifetime::is_path_anon` that mostly replaces the old empty/underscore distinction and makes things much clearer. Some other notable changes: - Adds a big comment to `Lifetime` talking about permissable field values. - Adds some assertions in `new_named_lifetime` about what ident values are permissible for the different `LifetimeRes` values. - Adds a `Lifetime::new` constructor that does some checking to make sure the `is_elided` and `is_anonymous` states are valid. - `add_static_impl_trait_suggestion` now looks at `Lifetime::res` instead of the ident when creating the suggestion. This is the one case where `is_path_anon` doesn't replace the old empty/underscore distinction. - A couple of minor pretty-printing improvements.
Diffstat (limited to 'tests/ui/stats')
| -rw-r--r-- | tests/ui/stats/input-stats.stderr | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/ui/stats/input-stats.stderr b/tests/ui/stats/input-stats.stderr index dbc9e7d254c..191daff2137 100644 --- a/tests/ui/stats/input-stats.stderr +++ b/tests/ui/stats/input-stats.stderr @@ -119,7 +119,7 @@ hir-stats HIR STATS hir-stats Name Accumulated Size Count Item Size hir-stats ---------------------------------------------------------------- hir-stats ForeignItemRef 24 ( 0.3%) 1 24 -hir-stats Lifetime 24 ( 0.3%) 1 24 +hir-stats Lifetime 28 ( 0.3%) 1 28 hir-stats Mod 32 ( 0.4%) 1 32 hir-stats ExprField 40 ( 0.4%) 1 40 hir-stats TraitItemRef 56 ( 0.6%) 2 28 @@ -155,7 +155,7 @@ hir-stats Generics 560 ( 6.2%) 10 56 hir-stats Ty 720 ( 8.0%) 15 48 hir-stats - Ptr 48 ( 0.5%) 1 hir-stats - Ref 48 ( 0.5%) 1 -hir-stats - Path 624 ( 7.0%) 13 +hir-stats - Path 624 ( 6.9%) 13 hir-stats Expr 768 ( 8.6%) 12 64 hir-stats - InlineAsm 64 ( 0.7%) 1 hir-stats - Match 64 ( 0.7%) 1 @@ -174,5 +174,5 @@ hir-stats - Use 352 ( 3.9%) 4 hir-stats Path 1_240 (13.8%) 31 40 hir-stats PathSegment 1_920 (21.4%) 40 48 hir-stats ---------------------------------------------------------------- -hir-stats Total 8_976 180 +hir-stats Total 8_980 180 hir-stats |
