about summary refs log tree commit diff
path: root/src/libsyntax/config.rs
AgeCommit message (Collapse)AuthorLines
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
2018-08-15syntax: Enforce attribute grammar in the parserVadim Petrochenkov-1/+1
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-6/+6
2018-06-02Deny #[cfg] and #[cfg_attr] on generic parameters.kennytm-0/+16
2018-04-06Rename `ast::Variant_::name` into `ident` + Fix rebaseVadim Petrochenkov-1/+1
2018-04-02Expand attribute macros on statements and expressions.Austin Bonander-10/+17
Retains the `stmt_expr_attributes` feature requirement for attributes on expressions. closes #41475 cc #38356
2018-03-20rename epoch to editionKurtis Nusbaum-3/+3
2018-03-08Make it possible to ungate features by epochManish Goregaokar-2/+3
2018-02-17fix more typos found by codespell.Matthias Krüger-1/+1
2017-12-17syntax: Rename `P::unwrap` into `P::into_inner`Vadim Petrochenkov-2/+2
2017-08-30Make fields of `Span` privateVadim Petrochenkov-3/+2
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-5/+5
Like #43008 (f668999), but _much more aggressive_.
2017-06-15Remove struct_field_attributes feature gateWonwoo Choi-28/+0
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-4/+4
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-03-14Liberalize attributes.Jeffrey Seyfried-40/+32
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-3/+5
2017-01-11syntax: struct field attributes and cfgBenjamin Saunders-5/+64
2016-11-20Move `MetaItemKind`'s `Name` to a field of `MetaItem`.Jeffrey Seyfried-1/+1
2016-11-20Refactor away `ast::Attribute_`.Jeffrey Seyfried-6/+7
2016-11-11Change implementation of syntax::util::SmallVector to use ↵Mark-Simulacrum-1/+1
data_structures::SmallVec.