rustc_span: Minor improvements
Introduce `{IndexNewtype,SyntaxContext}::from_u16` for convenience because small indices are sometimes encoded as `u16`.
Use `SpanData::span` instead of `Span::new` where appropriate.
Add a clarifying comment about decoding span parents.
This commit is contained in:
@@ -691,6 +691,11 @@ impl SyntaxContext {
|
||||
SyntaxContext(raw)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) const fn from_u16(raw: u16) -> SyntaxContext {
|
||||
SyntaxContext(raw as u32)
|
||||
}
|
||||
|
||||
/// Extend a syntax context with a given expansion and transparency.
|
||||
pub fn apply_mark(self, expn_id: ExpnId, transparency: Transparency) -> SyntaxContext {
|
||||
HygieneData::with(|data| data.apply_mark(self, expn_id, transparency))
|
||||
|
||||
Reference in New Issue
Block a user