diff options
| author | bors <bors@rust-lang.org> | 2019-09-15 08:17:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-15 08:17:57 +0000 |
| commit | 117cdf35d46cb4dbb246e300a492c860a86233be (patch) | |
| tree | 109e3227f1b4076c99874c94dc9aa1d554781f2b /src/libsyntax_pos | |
| parent | 8bf776d5c2fc88624d2562e493aab0d324a3b7d8 (diff) | |
| parent | 8ab67c8f560a730b8978f4a42deb70d01ca1cdfc (diff) | |
Auto merge of #64469 - matthewjasper:increase-hygiene-use, r=petrochenkov
Cleanup handling of hygiene for built-in macros
This makes most identifiers generated by built-in macros use def-site hygiene, not only the ones that previously used gensyms.
* `ExtCtxt::ident_of` now takes a `Span` and is preferred to `Ident::{from_str, from_str_and_span}`
* Remove `Span::with_legacy_ctxt`
* `assert` now uses call-site hygiene because it needs to resolve `panic` unhygienically.
* `concat_idents` now uses call-site hygiene because it wouldn't be very useful with def-site hygiene.
* everything else is moved to def-site hygiene
r? @petrochenkov
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 2 |
2 files changed, 1 insertions, 8 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 9a296f17aaf..ca177eb4a36 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -526,13 +526,6 @@ impl Span { self.with_ctxt_from_mark(expn_id, Transparency::Transparent) } - /// Span with a context reproducing `macro_rules` hygiene (hygienic locals, unhygienic items). - /// FIXME: This should be eventually replaced either with `with_def_site_ctxt` (preferably), - /// or with `with_call_site_ctxt` (where necessary). - pub fn with_legacy_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). diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index ab32d4461ef..597ae83572c 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -765,7 +765,7 @@ impl Ident { Ident::with_dummy_span(string.as_symbol()) } - /// Maps a string to an identifier with an empty span. + /// Maps a string to an identifier with a dummy span. pub fn from_str(string: &str) -> Ident { Ident::with_dummy_span(Symbol::intern(string)) } |
