Rollup merge of #125903 - petrochenkov:upctxt3, r=nnethercote

rustc_span: Inline some hot functions

Found while benchmarking https://github.com/rust-lang/rust/pull/125829.
This commit is contained in:
Jubilee 2024-06-05 01:14:31 -07:00 committed by GitHub
commit 009613802d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View File

@ -216,6 +216,7 @@ impl Span {
// Returns either syntactic context, if it can be retrieved without taking the interner lock,
// or an index into the interner if it cannot.
#[inline]
fn inline_ctxt(self) -> Result<SyntaxContext, usize> {
Ok(if self.len_with_tag_or_marker != BASE_LEN_INTERNED_MARKER {
if self.len_with_tag_or_marker & PARENT_TAG == 0 {

View File

@ -2213,6 +2213,7 @@ impl fmt::Display for IdentPrinter {
pub struct MacroRulesNormalizedIdent(Ident);
impl MacroRulesNormalizedIdent {
#[inline]
pub fn new(ident: Ident) -> Self {
Self(ident.normalize_to_macro_rules())
}