]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir/src/hir.rs
Rollup merge of #82507 - jyn514:tidy-windows, r=Mark-Simulacrum
[rust.git] / compiler / rustc_hir / src / hir.rs
index 2fef7c2cc087d4097e1d388ace6a2db18dec53f0..3cc501e423c0b7fb04414233e9fdc864777a1965 100644 (file)
@@ -773,6 +773,7 @@ pub struct MacroDef<'hir> {
 }
 
 impl MacroDef<'_> {
+    #[inline]
     pub fn hir_id(&self) -> HirId {
         HirId::make_owner(self.def_id)
     }
@@ -1577,6 +1578,14 @@ pub fn peel_drop_temps(&self) -> &Self {
         expr
     }
 
+    pub fn peel_blocks(&self) -> &Self {
+        let mut expr = self;
+        while let ExprKind::Block(Block { expr: Some(inner), .. }, _) = &expr.kind {
+            expr = inner;
+        }
+        expr
+    }
+
     pub fn can_have_side_effects(&self) -> bool {
         match self.peel_drop_temps().kind {
             ExprKind::Path(_) | ExprKind::Lit(_) => false,
@@ -2016,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)
@@ -2037,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)
@@ -2078,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)
@@ -2098,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)
@@ -2688,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)
@@ -2708,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)
@@ -2892,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)
@@ -2924,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)