about summary refs log tree commit diff
path: root/tests/ui/patchable-function-entry/patchable-function-entry-attribute.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-28 08:34:09 +0200
committerGitHub <noreply@github.com>2024-06-28 08:34:09 +0200
commitd730f27fc8ecaa0bb17d5f29a6bfc1f42f0ff552 (patch)
treed0755c2609e2e721de6ef92b069cf785fe37da2f /tests/ui/patchable-function-entry/patchable-function-entry-attribute.rs
parent2c228260dcf76238de2ac4427b6decd1c74a181b (diff)
parent9387b0bad9b094268675b6fab19afdbe32c7fe51 (diff)
downloadrust-d730f27fc8ecaa0bb17d5f29a6bfc1f42f0ff552.tar.gz
rust-d730f27fc8ecaa0bb17d5f29a6bfc1f42f0ff552.zip
Rollup merge of #127022 - adwinwhite:attrs, r=celinval
Support fetching `Attribute` of items.

Fixes [https://github.com/rust-lang/project-stable-mir/issues/83](https://github.com/rust-lang/project-stable-mir/issues/83)

`rustc_ast::ast::Attribute` doesn't impl `Hash` and `Eq`. Thus it cannot be directly used as key of `IndexMap` in `rustc_smir::rustc_smir::Tables` and we cannot define stable `Attribute` as index to `rustc_ast::ast::Attribute` like `Span` and many other stable definitions.

Since an string (or tokens) and its span contain all info about an attribute, I defined a simple `Attribute` struct on stable side.

I choose to fetch attributes via `tcx::get_attrs_by_path()` due to `get_attrs()` is marked as deprecated and `get_attrs_by_name()` cannot handle name of multiple segments like `rustfmt::skip`.

r? `@celinval`
Diffstat (limited to 'tests/ui/patchable-function-entry/patchable-function-entry-attribute.rs')
0 files changed, 0 insertions, 0 deletions