about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2019-09-22rename libsyntax::ext::tt to mbeAleksey Kladov-0/+0
mbe stands for macro-by-example
2019-09-22reduce visibility of a bunch of stuff in ext::ttAleksey Kladov-49/+40
2019-09-21Inline attribute constructorsMark Rousskov-14/+0
2019-09-21Inline ty_inferMark Rousskov-5/+1
2019-09-21Remove unused codeMark Rousskov-291/+3
2019-09-21Rollup merge of #64664 - matklad:remove-ast-builder, r=Mark-SimulacrumMazdak Farrokhzad-3/+0
fully remove AstBuilder The mentioned Cargo test is fixed in https://github.com/rust-lang/cargo/pull/7210 I think this can be removed now?
2019-09-21Remove constraints argument from path_allMark Rousskov-6/+5
It was never used
2019-09-21fully remove AstBuilderAleksey Kladov-3/+0
The mentioned Cargo test is fixed in https://github.com/rust-lang/cargo/pull/7210
2019-09-20factor out pluralisation remains after #64280gaolei-2/+3
2019-09-17Remove unused methods from HandlerMark Rousskov-3/+0
2019-09-17Privatize DiagnosticBuilder constructorsMark Rousskov-2/+2
2019-09-16Rollup merge of #64499 - nnethercote:use-Symbol-in-two-more-functions, ↵Mazdak Farrokhzad-22/+22
r=petrochenkov Use `Symbol` in two more functions. r? @petrochenkov
2019-09-16Use `Symbol` in two more functions.Nicholas Nethercote-22/+22
2019-09-15Auto merge of #64469 - matthewjasper:increase-hygiene-use, r=petrochenkovbors-11/+4
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
2019-09-15Remove `with_legacy_ctxt`Matthew Jasper-7/+0
2019-09-15Give more `Idents` spansMatthew Jasper-3/+3
2019-09-15Avoid some unnecessary `&str` to `Ident` conversionsMatthew Jasper-1/+1
2019-09-14feature_gate: Merge various attribute gating functionsVadim Petrochenkov-12/+3
2019-09-09Resolve attributes in several placesCaio-7/+494
Arm, Field, FieldPat, GenericParam, Param, StructField and Variant
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: libsyntaxAlexander Regueiro-1/+1
2019-09-07Rollup merge of #64233 - varkor:correct-pluralisation, r=estebankMazdak Farrokhzad-2/+7
Correct pluralisation of various diagnostic messages
2019-09-07Rollup merge of #63919 - matthewjasper:remove-gensymmed, r=petrochenkovMazdak Farrokhzad-7/+13
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-06Correct pluralisation of various diagnostic messagesvarkor-2/+7
2019-09-06Rollup merge of #64111 - Centril:ast-only-patkind-or, r=petrochenkovMazdak Farrokhzad-5/+5
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-05Add `with_{def_site,call_site,legacy}_ctxt,` methods to `Span`Vadim Petrochenkov-7/+7
Use these to create call-site spans for AST passes when needed.
2019-09-05Make use of hygiene in AST passesMatthew Jasper-2/+0
2019-09-05Allow ast passes to create hygienic spansMatthew Jasper-1/+9
2019-09-05Rollup merge of #64041 - matklad:token-stream-tt, r=petrochenkovMazdak Farrokhzad-16/+13
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-5/+5
2019-09-04flatten rustc_lexer::character_properties moduleAleksey Kladov-2/+1
On the call site, `rustc_lexer::is_whitespace` reads much better than `character_properties::is_whitespace`.
2019-09-04remove XID and Pattern_White_Space unicode tables from libcoreAleksey Kladov-2/+2
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 TokenStream rather than &[TokenTree] for built-in macrosAleksey Kladov-16/+13
That way, we don't loose the jointness info
2019-08-29Rollup merge of #63867 - petrochenkov:dhelpers, r=matthewjasperMazdak Farrokhzad-54/+86
resolve: Block expansion of a derive container until all its derives are resolved So, it turns out there's one more reason to block expansion of a `#[derive]` container until all the derives inside it are resolved, beside `Copy` (https://github.com/rust-lang/rust/pull/63248). The set of derive helper attributes registered by derives in the container also has to be known before the derives themselves are expanded, otherwise it may be too late (see https://github.com/rust-lang/rust/pull/63468#issuecomment-524550872 and the `#[stable_hasher]`-related test failures in https://github.com/rust-lang/rust/pull/63468). So, we stop our attempts to unblock the container earlier, as soon as the `Copy` status is known, and just block until all its derives are resolved. After all the derives are resolved we immediately go and process their helper attributes in the item, without delaying it until expansion of the individual derives. Unblocks https://github.com/rust-lang/rust/pull/63468 r? @matthewjasper (as a reviewer of https://github.com/rust-lang/rust/pull/63248) cc @c410-f3r
2019-08-28Auto merge of #63127 - kper:pr, r=nikomatsakisbors-6/+6
Cleanup: Consistently use `Param` instead of `Arg` #62426 Fixes #62426
2019-08-27Cleanup: Consistently use `Param` instead of `Arg` #62426Kevin Per-6/+6
2019-08-27proc_macro: Update `Span::def_site` to use the proc macro definition locationVadim Petrochenkov-4/+3
Which is no longer dummy and is available from metadata now.
2019-08-27Respect attributes on proc macro definitionsVadim Petrochenkov-59/+78
2019-08-27resolve: Block expansion of a derive container until all its derives are ↵Vadim Petrochenkov-54/+86
resolved Also mark derive helpers as known as a part of the derive container's expansion instead of expansion of the derives themselves which may happen too late.
2019-08-25Rollup merge of #63854 - c410-f3r:attrs-visit, r=petrochenkovMazdak Farrokhzad-3/+7
Modifies how Arg, Arm, Field, FieldPattern and Variant are visited Part of the necessary work to accomplish #63468.
2019-08-24Modifies how Arg, Arm, Field, FieldPattern and Variant are visitedCaio-3/+7
Part of the necessary work to accomplish #63468.
2019-08-23Remove default macro transparenciesVadim Petrochenkov-21/+0
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-33/+46
2019-08-23Audit uses of `apply_mark` in built-in macrosVadim Petrochenkov-17/+25
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-21resolve/expand: Rename some things for clarity and add commentsVadim Petrochenkov-4/+7
2019-08-21expand: Do not do questionable span adjustment before eagerly expanding an ↵Vadim Petrochenkov-4/+1
expression Maybe it made sense when it was introduced, but now it's doing something incorrect.
2019-08-21expand: Keep the correct current expansion ID for eager expansionsVadim Petrochenkov-1/+0
Solve the problem of `ParentScope` entries for eager expansions not exising in the resolver map by creating them on demand.
2019-08-17resolve/expand: Rename some things for clarityVadim Petrochenkov-19/+21
2019-08-16Rollup merge of #63525 - matklad:centraliza-file-loading, r=petrochenkovMazdak Farrokhzad-8/+5
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-15hygiene: `ExpnInfo` -> `ExpnData`Vadim Petrochenkov-20/+20
For naming consistency with everything else in this area
2019-08-15hygiene: Merge `ExpnInfo` and `InternalExpnData`Vadim Petrochenkov-8/+12