Skip to content

Commit 8bfd405

Browse files
committed
inline everything
1 parent c67d107 commit 8bfd405

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

compiler/rustc_expand/src/mbe/transcribe.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct TranscrCtx<'psess, 'itp> {
7070

7171
impl<'psess> TranscrCtx<'psess, '_> {
7272
/// Span marked with the correct expansion and transparency.
73+
#[inline(always)]
7374
fn visited_dspan(&mut self, dspan: DelimSpan) -> Span {
7475
let mut span = dspan.entire();
7576
self.marker.mark_span(&mut span);
@@ -86,6 +87,7 @@ struct Marker {
8687

8788
impl Marker {
8889
/// Mark a span with the stored expansion ID and transparency.
90+
#[inline(always)]
8991
fn mark_span(&mut self, span: &mut Span) {
9092
// `apply_mark` is a relatively expensive operation, both due to taking hygiene lock, and
9193
// by itself. All tokens in a macro body typically have the same syntactic context, unless
@@ -113,6 +115,7 @@ enum FrameKind {
113115
}
114116

115117
impl<'a> Frame<'a> {
118+
#[inline(always)]
116119
fn new_delimited(src: &'a mbe::Delimited, span: DelimSpan, spacing: DelimSpacing) -> Frame<'a> {
117120
Frame {
118121
tts: &src.tts,
@@ -121,6 +124,7 @@ impl<'a> Frame<'a> {
121124
}
122125
}
123126

127+
#[inline(always)]
124128
fn new_sequence(
125129
src: &'a mbe::SequenceRepetition,
126130
sep: Option<Token>,
@@ -133,6 +137,7 @@ impl<'a> Frame<'a> {
133137
impl<'a> Iterator for Frame<'a> {
134138
type Item = &'a mbe::TokenTree;
135139

140+
#[inline(always)]
136141
fn next(&mut self) -> Option<&'a mbe::TokenTree> {
137142
let res = self.tts.get(self.idx);
138143
self.idx += 1;
@@ -687,6 +692,7 @@ fn maybe_use_metavar_location(
687692
/// See the definition of `repeats` in the `transcribe` function. `repeats` is used to descend
688693
/// into the right place in nested matchers. If we attempt to descend too far, the macro writer has
689694
/// made a mistake, and we return `None`.
695+
#[inline(always)]
690696
fn lookup_cur_matched<'a>(
691697
ident: MacroRulesNormalizedIdent,
692698
interpolations: &'a FxHashMap<MacroRulesNormalizedIdent, NamedMatch>,
@@ -727,6 +733,7 @@ impl LockstepIterSize {
727733
/// - `Unconstrained` is compatible with everything.
728734
/// - `Contradiction` is incompatible with everything.
729735
/// - `Constraint(len)` is only compatible with other constraints of the same length.
736+
#[inline(always)]
730737
fn with(self, other: LockstepIterSize) -> LockstepIterSize {
731738
match self {
732739
LockstepIterSize::Unconstrained => other,
@@ -764,6 +771,7 @@ impl LockstepIterSize {
764771
/// declared at depths which weren't equal or there was a compiler bug. For example, if we have 3 repetitions of
765772
/// the outer sequence and 4 repetitions of the inner sequence for `x`, we should have the same for
766773
/// `y`; otherwise, we can't transcribe them both at the given depth.
774+
#[inline(always)]
767775
fn lockstep_iter_size(
768776
tree: &mbe::TokenTree,
769777
interpolations: &FxHashMap<MacroRulesNormalizedIdent, NamedMatch>,
@@ -875,6 +883,7 @@ fn count_repetitions<'dx>(
875883
}
876884

877885
/// Returns a `NamedMatch` item declared on the LHS given an arbitrary [Ident]
886+
#[inline(always)]
878887
fn matched_from_ident<'ctx, 'interp, 'rslt>(
879888
dcx: DiagCtxtHandle<'ctx>,
880889
ident: Ident,
@@ -906,6 +915,7 @@ fn out_of_bounds_err<'a>(dcx: DiagCtxtHandle<'a>, max: usize, span: Span, ty: &s
906915
}
907916

908917
/// Extracts an metavariable symbol that can be an identifier, a token tree or a literal.
918+
#[inline(always)]
909919
fn extract_symbol_from_pnr<'a>(
910920
dcx: DiagCtxtHandle<'a>,
911921
pnr: &ParseNtResult,

0 commit comments

Comments
 (0)