diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-09-22 18:38:02 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-10-03 11:28:06 +0300 |
| commit | d1310dc6c989e191d85c73c943d4175fbf1dccb8 (patch) | |
| tree | d0ca6fac9bdb651e328a8a6990c16208ad5dc43a /src/libsyntax_pos | |
| parent | c6293e359848c8c7275330719b33ccd168df04c3 (diff) | |
proc_macro: Add `Span::mixed_site` exposing `macro_rules` hygiene
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 6e83e1d3f8d..30ee9b90515 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -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). |
