From 8b8c12ee225eba42b1237b61c6db9f2de1ef67b6 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 16 Apr 2022 23:43:36 +0200 Subject: [PATCH] Add inline. --- compiler/rustc_middle/src/ty/context.rs | 2 +- compiler/rustc_query_system/src/dep_graph/dep_node.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index eca55c09166cc..5926bc19e868e 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1176,7 +1176,7 @@ impl<'tcx> TyCtxt<'tcx> { } crate fn query_kind(self, k: DepKind) -> &'tcx DepKindStruct { - &self.query_kinds[k.index() as usize] + &self.query_kinds[k.index()] } /// Constructs a `TyKind::Error` type and registers a `delay_span_bug` to ensure it gets used. diff --git a/compiler/rustc_query_system/src/dep_graph/dep_node.rs b/compiler/rustc_query_system/src/dep_graph/dep_node.rs index e8d7f9482570a..2f89f5328b946 100644 --- a/compiler/rustc_query_system/src/dep_graph/dep_node.rs +++ b/compiler/rustc_query_system/src/dep_graph/dep_node.rs @@ -58,12 +58,14 @@ impl DepKind { /// We use this for most things when incr. comp. is turned off. pub const NULL: Self = DepKind(0); + #[inline] pub const fn new(index: u16) -> Self { DepKind(index) } - pub const fn index(self) -> u16 { - self.0 + #[inline] + pub const fn index(self) -> usize { + self.0 as usize } }