diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-02-26 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-02-26 00:00:00 +0000 |
| commit | 481e1fd3a8152cc72b561089c358e3b40c0eb54f (patch) | |
| tree | f64577c45caa4aae453113d73c1771f63dfc72e1 /compiler/rustc_hir | |
| parent | cecdb181ade91c0a5ffab9a148dba68fc7d00ee3 (diff) | |
| download | rust-481e1fd3a8152cc72b561089c358e3b40c0eb54f.tar.gz rust-481e1fd3a8152cc72b561089c358e3b40c0eb54f.zip | |
Miscellaneous inlining improvements
Inline a few small and hot functions.
Diffstat (limited to 'compiler/rustc_hir')
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/hir_id.rs | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index f4402843afc..3cc501e423c 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -773,6 +773,7 @@ pub struct MacroDef<'hir> { } impl MacroDef<'_> { + #[inline] pub fn hir_id(&self) -> HirId { HirId::make_owner(self.def_id) } @@ -2024,6 +2025,7 @@ pub struct TraitItemId { } impl TraitItemId { + #[inline] pub fn hir_id(&self) -> HirId { // Items are always HIR owners. HirId::make_owner(self.def_id) @@ -2045,6 +2047,7 @@ pub struct TraitItem<'hir> { } impl TraitItem<'_> { + #[inline] pub fn hir_id(&self) -> HirId { // Items are always HIR owners. HirId::make_owner(self.def_id) @@ -2086,6 +2089,7 @@ pub struct ImplItemId { } impl ImplItemId { + #[inline] pub fn hir_id(&self) -> HirId { // Items are always HIR owners. HirId::make_owner(self.def_id) @@ -2106,6 +2110,7 @@ pub struct ImplItem<'hir> { } impl ImplItem<'_> { + #[inline] pub fn hir_id(&self) -> HirId { // Items are always HIR owners. HirId::make_owner(self.def_id) @@ -2696,6 +2701,7 @@ pub struct ItemId { } impl ItemId { + #[inline] pub fn hir_id(&self) -> HirId { // Items are always HIR owners. HirId::make_owner(self.def_id) @@ -2716,6 +2722,7 @@ pub struct Item<'hir> { } impl Item<'_> { + #[inline] pub fn hir_id(&self) -> HirId { // Items are always HIR owners. HirId::make_owner(self.def_id) @@ -2900,6 +2907,7 @@ pub struct ForeignItemId { } impl ForeignItemId { + #[inline] pub fn hir_id(&self) -> HirId { // Items are always HIR owners. HirId::make_owner(self.def_id) @@ -2932,6 +2940,7 @@ pub struct ForeignItem<'hir> { } impl ForeignItem<'_> { + #[inline] pub fn hir_id(&self) -> HirId { // Items are always HIR owners. HirId::make_owner(self.def_id) diff --git a/compiler/rustc_hir/src/hir_id.rs b/compiler/rustc_hir/src/hir_id.rs index dd5cddd8525..e24eb5e4490 100644 --- a/compiler/rustc_hir/src/hir_id.rs +++ b/compiler/rustc_hir/src/hir_id.rs @@ -28,6 +28,7 @@ impl HirId { if self.local_id.index() == 0 { Some(self.owner) } else { None } } + #[inline] pub fn make_owner(owner: LocalDefId) -> Self { Self { owner, local_id: ItemLocalId::from_u32(0) } } |
