1
Fork 0

Move methods from Map to TyCtxt, part 4.

Continuing the work from #137350.

Removes the unused methods: `expect_variant`, `expect_field`,
`expect_foreign_item`.

Every method gains a `hir_` prefix.
This commit is contained in:
Nicholas Nethercote 2025-02-21 18:33:05 +11:00
parent 281af35cc3
commit 256c27e748
115 changed files with 269 additions and 321 deletions

View file

@ -1696,7 +1696,7 @@ impl<'tcx> TyCtxt<'tcx> {
// FIXME(@lcnr): Remove this function.
pub fn get_attrs_unchecked(self, did: DefId) -> &'tcx [hir::Attribute] {
if let Some(did) = did.as_local() {
self.hir().attrs(self.local_def_id_to_hir_id(did))
self.hir_attrs(self.local_def_id_to_hir_id(did))
} else {
self.attrs_for_def(did)
}
@ -1720,7 +1720,7 @@ impl<'tcx> TyCtxt<'tcx> {
) -> impl Iterator<Item = &'tcx hir::Attribute> {
let did: DefId = did.into();
if let Some(did) = did.as_local() {
self.hir().attrs(self.local_def_id_to_hir_id(did)).iter()
self.hir_attrs(self.local_def_id_to_hir_id(did)).iter()
} else {
self.attrs_for_def(did).iter()
}
@ -1764,7 +1764,7 @@ impl<'tcx> TyCtxt<'tcx> {
) -> impl Iterator<Item = &'tcx hir::Attribute> {
let filter_fn = move |a: &&hir::Attribute| a.path_matches(attr);
if let Some(did) = did.as_local() {
self.hir().attrs(self.local_def_id_to_hir_id(did)).iter().filter(filter_fn)
self.hir_attrs(self.local_def_id_to_hir_id(did)).iter().filter(filter_fn)
} else {
self.attrs_for_def(did).iter().filter(filter_fn)
}