From b43f76ebcf0bcb36073918b79450331fb15819f0 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 30 May 2018 16:58:48 +1000 Subject: [PATCH] Inline `NodeIndex` methods. Because they are small and hot. --- src/librustc_data_structures/obligation_forest/node_index.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustc_data_structures/obligation_forest/node_index.rs b/src/librustc_data_structures/obligation_forest/node_index.rs index 37512e4bcd57f..d89bd22ec9637 100644 --- a/src/librustc_data_structures/obligation_forest/node_index.rs +++ b/src/librustc_data_structures/obligation_forest/node_index.rs @@ -17,11 +17,13 @@ pub struct NodeIndex { } impl NodeIndex { + #[inline] pub fn new(value: usize) -> NodeIndex { assert!(value < (u32::MAX as usize)); NodeIndex { index: NonZeroU32::new((value as u32) + 1).unwrap() } } + #[inline] pub fn get(self) -> usize { (self.index.get() - 1) as usize }