Skip to content

Commit 2ff1fc9

Browse files
Add #[inline] declarations
1 parent 8287842 commit 2ff1fc9

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/librustc_metadata/rmeta/encoder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ macro_rules! encoder_methods {
6868
impl<'tcx> Encoder for EncodeContext<'tcx> {
6969
type Error = <opaque::Encoder as Encoder>::Error;
7070

71+
#[inline]
7172
fn emit_unit(&mut self) -> Result<(), Self::Error> {
7273
Ok(())
7374
}

src/librustc_middle/mir/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -381,15 +381,18 @@ impl<'tcx> Body<'tcx> {
381381
}
382382

383383
/// Returns the return type; it always return first element from `local_decls` array.
384+
#[inline]
384385
pub fn return_ty(&self) -> Ty<'tcx> {
385386
self.local_decls[RETURN_PLACE].ty
386387
}
387388

388389
/// Gets the location of the terminator for the given block.
390+
#[inline]
389391
pub fn terminator_loc(&self, bb: BasicBlock) -> Location {
390392
Location { block: bb, statement_index: self[bb].statements.len() }
391393
}
392394

395+
#[inline]
393396
pub fn predecessors_for(
394397
&self,
395398
bb: BasicBlock,
@@ -398,6 +401,7 @@ impl<'tcx> Body<'tcx> {
398401
MappedLockGuard::map(predecessors, |preds| &mut preds[bb])
399402
}
400403

404+
#[inline]
401405
pub fn predecessors(&self) -> impl std::ops::Deref<Target = Predecessors> + '_ {
402406
self.predecessor_cache.compute(&self.basic_blocks)
403407
}
@@ -2639,18 +2643,21 @@ impl<'tcx> graph::DirectedGraph for Body<'tcx> {
26392643
}
26402644

26412645
impl<'tcx> graph::WithNumNodes for Body<'tcx> {
2646+
#[inline]
26422647
fn num_nodes(&self) -> usize {
26432648
self.basic_blocks.len()
26442649
}
26452650
}
26462651

26472652
impl<'tcx> graph::WithStartNode for Body<'tcx> {
2653+
#[inline]
26482654
fn start_node(&self) -> Self::Node {
26492655
START_BLOCK
26502656
}
26512657
}
26522658

26532659
impl<'tcx> graph::WithSuccessors for Body<'tcx> {
2660+
#[inline]
26542661
fn successors(&self, node: Self::Node) -> <Self as GraphSuccessors<'_>>::Iter {
26552662
self.basic_blocks[node].terminator().successors().cloned()
26562663
}
@@ -2667,6 +2674,7 @@ impl graph::GraphPredecessors<'graph> for Body<'tcx> {
26672674
}
26682675

26692676
impl graph::WithPredecessors for Body<'tcx> {
2677+
#[inline]
26702678
fn predecessors(&self, node: Self::Node) -> <Self as graph::GraphPredecessors<'_>>::Iter {
26712679
self.predecessors_for(node).clone().into_iter()
26722680
}

src/librustc_middle/mir/predecessors.rs

+6
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@ pub struct PredecessorCache {
1515
}
1616

1717
impl PredecessorCache {
18+
#[inline]
1819
pub fn new() -> Self {
1920
PredecessorCache { cache: Lock::new(None) }
2021
}
2122

23+
#[inline]
2224
pub fn invalidate(&mut self) {
2325
*self.cache.get_mut() = None;
2426
}
2527

28+
#[inline]
2629
pub fn compute(
2730
&self,
2831
basic_blocks: &IndexVec<BasicBlock, BasicBlockData<'_>>,
@@ -45,18 +48,21 @@ impl PredecessorCache {
4548
}
4649

4750
impl serialize::Encodable for PredecessorCache {
51+
#[inline]
4852
fn encode<S: serialize::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
4953
serialize::Encodable::encode(&(), s)
5054
}
5155
}
5256

5357
impl serialize::Decodable for PredecessorCache {
58+
#[inline]
5459
fn decode<D: serialize::Decoder>(d: &mut D) -> Result<Self, D::Error> {
5560
serialize::Decodable::decode(d).map(|_v: ()| Self::new())
5661
}
5762
}
5863

5964
impl<CTX> HashStable<CTX> for PredecessorCache {
65+
#[inline]
6066
fn hash_stable(&self, _: &mut CTX, _: &mut StableHasher) {
6167
// do nothing
6268
}

src/librustc_middle/ty/query/on_disk_cache.rs

+1
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@ where
922922
{
923923
type Error = E::Error;
924924

925+
#[inline]
925926
fn emit_unit(&mut self) -> Result<(), Self::Error> {
926927
Ok(())
927928
}

0 commit comments

Comments
 (0)