1
Fork 0

Use an ItemId inside mir::GlobalAsm.

This commit is contained in:
Camille GILLOT 2021-01-30 19:18:48 +01:00
parent c676e358a5
commit bd3cd5dbed
7 changed files with 32 additions and 21 deletions

View file

@ -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 {