about summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
AgeCommit message (Collapse)AuthorLines
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-1543/+0
2019-10-16syntax: reduce visibilitiesMazdak Farrokhzad-1/+1
2019-10-15Remove unnecessary `use crate::sess::ParseSess;`.Mazdak Farrokhzad-1/+0
2019-10-15Rollup merge of #65376 - Centril:syntax-extractions-1, r=petrochenkovMazdak Farrokhzad-0/+1
syntax: misc extractions Part of https://github.com/rust-lang/rust/pull/65324. r? @petrochenkov
2019-10-15syntax::parse::sess -> syntax::sessMazdak Farrokhzad-1/+2
2019-10-15Stabilize proc macros generating `macro_rules` itemsVadim Petrochenkov-45/+4
2019-10-14Rollup merge of #65261 - nnethercote:rm-Option-from-TokenStream, r=petrochenkovTyler Mandry-2/+2
Remove `Option` from `TokenStream` A code simplification. r? @petrochenkov
2019-10-14Remove the `Option` in `TokenStream`.Nicholas Nethercote-2/+2
It means an allocation is required to create an empty `TokenStream`, but all other operations are simpler and marginally faster due to not having to check for `None`. Overall it simplifies the code for a negligible performance effect. The commit also removes `TokenStream::empty` by implementing `Default`, which is now possible.
2019-10-13ast: remove implicit pprust dependency via Display.Mazdak Farrokhzad-4/+9
Instead just use `pprust::path_to_string(..)` where needed. This has two benefits: a) The AST definition is now independent of printing it. (Therefore we get closer to extracting a data-crate.) b) Debugging should be easier as program flow is clearer.
2019-10-01Rollup merge of #63931 - petrochenkov:stabmac, r=CentrilMazdak Farrokhzad-17/+6
Stabilize macros in some more positions - Fn-like macros and attribute macros in `extern` blocks - Fn-like procedural macros in type positions - ~Attribute macros on inline modules~ (moved to https://github.com/rust-lang/rust/pull/64273) Stabilization report: https://github.com/rust-lang/rust/pull/63931#issuecomment-526362396. Closes https://github.com/rust-lang/rust/issues/49476 cc https://github.com/rust-lang/rust/issues/54727
2019-09-30syntax: Split `ast::Attribute` into container and inner partsVadim Petrochenkov-5/+5
2019-09-30Stabilize proc macros in type positionsVadim Petrochenkov-5/+5
2019-09-30Stabilize macros in `extern` blocksVadim Petrochenkov-12/+1
Add some tests for macros in extern blocks, remove duplicate tests
2019-09-26Rename `MetaItem.node` to `MetaItem.kind`varkor-2/+2
2019-09-26Rename `ForeignItem.node` to `ForeignItem.kind`varkor-1/+1
2019-09-26Rename `Item.node` to `Item.kind`varkor-6/+6
2019-09-26Rename `Stmt.node` to `Stmt.kind`varkor-4/+4
2019-09-26Rename `Ty.node` to `Ty.kind`varkor-2/+2
2019-09-26Rename `TraitItem.node` to `TraitItem.kind`varkor-1/+1
2019-09-26Rename `Lit.node` to `Lit.kind`varkor-1/+1
2019-09-26Rename `ImplItem.node` to `ImplItem.kind`varkor-1/+1
2019-09-26Rename `Pat.node` to `Pat.kind`varkor-2/+2
2019-09-26Rename `Expr.node` to `Expr.kind`varkor-4/+4
For both `ast::Expr` and `hir::Expr`.
2019-09-24Rollup merge of #64698 - Centril:infer-const-with-stash, r=estebankMazdak Farrokhzad-1/+1
Recover on `const X = 42;` and infer type + Error Stash API Here we: 1. Introduce a notion of the "error stash". This is a map in the `Handler` to which you can `err.stash(...)` away your diagnostics and then steal them in a later "phase" of the compiler (e.g. stash in parser, steal in typeck) to enrich them with more information that isn't available in the previous "phase". I believe I've covered all the bases to make sure these diagnostics are actually emitted eventually even under `#[cfg(FALSE)]` but please check my logic. 2. Recover when parsing `[const | static mut?] $ident = $expr;` which has a missing type. Use the "error stash" to stash away the error and later steal the error in typeck where we emit the error as `MachineApplicable` with the actual inferred type. This builds on https://github.com/rust-lang/rust/pull/62804. cc https://github.com/rust-lang/rfcs/pull/2545 r? @estebank
2019-09-23cleanup librustc_errors Handler code.Mazdak Farrokhzad-1/+1
2019-09-22rename tt -> mbe, part 2Aleksey Kladov-3/+3
2019-09-14feature_gate: Merge various attribute gating functionsVadim Petrochenkov-12/+3
2019-09-09Resolve attributes in several placesCaio-6/+193
Arm, Field, FieldPat, GenericParam, Param, StructField and Variant
2019-09-03use TokenStream rather than &[TokenTree] for built-in macrosAleksey Kladov-1/+1
That way, we don't loose the jointness info
2019-08-27resolve: Block expansion of a derive container until all its derives are ↵Vadim Petrochenkov-48/+66
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-23hygiene: Require passing transparency explicitly to `apply_mark`Vadim Petrochenkov-14/+0
2019-08-23Audit uses of `apply_mark` in built-in macrosVadim Petrochenkov-1/+0
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-2/+4
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-11/+14
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-10/+10
For naming consistency with everything else in this area
2019-08-15hygiene: Merge `ExpnInfo` and `InternalExpnData`Vadim Petrochenkov-6/+9
2019-08-15hygiene: Remove `Option`s from functions returning `ExpnInfo`Vadim Petrochenkov-1/+1
The expansion info is not optional and should always exist
2019-08-15`Ident::with_empty_ctxt` -> `Ident::with_dummy_span`Vadim Petrochenkov-4/+4
`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-1/+1
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::Mac`Vadim Petrochenkov-6/+5
2019-08-15Remove `Spanned` from `mk_name_value_item_str` and `expr_to_spanned_string`Vadim Petrochenkov-3/+5
2019-08-15Make sure that all file loading happens via SourceMapAleksey Kladov-8/+5
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-14expand: Unimplement `MutVisitor` on `MacroExpander`Vadim Petrochenkov-13/+1
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 be hide under a generic visitor call. Also, from all the implemented visitor methods only two were actually used.
2019-08-14expand: `expand_fragment` -> `fully_expand_fragment`Vadim Petrochenkov-6/+6
2019-08-09review comments: use structured suggestionEsteban Küber-15/+2
2019-08-09More explicit diagnostic when using a `vec![]` in a patternEsteban Küber-6/+22
``` error: unexpected `(` after qualified path --> $DIR/vec-macro-in-pattern.rs:3:14 | LL | Some(vec![x]) => (), | ^^^^^^^ | | | unexpected `(` after qualified path | in this macro invocation | use a slice pattern here instead | = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) ```