diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-01-30 19:18:48 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-02-15 19:24:58 +0100 |
| commit | bd3cd5dbed5f56fb44a14a20dd2113e3049d2565 (patch) | |
| tree | 83063aac7f1834f2bb10070fdfc42fa3787f4d31 /compiler/rustc_hir/src | |
| parent | c676e358a506af3f97025fa248343552bddc57d9 (diff) | |
| download | rust-bd3cd5dbed5f56fb44a14a20dd2113e3049d2565.tar.gz rust-bd3cd5dbed5f56fb44a14a20dd2113e3049d2565.zip | |
Use an ItemId inside mir::GlobalAsm.
Diffstat (limited to 'compiler/rustc_hir/src')
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 58dd3109b34..5329444a5e0 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2541,11 +2541,17 @@ impl VariantData<'hir> { // The bodies for items are stored "out of line", in a separate // hashmap in the `Crate`. Here we just record the hir-id of the item // so it can fetched later. -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Encodable, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Encodable, Debug, Hash)] pub struct ItemId { pub id: HirId, } +impl ItemId { + pub fn hir_id(&self) -> HirId { + self.id + } +} + /// An item /// /// The name might be a dummy name in case of anonymous items @@ -2559,6 +2565,12 @@ pub struct Item<'hir> { pub span: Span, } +impl Item<'_> { + pub fn item_id(&self) -> ItemId { + ItemId { id: self.hir_id } + } +} + #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[derive(Encodable, Decodable, HashStable_Generic)] pub enum Unsafety { |
