proc_macro: Add Span::mixed_site exposing macro_rules hygiene

This commit is contained in:
Vadim Petrochenkov 2019-09-22 18:38:02 +03:00
parent c6293e3598
commit d1310dc6c9
10 changed files with 179 additions and 35 deletions

View file

@ -526,6 +526,12 @@ impl Span {
self.with_ctxt_from_mark(expn_id, Transparency::Transparent)
}
/// Equivalent of `Span::mixed_site` from the proc macro API,
/// except that the location is taken from the `self` span.
pub fn with_mixed_site_ctxt(&self, expn_id: ExpnId) -> Span {
self.with_ctxt_from_mark(expn_id, Transparency::SemiTransparent)
}
/// Produces a span with the same location as `self` and context produced by a macro with the
/// given ID and transparency, assuming that macro was defined directly and not produced by
/// some other macro (which is the case for built-in and procedural macros).