Skip to content

Commit b2ed9c4

Browse files
committed
Add some inlining.
1 parent 48ae6ec commit b2ed9c4

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

compiler/rustc_query_system/src/ich/hcx.rs

+3
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,14 @@ impl<'a> StableHashingContext<'a> {
178178
}
179179

180180
impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
181+
#[inline]
181182
fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) {
182183
panic!("Node IDs should not appear in incremental state");
183184
}
184185
}
185186

186187
impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
188+
#[inline]
187189
fn hash_spans(&self) -> bool {
188190
self.hash_spans
189191
}
@@ -198,6 +200,7 @@ impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
198200
self.definitions.def_span(def_id)
199201
}
200202

203+
#[inline]
201204
fn span_data_to_lines_and_cols(
202205
&mut self,
203206
span: &SpanData,

compiler/rustc_query_system/src/ich/impls_hir.rs

+5
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
2626
}
2727
}
2828

29+
#[inline]
2930
fn hash_body_id(&mut self, id: hir::BodyId, hasher: &mut StableHasher) {
3031
let hcx = self;
3132
if hcx.hash_bodies() {
3233
hcx.body_resolver.body(id).hash_stable(hcx, hasher);
3334
}
3435
}
3536

37+
#[inline]
3638
fn hash_reference_to_item(&mut self, id: hir::HirId, hasher: &mut StableHasher) {
3739
let hcx = self;
3840

@@ -41,6 +43,7 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
4143
})
4244
}
4345

46+
#[inline]
4447
fn hash_hir_mod(&mut self, module: &hir::Mod<'_>, hasher: &mut StableHasher) {
4548
let hcx = self;
4649
let hir::Mod { inner: ref inner_span, ref item_ids } = *module;
@@ -103,6 +106,7 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
103106
}
104107
}
105108

109+
#[inline]
106110
fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self, f: F) {
107111
let prev_hash_node_ids = self.node_id_hashing_mode;
108112
self.node_id_hashing_mode = NodeIdHashingMode::Ignore;
@@ -114,6 +118,7 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
114118
}
115119

116120
impl<'a> HashStable<StableHashingContext<'a>> for hir::Body<'_> {
121+
#[inline]
117122
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
118123
let hir::Body { params, value, generator_kind } = self;
119124

compiler/rustc_session/src/cstore.rs

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub struct CrateSource {
2828
}
2929

3030
impl CrateSource {
31+
#[inline]
3132
pub fn paths(&self) -> impl Iterator<Item = &PathBuf> {
3233
self.dylib.iter().chain(self.rlib.iter()).chain(self.rmeta.iter()).map(|p| &p.0)
3334
}
@@ -47,6 +48,7 @@ pub enum CrateDepKind {
4748
}
4849

4950
impl CrateDepKind {
51+
#[inline]
5052
pub fn macros_only(self) -> bool {
5153
match self {
5254
CrateDepKind::MacrosOnly => true,
@@ -122,10 +124,12 @@ impl ExternCrate {
122124
/// If true, then this crate is the crate named by the extern
123125
/// crate referenced above. If false, then this crate is a dep
124126
/// of the crate.
127+
#[inline]
125128
pub fn is_direct(&self) -> bool {
126129
self.dependency_of == LOCAL_CRATE
127130
}
128131

132+
#[inline]
129133
pub fn rank(&self) -> impl PartialOrd {
130134
// Prefer:
131135
// - direct extern crate to indirect

0 commit comments

Comments
 (0)