diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-05-30 16:58:48 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-05-31 09:22:07 +1000 |
| commit | a5ffcf6dd830367ccd9b0924c1a1f052330173a2 (patch) | |
| tree | b1f2b74b7a896962f741f6ec64c8f72dfb7473e4 /src/librustc_data_structures | |
| parent | f46d0213e4825633f182d9b9026b96a7358a1e93 (diff) | |
| download | rust-a5ffcf6dd830367ccd9b0924c1a1f052330173a2.tar.gz rust-a5ffcf6dd830367ccd9b0924c1a1f052330173a2.zip | |
Inline `NodeIndex` methods.
Because they are small and hot.
Diffstat (limited to 'src/librustc_data_structures')
| -rw-r--r-- | src/librustc_data_structures/obligation_forest/node_index.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librustc_data_structures/obligation_forest/node_index.rs b/src/librustc_data_structures/obligation_forest/node_index.rs index 37512e4bcd5..d89bd22ec96 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 } |
