]> git.lizzy.rs Git - rust.git/commit
Auto merge of #98840 - cjgillot:span-inline-ctxt, r=wesleywiser
authorbors <bors@rust-lang.org>
Thu, 22 Sep 2022 17:59:27 +0000 (17:59 +0000)
committerbors <bors@rust-lang.org>
Thu, 22 Sep 2022 17:59:27 +0000 (17:59 +0000)
commite7119a0300b87a3d670408ee8e847c6821b3ae80
treebae47aa3e1eec74fef25a79925fb11fc9a812ed6
parent89e4e1f1b32e2a88cf696337f77e10273142c1a0
parent3e67bded92b389dfdb56f7a9a40e85b8be4d4d4c
Auto merge of #98840 - cjgillot:span-inline-ctxt, r=wesleywiser

Inline SyntaxContext in both encoded span representation.

The current interned representation for spans does not use the `ctxt_or_zero: u16` field.  This PR proposes to use this field to store the `SyntaxContext` of the interned span instead.  When `ctxt_or_zero` and the interned span's `ctxt` don't match, the inlined one takes precedence.

This allows to implement `Span::ctxt` and `Span::with_ctxt` with much less probability to access the interner.  Those functions are used a lot for hygiene, so this may be worth it.
compiler/rustc_span/src/lib.rs