about summary refs log tree commit diff
path: root/src/libsyntax/attr
AgeCommit message (Collapse)AuthorLines
2019-12-20introduce 'type AttrVec'Mazdak Farrokhzad-3/+2
2019-12-20Rollup merge of #67131 - Centril:item-merge, r=petrochenkovMazdak Farrokhzad-1/+1
Merge `TraitItem` & `ImplItem into `AssocItem` In this PR we: - Merge `{Trait,Impl}Item{Kind?}` into `AssocItem{Kind?}` as discussed in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286. - This is done by using the cover grammar of both forms. - In particular, it requires that we syntactically allow (under `#[cfg(FALSE)]`): - `default`ness on `trait` items, - `impl` items without a body / definition (`const`, `type`, and `fn`), - and associated `type`s in `impl`s with bounds, e.g., `type Foo: Ord;`. - The syntactic restrictions are replaced by semantic ones in `ast_validation`. - Move syntactic restrictions around C-variadic parameters from the parser into `ast_validation`: - `fn`s in all contexts now syntactically allow `...`, - `...` can occur anywhere in the list syntactically (`fn foo(..., x: usize) {}`), - and `...` can be the sole parameter (`fn foo(...) {}`. r? @petrochenkov
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-62/+63
functions with a `const` modifier
2019-12-12Unify `{Impl,Trait}Item` as `AssocItem`.Mazdak Farrokhzad-1/+1
2019-12-02syntax: Optimize conversion `AttrItem` -> `MetaItem` by avoiding `outer_tokens`.Vadim Petrochenkov-29/+44
2019-12-02syntax: Use `ast::MacArgs` for attributesVadim Petrochenkov-15/+27
2019-11-30move GateIssue to rustc_feature & simplify emit_feature_errMazdak Farrokhzad-2/+2
2019-11-30builtin_attrs.rs -> rustc_featureMazdak Farrokhzad-6/+3
2019-11-30move is_builtin_attr to syntax::attrMazdak Farrokhzad-0/+6
2019-11-30simplify gated cfgs logicMazdak Farrokhzad-7/+17
2019-11-30move AttributeTemplate to builtin_attrsMazdak Farrokhzad-25/+0
2019-11-30introduce crate rustc_feature and move active, accepted, and removed to itMazdak Farrokhzad-1/+2
2019-11-17Remove extern crate.Camille GILLOT-0/+1
2019-11-17Further HashStable_Generic derives.Camille GILLOT-4/+7
2019-11-17Use proc_macro for HashStable derive in libsyntax.Camille GILLOT-1/+1
2019-11-17Rollup merge of #66381 - Centril:66340, r=petrochenkovYuki Okushi-1/+4
find_deprecation: deprecation attr may be ill-formed meta. Fixes #66340. r? @petrochenkov cc @pnkfelix
2019-11-15find_deprecation: deprecation attr may be ill-formed meta.Mazdak Farrokhzad-1/+4
2019-11-14Update to use new librustc_error_codes libraryGuillaume Gomez-0/+2
2019-11-11support issue = "none" in unstable attributesRoss MacArthur-10/+21
- Use `Option<NonZeroU32>` to represent issue numbers.
2019-11-10move syntax::parse -> librustc_parseMazdak Farrokhzad-4/+4
also move MACRO_ARGUMENTS -> librustc_parse
2019-11-10move config.rs to libsyntax_expandMazdak Farrokhzad-1/+5
2019-11-09move attr meta grammar to parse::validate_atr + ast_validationMazdak Farrokhzad-87/+1
2019-11-07syntax::attr: remove usage of lexerMazdak Farrokhzad-3/+2
2019-11-07move PResult to librustc_errorsMazdak Farrokhzad-1/+2
2019-11-07syntax::parser::token -> syntax::tokenMazdak Farrokhzad-1/+1
2019-11-06Make doc comments cheaper with `AttrKind`.Nicholas Nethercote-35/+83
`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a big performance win (over 10% in some cases) because `DocComment` lets doc comments (which are common) be represented very cheaply. `Attribute` gets some new helper methods to ease the transition: - `has_name()`: check if the attribute name matches a single `Symbol`; for `DocComment` variants it succeeds if the symbol is `sym::doc`. - `is_doc_comment()`: check if it has a `DocComment` kind. - `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant; panic otherwise. Fixes #60935.
2019-11-06Remove unnecessary `Deref` impl for `Attribute`.Nicholas Nethercote-9/+9
This kind of thing just makes the code harder to read.
2019-10-27syntax/attr: reduce reliance on parserMazdak Farrokhzad-27/+2
2019-10-25move Attribute::with_desugared_doc to librustdocMazdak Farrokhzad-27/+2
2019-10-21Remove many unnecessary trait derivations.Nicholas Nethercote-5/+4
2019-10-18Change `MetaItem::tokens()` to `MetaItem::token_trees_and_joints()`.Nicholas Nethercote-17/+26
Likewise for `NestedMetaItem::tokens()`. Also, add `MetaItemKind::token_trees_and_joints()`, which `MetaItemKind::tokens()` now calls. This avoids some unnecessary `TokenTree` to `TokenStream` conversions, and removes the need for the clumsy `TokenStream::append_to_tree_and_joint_vec()`.
2019-10-18Change `Lit::tokens()` to `Lit::token_tree()`.Nicholas Nethercote-4/+5
Because most of the call sites have an easier time working with a `TokenTree` instead of a `TokenStream`.
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-2/+2
2019-10-16attr: remove dep on ExtCtxtMazdak Farrokhzad-9/+5
2019-10-16syntax: reduce visibilitiesMazdak Farrokhzad-3/+3
2019-10-16syntax: extract parse_cfg_attrMazdak Farrokhzad-1/+0
2019-10-16syntax: extract parse_derive_pathsMazdak Farrokhzad-15/+3
2019-10-15syntax::parse::sess -> syntax::sessMazdak Farrokhzad-2/+3
2019-10-14Rollup merge of #65261 - nnethercote:rm-Option-from-TokenStream, r=petrochenkovTyler Mandry-1/+1
Remove `Option` from `TokenStream` A code simplification. r? @petrochenkov
2019-10-14Remove the `Option` in `TokenStream`.Nicholas Nethercote-1/+1
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-9/+25
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-09-30syntax: Support modern attribute syntax in the `meta` matcherVadim Petrochenkov-5/+11
2019-09-30syntax: Split `ast::Attribute` into container and inner partsVadim Petrochenkov-7/+7
2019-09-26Rename `MetaItem.node` to `MetaItem.kind`varkor-25/+25
2019-09-26Rename `Stmt.node` to `Stmt.kind`varkor-2/+2
2019-09-26Rename `Lit.node` to `Lit.kind`varkor-8/+8
2019-09-24Stabilize `str::len`, `[T]::len`, `is_empty` and `str::as_bytes` as const fnOliver Scherer-0/+24
2019-09-08Rollup merge of #64066 - petrochenkov:softstab, r=matthewjasperMazdak Farrokhzad-16/+12
Support "soft" feature-gating using a lint Use it for feature-gating `#[bench]`. Closes https://github.com/rust-lang/rust/issues/63798.
2019-09-07Support "soft" feature-gating using a lintVadim Petrochenkov-16/+12
Use it for feature-gating `#[bench]`
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: libsyntaxAlexander Regueiro-21/+22