1
Fork 0

Rollup merge of #137504 - nnethercote:remove-Map-4, r=Zalathar

Move methods from Map to TyCtxt, part 4.

A follow-up to https://github.com/rust-lang/rust/pull/137350.

r? ```@Zalathar```
This commit is contained in:
Manish Goregaokar 2025-03-12 10:19:26 -07:00 committed by GitHub
commit f88f27aff0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
124 changed files with 390 additions and 441 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)
}