about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-11 06:28:59 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-04-14 16:13:04 +1000
commitbc9dacdf9a0f123377f6f97ab23f13f5777e4041 (patch)
tree8001f940274655845fe35a17b65e81c3ea4e94d0 /tests/codegen/src-hash-algorithm
parent322bba0ae40dfcd9e05faa1a63b35033e9214c17 (diff)
downloadrust-bc9dacdf9a0f123377f6f97ab23f13f5777e4041.tar.gz
rust-bc9dacdf9a0f123377f6f97ab23f13f5777e4041.zip
Move `has_self` field to `hir::AssocKind::Fn`.
`hir::AssocItem` currently has a boolean `fn_has_self_parameter` field,
which is misplaced, because it's only relevant for associated fns, not
for associated consts or types. This commit moves it (and renames it) to
the `AssocKind::Fn` variant, where it belongs.

This requires introducing a new C-style enum, `AssocTag`, which is like
`AssocKind` but without the fields. This is because `AssocKind` values
are passed to various functions like `find_by_ident_and_kind` to
indicate what kind of associated item should be searched for, and having
to specify `has_self` isn't relevant there.

New methods:
- Predicates `AssocItem::is_fn` and `AssocItem::is_method`.
- `AssocItem::as_tag` which converts `AssocItem::kind` to `AssocTag`.

Removed `find_by_name_and_kinds`, which is unused.

`AssocItem::descr` can now distinguish between methods and associated
functions, which slightly improves some error messages.
Diffstat (limited to 'tests/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions