about summary refs log tree commit diff
path: root/src/libsyntax/config.rs
AgeCommit message (Collapse)AuthorLines
2019-11-10move config.rs to libsyntax_expandMazdak Farrokhzad-352/+0
2019-11-09move attr meta grammar to parse::validate_atr + ast_validationMazdak Farrokhzad-2/+2
2019-11-06Make doc comments cheaper with `AttrKind`.Nicholas Nethercote-5/+4
`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-2/+2
This kind of thing just makes the code harder to read.
2019-10-27syntax/attr: reduce reliance on parserMazdak Farrokhzad-1/+3
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-0/+1
2019-10-16syntax: extract parse_cfg_attrMazdak Farrokhzad-20/+1
2019-10-15syntax::parse::sess -> syntax::sessMazdak Farrokhzad-1/+2
2019-09-30syntax: Support modern attribute syntax in the `meta` matcherVadim Petrochenkov-4/+4
2019-09-30syntax: Split `ast::Attribute` into container and inner partsVadim Petrochenkov-2/+1
2019-09-26Rename `Pat.node` to `Pat.kind`varkor-1/+1
2019-09-26Rename `Expr.node` to `Expr.kind`varkor-2/+2
For both `ast::Expr` and `hir::Expr`.
2019-08-14Merge Variant and Variant_Caio-1/+1
2019-06-22Lint on 'cfg_attr(,).'Mazdak Farrokhzad-10/+11
2019-06-19Support `cfg` and `cfg_attr` on generic parametersVadim Petrochenkov-16/+4
2019-06-09Allow attributes in formal function parametersCaio-0/+9
2019-06-07parser: `self.span` -> `self.token.span`Vadim Petrochenkov-1/+1
2019-05-25Reword malformed attribute input diagnosticsEsteban Küber-0/+16
- Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error - Use consistend error message: "malformed `attrname` attribute input" - Provide suggestions when possible - Move note/help to label/suggestion - Use consistent wording "ill-formed" -> "malformed" - Move diagnostic logic out of parser
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-5/+6
2019-03-24Separate variant id and variant constructor id.David Wood-3/+2
This commit makes two changes - separating the `NodeId` that identifies an enum variant from the `NodeId` that identifies the variant's constructor; and no longer creating a `NodeId` for `Struct`-style enum variants and structs. Separation of the variant id and variant constructor id will allow the rest of RFC 2008 to be implemented by lowering the visibility of the variant's constructor without lowering the visbility of the variant itself. No longer creating a `NodeId` for `Struct`-style enum variants and structs mostly simplifies logic as previously this `NodeId` wasn't used. There were various cases where the `NodeId` wouldn't be used unless there was an unit or tuple struct or enum variant but not all uses of this `NodeId` had that condition, by removing this `NodeId`, this must be explicitly dealt with. This change mostly applied cleanly, but there were one or two cases in name resolution and one case in type check where the existing logic required a id for `Struct`-style enum variants and structs.
2019-03-17Do not complain about non-existing fields after parse recoveryEsteban Küber-1/+1
When failing to parse struct-like enum variants, the ADT gets recorded as having no fields. Record that we have actually recovered during parsing of this variant to avoid complaing about non-existing fields when actually using it.
2019-03-16Refactor away `NestedMetaItemKind`Vadim Petrochenkov-2/+2
Remove methods `Attribute::span` and `MetaItem::span` duplicating public fields
2019-03-14Add `-Z allow_features=...` flagTyler Mandry-3/+3
2019-02-13Rollup merge of #58273 - taiki-e:rename-dependency, r=matthewjasperMazdak Farrokhzad-1/+1
Rename rustc_errors dependency in rust 2018 crates I think this is a better solution than `use rustc_errors as errors` in `lib.rs` and `use crate::errors` in modules. Related: rust-lang/cargo#5653 cc #58099 r? @Centril
2019-02-13Cleanup importsTaiki Endo-1/+1
2019-02-13Rename rustc_errors dependency in rust 2018 cratesTaiki Endo-1/+1
2019-02-10rustc: doc commentsAlexander Regueiro-4/+4
2019-02-07libsyntax => 2018Taiki Endo-10/+11
2019-02-06Overhaul `syntax::fold::Folder`.Nicholas Nethercote-97/+69
This commit changes `syntax::fold::Folder` from a functional style (where most methods take a `T` and produce a new `T`) to a more imperative style (where most methods take and modify a `&mut T`), and renames it `syntax::mut_visit::MutVisitor`. The first benefit is speed. The functional style does not require any reallocations, due to the use of `P::map` and `MoveMap::move_{,flat_}map`. However, every field in the AST must be overwritten; even those fields that are unchanged are overwritten with the same value. This causes a lot of unnecessary memory writes. The imperative style reduces instruction counts by 1--3% across a wide range of workloads, particularly incremental workloads. The second benefit is conciseness; the imperative style is usually more concise. E.g. compare the old functional style: ``` fn fold_abc(&mut self, abc: ABC) { ABC { a: fold_a(abc.a), b: fold_b(abc.b), c: abc.c, } } ``` with the imperative style: ``` fn visit_abc(&mut self, ABC { a, b, c: _ }: &mut ABC) { visit_a(a); visit_b(b); } ``` (The reductions get larger in more complex examples.) Overall, the patch removes over 200 lines of code -- even though the new code has more comments -- and a lot of the remaining lines have fewer characters. Some notes: - The old style used methods called `fold_*`. The new style mostly uses methods called `visit_*`, but there are a few methods that map a `T` to something other than a `T`, which are called `flat_map_*` (`T` maps to multiple `T`s) or `filter_map_*` (`T` maps to 0 or 1 `T`s). - `move_map.rs`/`MoveMap`/`move_map`/`move_flat_map` are renamed `map_in_place.rs`/`MapInPlace`/`map_in_place`/`flat_map_in_place` to reflect their slightly changed signatures. - Although this commit renames the `fold` module as `mut_visit`, it keeps it in the `fold.rs` file, so as not to confuse git. The next commit will rename the file.
2019-02-05Various improvements in `Folder` impls.Nicholas Nethercote-32/+12
2019-01-26remove `_with_applicability` from suggestion fnsAndy Russell-1/+1
2019-01-13Implement basic input validation for built-in attributesVadim Petrochenkov-6/+3
2019-01-08remove unused imports and feature gate from testsdylan_DPC-3/+0
2019-01-08stabilise cfg_attrdylan_DPC-20/+2
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-2/+2
2018-10-23fix typos in various placesMatthias Krüger-2/+2
2018-10-07cfg_attr_multi: Feature gateHavvy (Ryan Scheel)-1/+35
2018-10-05cfg_attr_multi: Basic implementationHavvy (Ryan Scheel)-16/+43
Does not implement the warning or a feature flag.
2018-09-27Auto merge of #54581 - petrochenkov:cfgattr, r=alexcrichtonbors-0/+1
Accept trailing comma in `cfg_attr` Fixes https://github.com/rust-lang/rust/issues/54463 (stable-to-beta regression)
2018-09-26Remove OneVectorljedrz-6/+7
2018-09-26Accept trailing comma in `cfg_attr`Vadim Petrochenkov-0/+1
2018-09-17Whitespace fix again.Vitaly _Vi Shukela-4/+4
2018-09-17Fixed some remaining whitespace issues.Vitaly _Vi Shukela-1/+1
(Not sure if it is correct although).
2018-09-17Fill in suggestions Applicability according to @estebankVitaly _Vi Shukela-2/+3
Also fix some formatting along the way.
2018-09-16Remove usages of span_suggestion without ApplicabilityVitaly _Vi Shukela-1/+6
Use Applicability::Unspecified for all of them instead.
2018-09-06Validate syntax of `cfg` attributesVadim Petrochenkov-12/+32
2018-09-04Move #[test_case] to a syntax extensionJohn Renner-13/+2
2018-09-04Introduce Custom Test FrameworksJohn Renner-4/+4
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1