about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-17 22:49:04 +0100
committerGitHub <noreply@github.com>2025-03-17 22:49:04 +0100
commite1acc68c9dcbeea515948e5ed40cd8131c1ef793 (patch)
tree4024acc2ac05070d8a75fc56ca663cbe5dc81910 /tests/codegen/src-hash-algorithm
parent8279176ccdfd4eebd40a671f75b6d3024ae56b42 (diff)
parentf2ddbcd24b3e71a2c919721f854043f1bb81ff79 (diff)
downloadrust-e1acc68c9dcbeea515948e5ed40cd8131c1ef793.tar.gz
rust-e1acc68c9dcbeea515948e5ed40cd8131c1ef793.zip
Rollup merge of #138384 - nnethercote:hir-ItemKind-idents, r=fmease
Move `hir::Item::ident` into `hir::ItemKind`.

 `hir::Item` has an `ident` field.

- It's always non-empty for these item kinds: `ExternCrate`, `Static`, `Const`, `Fn`, `Macro`, `Mod`, `TyAlias`, `Enum`, `Struct`, `Union`, Trait`, TraitAalis`.

- It's always empty for these item kinds: `ForeignMod`, `GlobalAsm`, `Impl`.

- For `Use`, it is non-empty for `UseKind::Single` and empty for `UseKind::{Glob,ListStem}`.

All of this is quite non-obvious; the only documentation is a single comment saying "The name might be a dummy name in case of anonymous items". Some sites that handle items check for an empty ident, some don't. This is a very C-like way of doing things, but this is Rust, we have sum types, we can do this properly and never forget to check for the exceptional case and never YOLO possibly empty identifiers (or possibly dummy spans) around and hope that things will work out.

This is step towards `kw::Empty` elimination (#137978).

r? `@fmease`
Diffstat (limited to 'tests/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions