about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-08-14Rollup merge of #63475 - iluuu1994:issue-62632, r=CentrilMazdak Farrokhzad-0/+19
Bring back suggestion for splitting `<-` into `< -` Closes #62632
2019-08-14Rollup merge of #63459 - eddyb:issue-63430, r=petrochenkovMazdak Farrokhzad-1/+1
syntax: account for CVarArgs being in the argument list. Fixes #63430 by testing for `1` argument (the `CVarArgs` itself) instead of `0`. Note that the error has basically been impossible to trigger since the change that caused #63430, so perhaps we need an audit of untested errors. Also, this check probably belongs in AST validation/HIR lowering, but I'd rather fix it in place for now. r? @petrochenkov cc @dlrobertson
2019-08-13Add NodeId for Arm, Field and FieldPatCaio-3/+18
2019-08-14expand: Unimplement `MutVisitor` on `MacroExpander`Vadim Petrochenkov-17/+11
Each call to `fully_expand_fragment` is something unique, interesting, and requiring attention. It represents a "root" of expansion and its use means that something unusual is happening, like eager expansion or expansion performed outside of the primary expansion pass. So, it shouldn't be hide under a generic visitor call. Also, from all the implemented visitor methods only two were actually used.
2019-08-14expand: `expand_fragment` -> `fully_expand_fragment`Vadim Petrochenkov-6/+6
2019-08-13Apply Centril's suggestionEric Huss-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-08-13review commentsEsteban Küber-12/+9
2019-08-13Fix typo in error message.Eric Huss-1/+1
2019-08-13syntax: Remove `DummyResult::expn_only`Vadim Petrochenkov-33/+6
2019-08-12Do not ICE when synthesizing spans falling inside unicode charsEsteban Küber-0/+6
2019-08-12Parse excess semicolons as empty stmts for lintingnathanwhit-1/+16
2019-08-12syntax: account for CVarArgs being in the argument list.Eduard-Mihai Burtescu-1/+1
2019-08-12extract parse_pat_{tuple_}struct + recover_one_fewer_dotdotMazdak Farrokhzad-39/+51
2019-08-12extract fatal_unexpected_non_patMazdak Farrokhzad-16/+22
2019-08-12parser/pat: minor misc cleanupMazdak Farrokhzad-13/+15
2019-08-12extract parse_pat_range_starting_with_litMazdak Farrokhzad-20/+21
2019-08-12extract parse_pat_range_starting_with_pathMazdak Farrokhzad-15/+25
2019-08-12extract parse_pat_mac_invocMazdak Farrokhzad-14/+17
2019-08-12extract ban_pat_range_if_ambiguousMazdak Farrokhzad-20/+25
2019-08-12extract recover_pat_ident_mut_firstMazdak Farrokhzad-16/+20
2019-08-12Rollup merge of #63449 - petrochenkov:builtinagain, r=eddybMazdak Farrokhzad-3/+3
resolve: Remove remaining special cases from built-in macros Edition and definition sites of the macros are now also taken from the `#[rustc_builtin_macro]` definitions in `libcore`. --- The edition switch may be a breaking change for `Rustc{Encodable,Decodable}` derives if they are used in combination with the unstable crate `serialize` from sysroot like this ```rust extern crate serialize; use serialize as rustc_serialize; #[derive(RustcEncodable)] struct S; ``` (see the updated `ui-fulldeps` tests).
2019-08-12Bring back suggestion for splitting `<-` into `< -`Ilija Tovilo-0/+19
Closes #62632
2019-08-12extract parse_pat_tuple_or_parensMazdak Farrokhzad-12/+14
2019-08-12extract parse_pat_derefMazdak Farrokhzad-12/+16
2019-08-12parse_pat_with_range_pat: remove unnecessary assignments.Mazdak Farrokhzad-29/+25
2019-08-11parser: {check,expect}_lifetime into ty.rsMazdak Farrokhzad-19/+19
2019-08-11parser: move into generics.rsMazdak Farrokhzad-272/+278
2019-08-11parser: move into stmt.rsMazdak Farrokhzad-464/+477
2019-08-11parser: move parse_fn_block_decl into expr.rsMazdak Farrokhzad-60/+56
2019-08-11parser: move parse_ident_or_underscore into item.rsMazdak Farrokhzad-11/+11
2019-08-11parser: split into {ty, path}.rsMazdak Farrokhzad-899/+930
2019-08-11parser: split into {item,module}.rsMazdak Farrokhzad-2218/+2251
2019-08-11parser: split into pat.rsMazdak Farrokhzad-633/+642
2019-08-11parser: split into expr.rsMazdak Farrokhzad-1667/+1712
2019-08-10resolve: Remove remaining special cases from built-in macrosVadim Petrochenkov-3/+3
2019-08-10Rollup merge of #63399 - estebank:vec-in-pat, r=CentrilMazdak Farrokhzad-7/+48
More explicit diagnostic when using a `vec![]` in a pattern ``` error: unexpected `(` after qualified path --> $DIR/vec-macro-in-pattern.rs:3:14 | LL | Some(vec![x]) => (), | ^^^^^^^ | | | unexpected `(` after qualified path | in this macro invocation | use a slice pattern here instead | = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) ``` Fix #61933.
2019-08-09review comments: use structured suggestionEsteban Küber-34/+36
2019-08-09More explicit diagnostic when using a `vec![]` in a patternEsteban Küber-6/+45
``` error: unexpected `(` after qualified path --> $DIR/vec-macro-in-pattern.rs:3:14 | LL | Some(vec![x]) => (), | ^^^^^^^ | | | unexpected `(` after qualified path | in this macro invocation | use a slice pattern here instead | = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) ```
2019-08-09Recover parser from `foo(_, _)`Esteban Küber-20/+50
2019-08-08reduce visibilityAleksey Kladov-2/+2
2019-08-06Rollup merge of #63285 - Mark-Simulacrum:rm-await-origin, r=CentrilMazdak Farrokhzad-9/+0
Remove leftover AwaitOrigin This was missed in PR #62293.
2019-08-06Rollup merge of #63272 - Mark-Simulacrum:clean-attr, r=petrochenkovMazdak Farrokhzad-13/+12
Some more libsyntax::attr cleanup Much smaller patch than the last one, mostly just finishing up by removing some Span arguments. r? @petrochenkov
2019-08-05Remove leftover AwaitOriginMark Rousskov-9/+0
This was missed in PR #62293.
2019-08-05Make mk_attr_id private to libsyntaxMark Rousskov-1/+1
2019-08-05Drop explicit span argument from mk_name_value_itemMark Rousskov-4/+4
2019-08-05Drop span argument from mk_list_itemMark Rousskov-8/+7
2019-08-05add unknown tokenAleksey Kladov-4/+7
2019-08-05remove special code path for unknown tokensAleksey Kladov-60/+13
2019-08-05Auto merge of #63248 - petrochenkov:nomarker, r=matthewjasperbors-56/+26
Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion infrastructure to elsewhere As described in https://github.com/rust-lang/rust/pull/62086#issuecomment-515195477. Reminder: - `derive(PartialEq, Eq)` makes the type it applied to a "structural match" type, so constants of this type can be used in patterns (and const generics in the future). - `derive(Copy)` notifies other derives that the type it applied to implements `Copy`, so `derive(Clone)` can generate optimized code and other derives can generate code working with `packed` types and types with `rustc_layout_scalar_valid_range` attributes. First, the special behavior is now enabled after properly resolving the derives, rather than after textually comparing them with `"Copy"`, `"PartialEq"` and `"Eq"` in `fn add_derived_markers`. The markers are no longer kept as attributes in AST since derives cannot modify items and previously did it through hacks in the expansion infra. Instead, the markers are now kept in a "global context" available from all the necessary places, namely - resolver. For `derive(PartialEq, Eq)` the markers are created by the derive macros themselves and then consumed during HIR lowering to add the `#[structural_match]` attribute in HIR. This is still a hack, but now it's a hack local to two specific macros rather than affecting the whole expansion infra. Ideally we should find the way to put `#[structural_match]` on the impls rather than on the original item, and then consume it in `rustc_mir`, then no hacks in expansion and lowering will be required. (I'll make an issue about this for someone else to solve, after this PR lands.) The marker for `derive(Copy)` cannot be emitted by the `Copy` macro itself because we need to know it *before* the `Copy` macro is expanded for expanding other macros. So we have to do it in resolve and block expansion of any derives in a `derive(...)` container until we know for sure whether this container has `Copy` in it or not. Nasty stuff. r? @eddyb or @matthewjasper
2019-08-04Auto merge of #63213 - varkor:itemkind-tyalias, r=Centrilbors-13/+13
Rename `ItemKind::Ty` to `ItemKind::TyAlias` The current name is not entirely clear without context and `TyAlias` is consistent with `ItemKind::TraitAlias`.