diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-14 13:15:01 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-15 08:07:15 +1000 |
| commit | 78599d83e7ab9f8cd4cbb9e982ddf12f258d6b18 (patch) | |
| tree | c1c0488e6609360dba87b88a8e390b3ebfce939a /compiler/rustc_resolve/src/late/diagnostics.rs | |
| parent | 89e93a51c81b521a9601b365e3325d31e44e9198 (diff) | |
| download | rust-78599d83e7ab9f8cd4cbb9e982ddf12f258d6b18.tar.gz rust-78599d83e7ab9f8cd4cbb9e982ddf12f258d6b18.zip | |
Move `name` field from `AssocItem` to `AssocKind` variants.
To accurately reflect that RPITIT assoc items don't have a name. This avoids the use of `kw::Empty` to mean "no name", which is error prone. Helps with #137978.
Diffstat (limited to 'compiler/rustc_resolve/src/late/diagnostics.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index ae81021e0be..d4fe446cc9f 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -2007,8 +2007,9 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { if def.did() != def_id { return None; } - let order = !item.name.as_str().starts_with("new"); - Some((order, item.name, input_len)) + let name = item.name(); + let order = !name.as_str().starts_with("new"); + Some((order, name, input_len)) }) .collect::<Vec<_>>(); items.sort_by_key(|(order, _, _)| *order); |
