about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-02-10rustc: doc commentsAlexander Regueiro-289/+300
2019-02-09Auto merge of #57944 - estebank:unclosed-delim-the-quickening, r=oli-obkbors-103/+286
Deduplicate mismatched delimiter errors Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently. Second attempt at #54029, follow up to #53949. Fix #31528.
2019-02-09Auto merge of #57617 - mark-i-m:multiple-matcher-bindings, r=petrochenkovbors-5/+64
Error on duplicate matcher bindings fix #57593 This should not be merged without a crater run and maybe an FCP. Discussion is ongoing at #57593. TODO: - [x] write tests - [x] crater run - [x] ~maybe need edition gating?~ not for 1 regression /centril r? @petrochenkov
2019-02-08Auto merge of #58191 - varkor:const-generics-ast, r=petrochenkovbors-187/+206
Add const generics to the AST This is mostly split out from https://github.com/rust-lang/rust/pull/53645 in an effort to make progress merging const generics piecewise instead of in one go. cc @yodaldevoid, @petrochenkov r? @eddyb
2019-02-07Make it an incompatibility lint for nowMark Mansi-9/+24
2019-02-07error on duplicate matcher bindingsmark-5/+49
2019-02-07Add fixmeEsteban Küber-1/+3
2019-02-07Make name resolution handle consts in GenericParamsFromOuterFunction properlyvarkor-1/+2
2019-02-07Parse negative literals in const generic argumentsvarkor-2/+1
2019-02-07Add warning for a parameter list with an attribute but no parametersvarkor-7/+19
2019-02-07Fix update to 2018 editionvarkor-1/+1
2019-02-07Adjust parser generic parameter errorsvarkor-28/+26
2019-02-07Add lowering errors for const genericsvarkor-0/+6
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Add resolution errors for const genericsvarkor-0/+20
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Add pretty-printing for const genericsvarkor-1/+11
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Support const generics in derivevarkor-1/+19
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Parse const genericsvarkor-178/+112
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Add const_generics feature flagvarkor-2/+13
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Add Const kind to ASTvarkor-3/+13
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Remove images' url to make it work even without internet connectionGuillaume Gomez-3/+1
2019-02-07add doc comment and revert angle bracket changeEsteban Küber-3/+5
2019-02-07tweak wording based on in person feedbackEsteban Küber-2/+2
2019-02-07fix testEsteban Küber-2/+5
2019-02-07Remove unused `match`Esteban Küber-19/+4
2019-02-07Add missing trailing newlineEsteban Küber-1/+1
2019-02-07Remove spurious complaint about missing expression for bare semicolonsEsteban Küber-1/+16
2019-02-07unify error handling to single methodEsteban Küber-34/+25
2019-02-07Deduplicate mismatched delimiter errorsEsteban Küber-102/+287
Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently.
2019-02-07Auto merge of #57998 - niklasf:align-enum, r=nagisabors-0/+14
Allow #[repr(align(x))] on enums (#57996) Tracking issue: #57996 Implements an extension of [RFC 1358](https://github.com/rust-lang/rfcs/blob/master/text/1358-repr-align.md) behind a feature flag (`repr_align_enum`). Originally introduced here for structs: #39999. It seems like only HIR-level changes are required, since enums are already aware of their alignment (due to alignment of their limbs). cc @bitshifter
2019-02-07libsyntax => 2018Taiki Endo-574/+617
2019-02-06Auto merge of #58061 - nnethercote:overhaul-syntax-Folder, r=petrochenkovbors-1924/+1700
Overhaul `syntax::fold::Folder`. This PR 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`. This makes the code faster and more concise.
2019-02-06Rename `fold.rs` as `mut_visit.rs`.Nicholas Nethercote-1/+1
2019-02-06Overhaul `syntax::fold::Folder`.Nicholas Nethercote-1436/+1326
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-06Rollup merge of #58116 - topecongiro:wrong-span-assignment, r=petrochenkovkennytm-0/+8
Include the span of attributes of the lhs to the span of the assignment expression This PR adds the span of attributes of the lhs to the span of the assignment expression. Currently with the following code, `#[attr]` is not included to the span of the assignment (`foo = true`). ```rust #[attr] foo = true; ``` The rational behind this change is that as libsyntax user I expect the span of the parent node includes every span of child nodes. cc https://github.com/rust-lang/rustfmt/issues/3313, https://github.com/rust-lang/rust/issues/15701.
2019-02-06Rollup merge of #58001 - ↵kennytm-1/+7
pnkfelix:issue-57735-proc-macro-with-large-tokenstream-slow, r=eddyb proc_macro: make `TokenStream::from_streams` pre-allocate its vector. This requires a pre-pass over the input streams. But that is cheap compared to the quadratic blowup associated with reallocating the accumulating vector on-the-fly. Fix #57735
2019-02-05Auto merge of #57973 - davidtwco:issue-52891, r=estebankbors-0/+7
Add suggestion for duplicated import. Fixes #52891. This PR adds a suggestion when a import is duplicated (ie. the same name is used twice trying to import the same thing) to remove the second import.
2019-02-05Various improvements in `Folder` impls.Nicholas Nethercote-46/+18
2019-02-05Streamline `Folder` some more.Nicholas Nethercote-43/+39
By eliminating some unnecessary methods, and moving/renaming some functions that look like they might be methods but aren't.
2019-02-05Neaten up `fold_crate`.Nicholas Nethercote-24/+15
2019-02-05Change `fold_qpath` to `fold_qself`.Nicholas Nethercote-14/+8
It's simpler that way.
2019-02-05Simplify `fold_attribute`.Nicholas Nethercote-15/+9
It doesn't need to return an `Option`.
2019-02-05Fold some overlooked spans.Nicholas Nethercote-11/+16
2019-02-05Streamline `Folder`.Nicholas Nethercote-77/+20
Specifically: - Remove dead methods: fold_usize, fold_meta_items, fold_opt_bounds. - Remove useless methods: fold_global_asm, fold_range_end. - Inline and remove unnecessary methods: fold_item_simple, fold_foreign_item_simple.
2019-02-05Remove some unnecessary `ast::` and `fold::` qualifiers.Nicholas Nethercote-46/+37
2019-02-04Add the span of attributes of the lhs to the span of the assignment expressiontopecongiro-0/+8
2019-02-02fix stabilization order of uniform_paths.Mazdak Farrokhzad-2/+2
2019-02-01Auto merge of #58002 - oli-obk:deprecated_sugg, r=zackmdavisbors-1/+4
Add suggestions to deprecation lints Clippy used to do this suggestion, but the clippy lints happen after the deprecation lints so we ended up never seeing the structured suggestions.
2019-01-31Add suggestion for duplicated import.David Wood-0/+7
This commit adds a suggestion when a import is duplicated (ie. the same name is used twice trying to import the same thing) to remove the second import.
2019-01-31Rollup merge of #57999 - jethrogb:jb/movbe-feature, r=alexcrichtonMazdak Farrokhzad-0/+1
Add MOVBE x86 CPU feature I have no idea if this is correct. I basically copied the ADX feature. I verified the feature is also called `movbe` in LLVM. I marked this to become stable immediately, as part of the RFC 2045. r? @alexcrichton
2019-01-31Rollup merge of #57008 - ↵Mazdak Farrokhzad-1/+6
Knium:misleading-try-adding-parentheses-in-match-with-comma, r=oli-obk suggest `|` when `,` founds in invalid match value Issue #54807 I get stuck on (what | how) I should implement...