about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2017-03-14Liberalize attributes.Jeffrey Seyfried-71/+71
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-39/+21
2017-03-14Cleanup.Jeffrey Seyfried-1/+1
2017-03-12Rollup merge of #40369 - petrochenkov:segspan, r=eddybCorey Farwell-7/+12
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes https://github.com/rust-lang/rust/pull/38927#discussion_r95336667 https://github.com/rust-lang/rust/pull/38890#issuecomment-271731008 r? @nrc @eddyb
2017-03-11Auto merge of #40220 - jseyfried:ast_macro_def, r=nrcbors-111/+28
syntax: add `ast::ItemKind::MacroDef`, simplify hygiene info This PR - adds a new variant `MacroDef` to `ast::ItemKind` for `macro_rules!` and eventually `macro` items, - [breaking-change] forbids macro defs without a name (`macro_rules! { () => {} }` compiles today), - removes `ast::MacroDef`, and - no longer uses `Mark` and `Invocation` to identify and characterize macro definitions. - We used to apply (at least) two `Mark`s to an expanded identifier's `SyntaxContext` -- the definition mark(s) and the expansion mark(s). We now only apply the latter. r? @nrc
2017-03-10Give spans to individual path segments in ASTVadim Petrochenkov-7/+12
2017-03-10Expect macro defs in save-analysis and add expn info to spans for attr proc ↵Nick Cameron-1/+13
macros
2017-03-10Avoid using `Mark` and `Invocation` for macro defs.Jeffrey Seyfried-16/+5
2017-03-10Move `resolve_invoc` from `syntax` to `resolve`.Jeffrey Seyfried-63/+11
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-35/+15
2017-03-03Integrate `TokenStream`.Jeffrey Seyfried-107/+93
2017-03-03Remove lifetime parameter from `syntax::tokenstream::Cursor`.Jeffrey Seyfried-1/+1
2017-03-02Auto merge of #39655 - durka:recursion-limit-suggestion, r=nikomatsakisbors-4/+10
suggest doubling recursion limit in more situations Fixes #38852. r? @bluss
2017-03-02note -> helpAlex Burka-1/+1
2017-02-28Add warning cycle.Jeffrey Seyfried-11/+27
2017-02-28Merge `repeat_idx` and `repeat_len`.Jeffrey Seyfried-17/+15
2017-02-28Remove `Token::MatchNt`.Jeffrey Seyfried-68/+78
2017-02-28Add `syntax::ext::tt::quoted::{TokenTree, ..}` and remove ↵Jeffrey Seyfried-193/+358
`tokenstream::TokenTree::Sequence`.
2017-02-28Avoid `Token::{OpenDelim, CloseDelim}`.Jeffrey Seyfried-16/+22
2017-02-28Remove `ext::tt::transcribe::tt_next_token`.Jeffrey Seyfried-149/+124
2017-02-28Clean up `ext::tt::transcribe::TtFrame`, rename to `Frame`.Jeffrey Seyfried-57/+84
2017-02-28Remove a `loop` in `ext::tt::transcribe`.Jeffrey Seyfried-32/+23
2017-02-23Move MacroKind into Def::MacroJosh Driver-1/+1
2017-02-16Refactor macro resolution errors + add derive macro suggestionsJosh Driver-16/+42
2017-02-12Allow using inert attributes from `proc_macro_derive`s with ↵Jeffrey Seyfried-228/+231
`#![feature(proc_macro)]`.
2017-02-12Move legacy custom derives collection into `resolver.find_attr_invoc()`.Jeffrey Seyfried-35/+1
2017-02-09suggest doubling recursion limit in more situationsAlex Burka-4/+10
2017-02-05Move derive macro expansion into the MacroExpanderJosh Driver-8/+330
This removes the expand_derives function, and sprinkles the functionality throughout the Invocation Collector, Expander and Resolver.
2017-02-05Rename CustomDerive to ProcMacroDerive for macros 1.1Josh Driver-3/+7
2017-02-05Make builtin derives a SyntaxExtensionJosh Driver-3/+9
This allows builtin derives to be registered and resolved, just like other derive types.
2017-02-03Bump version, upgrade bootstrapAlex Crichton-2/+0
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2017-01-23Remove `open_span` and `close_span` from `Delimited`.Jeffrey Seyfried-13/+10
2017-01-22Refactor `TokenStream`.Jeffrey Seyfried-78/+4
2017-01-20Rollup merge of #39118 - jseyfried:token_tree_based_parser, r=nrcAlex Crichton-100/+49
Refactor the parser to consume token trees This is groundwork for efficiently parsing attribute proc macro invocations, bang macro invocations, and `TokenStream`-based attributes and fragment matchers. This improves parsing performance by 8-15% and expansion performance by 0-5% on a sampling of the compiler's crates. r? @nrc
2017-01-20Rollup merge of #38842 - abonander:proc_macro_attribute, r=jseyfriedAlex Crichton-3/+27
Implement `#[proc_macro_attribute]` This implements `#[proc_macro_attribute]` as described in https://github.com/rust-lang/rfcs/pull/1566 The following major (hopefully non-breaking) changes are included: * Refactor `proc_macro::TokenStream` to use `syntax::tokenstream::TokenStream`. * `proc_macro::tokenstream::TokenStream` no longer emits newlines between items, this can be trivially restored if desired * `proc_macro::TokenStream::from_str` does not try to parse an item anymore, moved to `impl MultiItemModifier for CustomDerive` with more informative error message * Implement `#[proc_macro_attribute]`, which expects functions of the kind `fn(TokenStream, TokenStream) -> TokenStream` * Reactivated `#![feature(proc_macro)]` and gated `#[proc_macro_attribute]` under it * `#![feature(proc_macro)]` and `#![feature(custom_attribute)]` are mutually exclusive * adding `#![feature(proc_macro)]` makes the expansion pass assume that any attributes that are not built-in, or introduced by existing syntax extensions, are proc-macro attributes * Fix `feature_gate::find_lang_feature_issue()` to not use `unwrap()` * This change wasn't necessary for this PR, but it helped debugging a problem where I was using the wrong feature string. * Move "completed feature gate checking" pass to after "name resolution" pass * This was necessary for proper feature-gating of `#[proc_macro_attribute]` invocations when the `proc_macro` feature flag isn't set. Prototype/Litmus Test: [Implementation](https://github.com/abonander/anterofit/blob/proc_macro/service-attr/src/lib.rs#L13) -- [Usage](https://github.com/abonander/anterofit/blob/proc_macro/service-attr/examples/post_service.rs#L35)
2017-01-17Auto merge of #39110 - petrochenkov:sum, r=eddybbors-31/+7
Merge ObjectSum and PolyTraitRef in AST/HIR + some other refactoring `ObjectSum` and `PolyTraitRef` are the same thing (list of bounds), they exist separately only due to parser quirks. The second commit merges them. The first commit replaces `Path` with `Ty` in (not yet supported) equality predicates. They are parsed as types anyway and arbitrary types can always be disguised as paths using aliases, so this doesn't add any new functionality. The third commit uses `Vec` instead of `P<[T]>` in AST. AST is not immutable like HIR and `Vec`s are more convenient for it, unnecessary conversions are also avoided. The last commit renames `parse_ty_sum` (which is used for parsing types in general) into `parse_ty`, and renames `parse_ty` (which is used restricted contexts where `+` is not permitted due to operator priorities or other reasons) into `parse_ty_no_plus`. This is the first part of https://github.com/rust-lang/rust/issues/39085#issuecomment-272743755 and https://github.com/rust-lang/rust/issues/39080 focused on data changes and mechanical renaming, I'll submit a PR with parser changes a bit later. r? @eddyb
2017-01-17Avoid interpolated token trees.Jeffrey Seyfried-17/+3
2017-01-17Clean up `ext::tt::transcribe`.Jeffrey Seyfried-74/+35
2017-01-17Refactor the parser to consume token trees.Jeffrey Seyfried-18/+24
2017-01-17Introduce `string_reader.parse_all_token_trees()`.Jeffrey Seyfried-7/+3
2017-01-17Give the `StringReader` a `sess: &ParseSess`.Jeffrey Seyfried-1/+1
2017-01-16Implement `#[proc_macro_attribute]`Austin Bonander-3/+27
* Add support for `#[proc_macro]` * Reactivate `proc_macro` feature and gate `#[proc_macro_attribute]` under it * Have `#![feature(proc_macro)]` imply `#![feature(use_extern_macros)]`, error on legacy import of proc macros via `#[macro_use]`
2017-01-17Auto merge of #39090 - solson:exprkind-array, r=eddybbors-1/+1
Rename ExprKind::Vec to Array in HIR and HAIR. This is a clearer name since they represent `[a, b, c]` array literals. r? @eddyb
2017-01-17syntax: Rename parse_ty -> parse_ty_no_plus, parse_ty_sum -> parse_tyVadim Petrochenkov-3/+3
2017-01-17Use resizable Vec instead of P<[T]> in ASTVadim Petrochenkov-21/+4
2017-01-17AST/HIR: Merge ObjectSum and PolyTraitRefVadim Petrochenkov-7/+0
2017-01-16Rename ExprKind::Vec to Array in HIR and HAIR.Scott Olson-1/+1
This is a clearer name since they represent [a, b, c] array literals.
2017-01-15Mark the pushpop_unsafe feature as "removed"est31-1/+0
This marks the pushpop_unsafe feature as removed inside the feature_gate. It was added in commit 1829fa5199bae5a192c771807c532badce14be37 and then removed again in commit d399098fd82e0bf3ed61bbbbcdbb0b6adfa4c808 . Seems that the second commit forgot to mark it as removed in feature_gate.rs. This enables us to remove another element from the whitelist of non gate tested unstable lang features (issue #39059).
2017-01-12Auto merge of #38814 - Ralith:cfg-fields, r=jseyfriedbors-1/+8
syntax: enable attributes and cfg on struct fields This enables conditional compilation of field initializers in a struct literal, simplifying construction of structs whose fields are themselves conditionally present. For example, the intializer for the constant in the following becomes legal, and has the intuitive effect: ```rust struct Foo { #[cfg(unix)] bar: (), } const FOO: Foo = Foo { #[cfg(unix)] bar: (), }; ``` It's not clear to me whether this calls for the full RFC process, but the implementation was simple enough that I figured I'd begin the conversation with code.
2017-01-11syntax: struct field attributes and cfgBenjamin Saunders-1/+8