about summary refs log tree commit diff
path: root/src/libsyntax_pos/hygiene.rs
AgeCommit message (Collapse)AuthorLines
2019-12-30Rename directories for some crates from `syntax_x` to `rustc_x`Vadim Petrochenkov-850/+0
`syntax_expand` -> `rustc_expand` `syntax_pos` -> `rustc_span` `syntax_ext` -> `rustc_builtin_macros`
2019-12-22Format the worldMark Rousskov-57/+97
2019-11-25Auto merge of #66279 - cjgillot:hashstable, r=Zoxcbors-1/+2
Use proc-macro to derive HashStable everywhere Hello, A second proc-macro is added to derive HashStable for crates librustc depends on. This proc-macro `HashStable_Generic` (to bikeshed) allows to decouple code and strip much of librustc's boilerplate. Still, two implementations `Span` and `TokenKind` require to be placed in librustc. The latter only depends on the `bug` macro. Advise welcome on how to sever that link. A trait `StableHasingContextLike` has been introduced at each crate root, in order to handle those implementations which require librustc's very `StableHashingContext`. This overall effort allowed to remove the `impl_stable_hash_for` macro. Each commit passes the `x.py check`. I still have to double check there was no change in the implementation.
2019-11-24rustc_plugin: Remove support for syntactic pluginsVadim Petrochenkov-2/+0
2019-11-22Derive HashStable_Generic for ExpnData.Camille GILLOT-1/+2
2019-11-17HashStable_Generic for libsyntax_pos.Camille GILLOT-4/+5
2019-11-17Further HashStable_Generic derives.Camille GILLOT-1/+3
2019-10-30caller_location: point to macro invocation sites, like file!/line!.Eduard-Mihai Burtescu-1/+18
2019-09-17Rollup merge of #64486 - matthewjasper:hygiene-debugging, r=petrochenkovTyler Mandry-0/+32
Print out more information for `-Zunpretty=expanded,hygiene` I've found this helpful when trying to understand how hygiene works. Closes #16420
2019-09-17Print syntax contexts and marks when printing hygiene informationMatthew Jasper-0/+32
2019-09-15resolve: Tweak "cannot find" wording for attributesVadim Petrochenkov-0/+7
2019-09-05Add `with_{def_site,call_site,legacy}_ctxt,` methods to `Span`Vadim Petrochenkov-1/+1
Use these to create call-site spans for AST passes when needed.
2019-09-05Allow ast passes to create hygienic spansMatthew Jasper-1/+1
2019-09-05Add an ExpnKind for AST passesMatthew Jasper-1/+23
2019-08-23Remove default macro transparenciesVadim Petrochenkov-5/+1
All transparancies are passed explicitly now. Also remove `#[rustc_macro_transparency]` annotations from built-in macros, they are no longer used. `#[rustc_macro_transparency]` only makes sense for declarative macros now.
2019-08-23hygiene: Require passing transparency explicitly to `apply_mark`Vadim Petrochenkov-30/+16
2019-08-23incremental: Do not rely on default transparency when decoding syntax contextsVadim Petrochenkov-9/+17
Using `ExpnId`s default transparency here instead of the mark's real transparency was actually incorrect.
2019-08-23resolve: Do not rely on default transparency when detecting proc macro derivesVadim Petrochenkov-12/+0
2019-08-17Remove unused `SyntaxContext` serialization implsMatthew Jasper-4/+0
The implementations were wrong and unused.
2019-08-17Stop emulating cross-crate hygiene with gensymsMatthew Jasper-10/+2
Most `Ident`s are serialized as `InternedString`s the exceptions are: * Reexports * Attributes * Idents in macro definitions Using gensyms helped reexports emulate hygiene. However, the actual item wouldn't have a gensymmed name so would be usable cross-crate. So removing this case until we have proper cross-crate hygiene seems sensible. Codegen attributes (`inline`, `export_name`) are resolved by their `Symbol`. This meant that opaque macro-expanded codegen attributes could cause linker errors. This prevented making built-in derives hygienic.
2019-08-15hygiene: `ExpnInfo` -> `ExpnData`Vadim Petrochenkov-45/+45
For naming consistency with everything else in this area
2019-08-15hygiene: Merge a tiny bit of the "share expansion definition data" PRVadim Petrochenkov-1/+3
2019-08-15hygiene: Merge `ExpnInfo` and `InternalExpnData`Vadim Petrochenkov-37/+33
2019-08-15hygiene: Remove `Option`s from functions returning `ExpnInfo`Vadim Petrochenkov-36/+22
The expansion info is not optional and should always exist
2019-08-15syntax_pos: `NO_EXPANSION`/`SyntaxContext::empty()` -> `SyntaxContext::root()`Vadim Petrochenkov-6/+6
For consistency with `ExpnId::root`. Also introduce a helper `Span::with_root_ctxt` for creating spans with `SyntaxContext::root()` context
2019-08-15syntax_pos: Introduce a helper for checking whether a span comes from expansionVadim Petrochenkov-1/+1
2019-08-02Replace "existential" by "opaque"varkor-3/+3
2019-07-27Remove run-pass test suitesVadim Petrochenkov-1/+1
2019-07-23cleanup: Remove `extern crate serialize as rustc_serialize`sVadim Petrochenkov-1/+1
2019-07-19hygiene: Tweak naming some moreVadim Petrochenkov-48/+49
2019-07-19Adjust other names after the `Mark` renamingVadim Petrochenkov-103/+107
2019-07-19libsyntax: Remove `Mark` into `ExpnId`Vadim Petrochenkov-50/+50
2019-07-11hygiene: Make sure each `Mark` has an associated expansion infoVadim Petrochenkov-3/+17
The root expansion was missing one. Expansions created for "derive containers" (see one of the next commits for the description) also didn't get expansion info.
2019-07-11hygiene: Fix wording of desugaring descriptionsVadim Petrochenkov-8/+9
Use variant names rather than descriptions for identifying desugarings in `#[rustc_on_unimplemented]`. Both are highly unstable, but variant name is at least a single identifier.
2019-07-11hygiene: Introduce a helper method for creating new expansionsVadim Petrochenkov-35/+24
Creating a fresh expansion and immediately generating a span from it is the most common scenario. Also avoid allocating `allow_internal_unstable` lists for derive markers repeatedly. And rename `ExpnInfo::with_unstable` to `ExpnInfo::allow_unstable`, seems to be a better fitting name.
2019-07-11expand: Do not overwrite existing `ExpnInfo` when injecting derive markersVadim Petrochenkov-1/+5
Create a fresh expansion for them instead - this is the usual way to allow unstable features for generated/desugared code. Fixes https://github.com/rust-lang/rust/issues/52363
2019-07-11hygiene: Reuse `MacroKind` in `ExpnKind`Vadim Petrochenkov-18/+16
Orthogonality and reuse are good.
2019-07-11hygiene: Remove some unused implsVadim Petrochenkov-7/+7
2019-07-11syntax: Make def-site span mandatory in ↵Vadim Petrochenkov-6/+4
ExpnInfo/MacroBacktrace/DiagnosticSpanMacroExpansion We have to deal with dummy spans anyway Remove def-site span from expander interfaces. It's not used by the expansion infra, only by specific expanders, which can keep it themselves if they want it.
2019-07-11hygiene: Remove some dead codeVadim Petrochenkov-27/+1
2019-07-11Rename some things in `syntax_pos/hygiene`Vadim Petrochenkov-22/+22
More consistent with other naming: ExpnFormat -> ExpnKind ExpnKind::name -> ExpnKind::descr DesugaringKind::name -> DesugaringKind::descr Shorter, no tautology: CompilerDesugaring -> Desugaring CompilerDesugaringKind -> DesugaringKind
2019-07-11Move `MacroKind` into `libsyntax_pos`Vadim Petrochenkov-0/+28
So it can be eventually used in `ExpnInfo`
2019-07-09Resolve `$crate` in all hygienic contexts for pretty-pringingVadim Petrochenkov-12/+18
Stop visiting AST to discover those contexts, just iterate through hygiene data instead
2019-07-06Enforce 'cond: bool' in while-expr + improve reachability diags.Mazdak Farrokhzad-2/+3
2019-06-18hygiene: Avoid some unnecessary `ExpnInfo` clonesVadim Petrochenkov-5/+5
2019-06-18syntax: Move `default_transparency` into `ExpnInfo`Vadim Petrochenkov-25/+17
2019-06-18syntax: Introduce `default`/`with_unstable` constructors for `ExpnInfo`Vadim Petrochenkov-0/+23
2019-06-05Addressed points raised in review.Alexander Regueiro-2/+2
2019-06-05Add `modernize_and_adjust` methods.Nicholas Nethercote-0/+8
These combine two `HygieneData::with` calls into one.
2019-06-05Add a useful comment about this file.Nicholas Nethercote-0/+20