about summary refs log tree commit diff
path: root/src/libsyntax_ext
AgeCommit message (Collapse)AuthorLines
2019-09-21Remove constraints argument from path_allMark Rousskov-8/+8
It was never used
2019-09-20factor out pluralisation remains after #64280gaolei-1/+2
2019-09-17Generate proc macro harness in AST order.Aaron Hill-47/+62
This ensures that we match the order used by proc macro metadata serialization. Fixes #64251
2019-09-15Remove `with_legacy_ctxt`Matthew Jasper-8/+10
2019-09-15Give more `Idents` spansMatthew Jasper-62/+66
2019-09-15Avoid some unnecessary `&str` to `Ident` conversionsMatthew Jasper-16/+14
2019-09-14Auto merge of #64080 - estebank:parse-format-comma, r=zackmdavisbors-4/+12
Be accurate on `format!` parse error expectations Fix https://github.com/rust-lang/rust/issues/57277.
2019-09-09Resolve attributes in several placesCaio-0/+1
Arm, Field, FieldPat, GenericParam, Param, StructField and Variant
2019-09-07Rollup merge of #64139 - Mark-Simulacrum:strip-legacy-proc-macro, r=petrochenkovMazdak Farrokhzad-6/+4
Migrate internal diagnostic registration to macro_rules Review is best done commit-by-commit. Fixes #64132.
2019-09-07Rollup merge of #64243 - petrochenkov:cmdattr, r=alexcrichtonMazdak Farrokhzad-0/+31
Move injection of attributes from command line to `libsyntax_ext` Just a tiny bit of code generation that wasn't moved into `libsyntax_ext` in https://github.com/rust-lang/rust/pull/62771.
2019-09-07Rollup merge of #64233 - varkor:correct-pluralisation, r=estebankMazdak Farrokhzad-1/+1
Correct pluralisation of various diagnostic messages
2019-09-07Rollup merge of #63919 - matthewjasper:remove-gensymmed, r=petrochenkovMazdak Farrokhzad-251/+194
Use hygiene for AST passes AST passes are now able to have resolve consider their expansions as if they were opaque macros defined either in some module in the current crate, or a fake empty module with `#[no_implicit_prelude]`. * Add an ExpnKind for AST passes. * Remove gensyms in AST passes. * Remove gensyms in`#[test]`, `#[bench]` and `#[test_case]`. * Allow opaque macros to define tests. * Move tests for unit tests to their own directory. * Remove `Ident::{gensym, is_gensymed}` - `Ident::gensym_if_underscore` still exists. cc #60869, #61019 r? @petrochenkov
2019-09-06Move injection of attributes from command line to `libsyntax_ext`Vadim Petrochenkov-0/+31
2019-09-06Correct pluralisation of various diagnostic messagesvarkor-1/+1
2019-09-06Rollup merge of #64111 - Centril:ast-only-patkind-or, r=petrochenkovMazdak Farrokhzad-13/+9
or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve Following up on work in https://github.com/rust-lang/rust/pull/63693 and https://github.com/rust-lang/rust/pull/61708, in this PR we: - Uniformly use `PatKind::Or(...)` in AST: - Change `ast::Arm.pats: Vec<P<Pat>>` => `ast::Arm.pat: P<Pat>` - Change `ast::ExprKind::Let.0: Vec<P<Pat>>` => `ast::ExprKind::Let.0: P<Pat>` - Adjust `librustc_resolve/late.rs` to correctly handle or-patterns at any level of nesting as a result. In particular, the already-bound check which rejects e.g. `let (a, a);` now accounts for or-patterns. The consistency checking (ensures no missing bindings and binding mode consistency) also now accounts for or-patterns. In the process, a bug was found in the current compiler which allowed: ```rust enum E<T> { A(T, T), B(T) } use E::*; fn foo() { match A(0, 1) { B(mut a) | A(mut a, mut a) => {} } } ``` The new algorithms took a few iterations to get right. I tried several clever schemes but ultimately a version based on a stack of hashsets and recording product/sum contexts was chosen since it is more clearly correct. - Clean up `librustc_resolve/late.rs` by, among other things, using a new `with_rib` function to better ensure stack dicipline. - Do not push the change in AST to HIR for now to avoid doing too much in this PR. To cope with this, we introduce a temporary hack in `rustc::hir::lowering` (clearly marked in the diff). cc https://github.com/rust-lang/rust/issues/54883 cc @dlrobertson @matthewjasper r? @petrochenkov
2019-09-05Simplify std lib injectionMatthew Jasper-120/+36
2019-09-05Remove rustc_diagnostic_macros featureMark Rousskov-1/+0
2019-09-05Replace diagnostic plugins with macro_rulesMark Rousskov-2/+0
2019-09-05Restrict error code length to 80 columnsMark Rousskov-3/+4
The global restriction is 100, but since error codes are printed out via --explain we want to restrict them to just 80 columns.
2019-09-05Document test harness generationMatthew Jasper-27/+55
Also ensure that we're consistently using the def-site span when appropriate.
2019-09-05Add `with_{def_site,call_site,legacy}_ctxt,` methods to `Span`Vadim Petrochenkov-8/+13
Use these to create call-site spans for AST passes when needed.
2019-09-05Make use of hygiene in AST passesMatthew Jasper-210/+204
2019-09-05Rollup merge of #64041 - matklad:token-stream-tt, r=petrochenkovMazdak Farrokhzad-69/+72
use TokenStream rather than &[TokenTree] for built-in macros That way, we don't loose the jointness info
2019-09-05or-patterns: syntax: adjust derive, format, and building.Mazdak Farrokhzad-13/+9
2019-09-04remove XID and Pattern_White_Space unicode tables from libcoreAleksey Kladov-0/+1
They are only used by rustc_lexer, and are not needed elsewhere. So we move the relevant definitions into rustc_lexer (while the actual unicode data comes from the unicode-xid crate) and make the rest of the compiler use it.
2019-09-03use consistent naming for buildin expansion functionsAleksey Kladov-9/+9
2019-09-03use TokenStream rather than &[TokenTree] for built-in macrosAleksey Kladov-61/+64
That way, we don't loose the jointness info
2019-09-01Be accurate on `format!` parse error expectationsEsteban Küber-4/+12
2019-08-28Auto merge of #63127 - kper:pr, r=nikomatsakisbors-8/+8
Cleanup: Consistently use `Param` instead of `Arg` #62426 Fixes #62426
2019-08-27Cleanup: Consistently use `Param` instead of `Arg` #62426Kevin Per-8/+8
2019-08-27proc_macro: Turn `quote` into a regular built-in macroVadim Petrochenkov-0/+8
Previously in was implemented using a special hack in the metadata loader
2019-08-23Audit uses of `apply_mark` in built-in macrosVadim Petrochenkov-24/+23
Replace them with equivalents of `Span::{def_site,call_site}` from proc macro API. The new API is much less error prone and doesn't rely on macros having default transparency.
2019-08-17Remove SyntaxContext from {ast, hir}::{GlobalAsm, InlineAsm}Matthew Jasper-7/+3
We now store it in the `Span` of the expression or item.
2019-08-17Remove gensyms from built-in derivesMatthew Jasper-86/+67
Also make them generally more hygienic with name resolution.
2019-08-16Rollup merge of #63613 - petrochenkov:stdhyg, r=alexcrichtonMazdak Farrokhzad-1/+0
Hygienize use of built-in macros in the standard library Same as https://github.com/rust-lang/rust/pull/61629, but for built-in macros. Closes https://github.com/rust-lang/rust/issues/48781 r? @alexcrichton
2019-08-16Rollup merge of #63525 - matklad:centraliza-file-loading, r=petrochenkovMazdak Farrokhzad-26/+11
Make sure that all file loading happens via SourceMap That way, callers don't need to repeat "let's add this to sm manually for tracking dependencies" trick. It should make it easier to switch to using `FileLoader` for binary files in the future as well cc #62948 r? @petrochenkov
2019-08-15Remove `__rust_unstable_column`Vadim Petrochenkov-1/+0
2019-08-15hygiene: `ExpnInfo` -> `ExpnData`Vadim Petrochenkov-12/+12
For naming consistency with everything else in this area
2019-08-15hygiene: Merge `ExpnInfo` and `InternalExpnData`Vadim Petrochenkov-13/+11
2019-08-15`Ident::with_empty_ctxt` -> `Ident::with_dummy_span`Vadim Petrochenkov-20/+20
`Ident` has had a full span rather than just a `SyntaxContext` for a long time now.
2019-08-15syntax_pos: `NO_EXPANSION`/`SyntaxContext::empty()` -> `SyntaxContext::root()`Vadim Petrochenkov-3/+3
For consistency with `ExpnId::root`. Also introduce a helper `Span::with_root_ctxt` for creating spans with `SyntaxContext::root()` context
2019-08-15Remove `Spanned` from `{ast,hir}::FieldPat`Vadim Petrochenkov-9/+7
2019-08-15Remove `Spanned` from `ast::Mac`Vadim Petrochenkov-6/+3
2019-08-15Remove `Spanned` from `mk_name_value_item_str` and `expr_to_spanned_string`Vadim Petrochenkov-8/+8
2019-08-15Make sure that all file loading happens via SourceMapAleksey Kladov-26/+11
That way, callers don't need to repeat "let's add this to sm manually for tracking dependencies" trick. It should make it easier to switch to using `FileLoader` for binary files in the future as well
2019-08-14Rollup merge of #63543 - c410-f3r:variant, r=c410-f3rMazdak Farrokhzad-14/+14
Merge Variant and Variant_ Extracted from #63468.
2019-08-14Rollup merge of #63542 - c410-f3r:node_ids, r=petrochenkovMazdak Farrokhzad-0/+1
Add NodeId for Arm, Field and FieldPat Extracted from #63468
2019-08-14Rollup merge of #63537 - petrochenkov:novisit, r=alexcrichtonMazdak Farrokhzad-16/+20
expand: Unimplement `MutVisitor` on `MacroExpander` Each call to `fully_expand_fragment` is something unique, interesting, and requiring attention. It represents a "root" of expansion and its use means that something unusual is happening, like eager expansion or expansion performed outside of the primary expansion pass. So, it shouldn't hide under a generic visitor call. Also, from all the implemented visitor methods only two were actually used. cc https://github.com/rust-lang/rust/pull/63468#discussion_r313504119
2019-08-14Merge Variant and Variant_Caio-14/+14
2019-08-13Add NodeId for Arm, Field and FieldPatCaio-0/+1