mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
Add some inlining.
This commit is contained in:
parent
48ae6ec4f3
commit
b2ed9c4007
@ -178,12 +178,14 @@ impl<'a> StableHashingContext<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
|
impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
|
||||||
|
#[inline]
|
||||||
fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) {
|
fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) {
|
||||||
panic!("Node IDs should not appear in incremental state");
|
panic!("Node IDs should not appear in incremental state");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
|
impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
|
||||||
|
#[inline]
|
||||||
fn hash_spans(&self) -> bool {
|
fn hash_spans(&self) -> bool {
|
||||||
self.hash_spans
|
self.hash_spans
|
||||||
}
|
}
|
||||||
@ -198,6 +200,7 @@ impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
|
|||||||
self.definitions.def_span(def_id)
|
self.definitions.def_span(def_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn span_data_to_lines_and_cols(
|
fn span_data_to_lines_and_cols(
|
||||||
&mut self,
|
&mut self,
|
||||||
span: &SpanData,
|
span: &SpanData,
|
||||||
|
@ -26,6 +26,7 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn hash_body_id(&mut self, id: hir::BodyId, hasher: &mut StableHasher) {
|
fn hash_body_id(&mut self, id: hir::BodyId, hasher: &mut StableHasher) {
|
||||||
let hcx = self;
|
let hcx = self;
|
||||||
if hcx.hash_bodies() {
|
if hcx.hash_bodies() {
|
||||||
@ -33,6 +34,7 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn hash_reference_to_item(&mut self, id: hir::HirId, hasher: &mut StableHasher) {
|
fn hash_reference_to_item(&mut self, id: hir::HirId, hasher: &mut StableHasher) {
|
||||||
let hcx = self;
|
let hcx = self;
|
||||||
|
|
||||||
@ -41,6 +43,7 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn hash_hir_mod(&mut self, module: &hir::Mod<'_>, hasher: &mut StableHasher) {
|
fn hash_hir_mod(&mut self, module: &hir::Mod<'_>, hasher: &mut StableHasher) {
|
||||||
let hcx = self;
|
let hcx = self;
|
||||||
let hir::Mod { inner: ref inner_span, ref item_ids } = *module;
|
let hir::Mod { inner: ref inner_span, ref item_ids } = *module;
|
||||||
@ -103,6 +106,7 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self, f: F) {
|
fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self, f: F) {
|
||||||
let prev_hash_node_ids = self.node_id_hashing_mode;
|
let prev_hash_node_ids = self.node_id_hashing_mode;
|
||||||
self.node_id_hashing_mode = NodeIdHashingMode::Ignore;
|
self.node_id_hashing_mode = NodeIdHashingMode::Ignore;
|
||||||
@ -114,6 +118,7 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::Body<'_> {
|
impl<'a> HashStable<StableHashingContext<'a>> for hir::Body<'_> {
|
||||||
|
#[inline]
|
||||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||||
let hir::Body { params, value, generator_kind } = self;
|
let hir::Body { params, value, generator_kind } = self;
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ pub struct CrateSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CrateSource {
|
impl CrateSource {
|
||||||
|
#[inline]
|
||||||
pub fn paths(&self) -> impl Iterator<Item = &PathBuf> {
|
pub fn paths(&self) -> impl Iterator<Item = &PathBuf> {
|
||||||
self.dylib.iter().chain(self.rlib.iter()).chain(self.rmeta.iter()).map(|p| &p.0)
|
self.dylib.iter().chain(self.rlib.iter()).chain(self.rmeta.iter()).map(|p| &p.0)
|
||||||
}
|
}
|
||||||
@ -47,6 +48,7 @@ pub enum CrateDepKind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CrateDepKind {
|
impl CrateDepKind {
|
||||||
|
#[inline]
|
||||||
pub fn macros_only(self) -> bool {
|
pub fn macros_only(self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
CrateDepKind::MacrosOnly => true,
|
CrateDepKind::MacrosOnly => true,
|
||||||
@ -122,10 +124,12 @@ impl ExternCrate {
|
|||||||
/// If true, then this crate is the crate named by the extern
|
/// If true, then this crate is the crate named by the extern
|
||||||
/// crate referenced above. If false, then this crate is a dep
|
/// crate referenced above. If false, then this crate is a dep
|
||||||
/// of the crate.
|
/// of the crate.
|
||||||
|
#[inline]
|
||||||
pub fn is_direct(&self) -> bool {
|
pub fn is_direct(&self) -> bool {
|
||||||
self.dependency_of == LOCAL_CRATE
|
self.dependency_of == LOCAL_CRATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn rank(&self) -> impl PartialOrd {
|
pub fn rank(&self) -> impl PartialOrd {
|
||||||
// Prefer:
|
// Prefer:
|
||||||
// - direct extern crate to indirect
|
// - direct extern crate to indirect
|
||||||
|
Loading…
Reference in New Issue
Block a user