about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-12-31Address review commentsEsteban Küber-12/+13
- Suggest raw ident escaping in all editions - Keep primary label in all cases
2018-12-31Suggest using raw identifiers in 2018 edition when using keywordsEsteban Küber-1/+12
2018-12-30Auto merge of #57205 - petrochenkov:extrecov, r=estebankbors-5/+6
Improve error recovery for some built-in macros Fixes https://github.com/rust-lang/rust/issues/55897
2018-12-30Improve error recovery for some built-in macrosVadim Petrochenkov-5/+6
2018-12-29Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkovbors-1/+4
Implement RFC 2338, "Type alias enum variants" This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following. ```rust #![feature(type_alias_enum_variants)] enum Foo { Bar(i32), Baz { i: i32 }, } type Alias = Foo; fn main() { let t = Alias::Bar(0); let t = Alias::Baz { i: 0 }; match t { Alias::Bar(_i) => {} Alias::Baz { i: _i } => {} } } ``` Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern. Fixes issues #56199 and #56611. N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible. ```rust Option::<u8>::None; // OK Option::None::<u8>; // OK, but lint in near future (hard error next edition?) Alias::<u8>::None; // OK Alias::None::<u8>; // Error ``` I do not know if this will need an FCP, but let's start one if so.
2018-12-29Rollup merge of #57159 - ids1024:closed-issue, r=Centrilkennytm-1/+1
Update references to closed issue Issue #28979 was closed with a link to #55467.
2018-12-28Auto merge of #57155 - petrochenkov:dcrate3, r=dtolnaybors-0/+18
Resolve `$crate`s for pretty-printing at more appropriate time Doing it in `BuildReducedGraphVisitor` wasn't a good idea, identifiers wasn't actually visited half of the time. As a result some `$crate`s weren't resolved and were therefore pretty-printed as `$crate` literally, which turns into two tokens during re-parsing of the pretty-printed text. Now we are visiting and resolving `$crate` identifiers in an item right before sending that item to a proc macro attribute or derive. Fixes https://github.com/rust-lang/rust/issues/57089
2018-12-27Update references to closed issueIan Douglas Scott-1/+1
Issue #28979 was closed with a link to #55467.
2018-12-28Resolve `$crate`s for pretty-printing at more appropriate timeVadim Petrochenkov-0/+18
2018-12-27Address review comments and CI failuresVadim Petrochenkov-0/+1
2018-12-27Make sure feature gate errors are recoverableVadim Petrochenkov-1/+0
2018-12-27Fix `trace_macros` and `log_syntax`Vadim Petrochenkov-13/+19
2018-12-27Get rid of `Block::recovered`Vadim Petrochenkov-10/+7
2018-12-27Do not abort compilation if expansion produces errorsVadim Petrochenkov-24/+20
Fix a number of uncovered deficiencies in diagnostics
2018-12-27AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-endVadim Petrochenkov-2/+17
2018-12-26Implemented variants on type aliases in both ctor and pattern position.Alexander Regueiro-1/+4
2018-12-25Remove licensesMark Rousskov-499/+0
2018-12-23Rollup merge of #57067 - Centril:stabilize-min_const_unsafe_fn, r=oli-obkMazdak Farrokhzad-3/+2
Stabilize min_const_unsafe_fn in 1.33 Fixes #55607 r? @oli-obk
2018-12-23Rollup merge of #56964 - nnethercote:TokenStream-IsJoint, r=petrochenkovMazdak Farrokhzad-54/+44
Remove `TokenStream::JointTree`. This is done by adding a new `IsJoint` field to `TokenStream::Tree`, which simplifies a lot of `match` statements. And likewise for `CursorKind`. The commit also adds a new method `TokenTree:stream()` which can replace a choice between `.into()` and `.joint()`.
2018-12-23stabilize min_const_unsafe_fn in 1.33.Mazdak Farrokhzad-3/+2
2018-12-23Rollup merge of #57052 - Centril:fix-eip-stable-version, r=varkorkennytm-3/+3
Fix stabilization version numbers (exhaustive_integer_patterns + macro_literal_matcher) + `exhaustive_integer_patterns` slipped 1.32; merged in 1.33 -- https://github.com/rust-lang/rust/pull/56362 + `macro_literal_matcher` isn't stable on current stable (1.31) but is on beta (1.32). r? @varkor
2018-12-21exhaustive_integer_patterns slipped 1.32; stabilized in 1.33.Mazdak Farrokhzad-2/+2
2018-12-21macro_literal_matcher was stabilized in 1.32; not 1.32.Mazdak Farrokhzad-1/+1
2018-12-21Stabilize #[repr(packed(N))]Taylor Cramer-10/+2
2018-12-20Auto merge of #56647 - petrochenkov:dcrate2, r=alexcrichtonbors-30/+31
Rework treatment of `$crate` in procedural macros Important clarification: `$crate` below means "processed `$crate`" or "output `$crate`". In the input of a decl macro `$crate` is just two separate tokens, but in the *output of a decl macro* `$crate` is a single keyword identifier (https://github.com/rust-lang/rust/issues/55640#issuecomment-435692791). First of all, this PR removes the `eliminate_crate_var` hack. `$crate::foo` is no longer replaced with `::foo` or `::crate_name::foo` in the input of derive proc macros, it's passed to the macro instead with its precise span and hygiene data, and can be treated as any other path segment keyword (like `crate` or `self`) after that. (Note: `eliminate_crate_var` was never used for non-derive proc macros.) This creates an annoying problem - derive macros still may stringify their input before processing and expect `$crate` survive that stringification and refer to the same crate (the Rust 1.15-1.29 way of doing things). Moreover, the input of proc macro attributes and derives (but not fn-like proc macros) also effectively survives stringification before being passed to the macro (also for legacy implementation reasons). So we kind of resurrect the `eliminate_crate_var` hack in reduced form, but apply it only to AST pretty-printing. If an AST fragment is pretty-printed, the resulting *text* will have `$crate` replaced with `crate` or `::crate_name`. This should be enough to keep all the legacy cases working. Closes https://github.com/rust-lang/rust/issues/55640 Closes https://github.com/rust-lang/rust/issues/56622 r? @ghost
2018-12-20Remove `TokenStream::JointTree`.Nicholas Nethercote-54/+44
This is done by adding a new `IsJoint` field to `TokenStream::Tree`, which simplifies a lot of `match` statements. And likewise for `CursorKind`. The commit also adds a new method `TokenTree:stream()` which can replace a choice between `.into()` and `.joint()`.
2018-12-19Do not interpret mismatches from pretty-printed `$crate` as token stream ↵Vadim Petrochenkov-2/+6
invalidation
2018-12-19Reintroduce special pretty-printing for `$crate` when it's necessary for ↵Vadim Petrochenkov-2/+25
proc macros
2018-12-19Remove `eliminate_crate_var` and special pretty-printing for `$crate`Vadim Petrochenkov-29/+3
2018-12-19Auto merge of #56613 - Zoxc:query-perf1, r=michaelwoeristerbors-0/+1
Tweak query code for performance Split from https://github.com/rust-lang/rust/pull/56509 r? @michaelwoerister
2018-12-19Rollup merge of #56910 - estebank:unclosed-eof, r=oli-obkPietro Albini-1/+9
Do not point at delim spans for complete correct blocks Fix #56834.
2018-12-19Rollup merge of #56908 - alexcrichton:new-features, r=oli-obkPietro Albini-0/+2
rustc: Don't ICE on usage of two new target features I seem to always forget to update this portion of the compiler...
2018-12-19Rollup merge of #56820 - ljedrz:format_tweaks, r=alexcrichtonPietro Albini-0/+3
format-related tweaks - remove an unreachable condition - inline one-liners related to `parse_expr` (called in succession) - refactor `report_invalid_references` - refactor `verify_arg_type` - minor stylistic improvements
2018-12-17Stabilize `underscore_imports`Vadim Petrochenkov-21/+2
2018-12-17Do not point at delim spans for complete correct blocksEsteban Küber-1/+9
2018-12-17rustc: Don't ICE on usage of two new target featuresAlex Crichton-0/+2
I seem to always forget to update this portion of the compiler...
2018-12-17Tweak query code for performanceJohn Kåre Alsaker-0/+1
2018-12-17Auto merge of #56737 - nnethercote:TokenStream-improvements, r=petrochenkovbors-284/+107
`TokenStream` improvements Some `TokenStream` improvements: shrinking `TokenStream` and some other types, and some other code clean-ups.
2018-12-15Rollup merge of #56679 - euclio:external-doc-parse, r=estebankPietro Albini-12/+56
overhaul external doc attribute diagnostics This PR improves the error handling and spans for the external doc attribute. Many cases that silently failed before now emit errors, spans are tightened, and the errors have help and suggestions. I tried to address all the cases that users ran into in the tracking issue. cc #44732 r? @QuietMisdreavus
2018-12-15Auto merge of #56584 - davidtwco:issue-53990, r=nikomatsakisbors-4/+15
2018 edition - confusing error message when declaring unnamed parameters Fixes #53990. This PR adds a note providing context for the change to argument names being required in the 2018 edition for trait methods and a suggestion for the fix.
2018-12-14Rollup merge of #56699 - nnethercote:SymbolIndex, r=oli-obkkennytm-0/+4
Use a `newtype_index!` within `Symbol`. This shrinks `Option<Symbol>` from 8 bytes to 4 bytes, which shrinks `Token` from 24 bytes to 16 bytes. This reduces instruction counts by up to 1% across a range of benchmarks. r? @oli-obk
2018-12-14Rollup merge of #56658 - Xanewok:non-panicking-file-parser, r=petrochenkovkennytm-8/+29
Add non-panicking `maybe_new_parser_from_file` variant Add (seemingly?) missing `maybe_new_parser_from_file` constructor variant. Disclaimer: I'm not certain this is the correct approach - just found out we don't have this when working on a Rustfmt PR to catch/prevent more Rust parser panics: https://github.com/rust-lang/rustfmt/pull/3240 and tried to make it work somehow.
2018-12-14format: inline one-liners related to parse_exprljedrz-0/+3
2018-12-12Bump to 1.33.0Alex Crichton-4/+5
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-12-12Rename `TokenStream::concat` and remove `TokenStream::concat_rc_vec`.Nicholas Nethercote-34/+30
`TokenStream::new` is a better name for the former, and the latter is now just equivalent to `TokenStream::Stream`.
2018-12-12Merge `TokenStreamKind` into `TokenStream`.Nicholas Nethercote-72/+65
Because the distinction provides little value, and removing it cleans up the code quite a bit.
2018-12-12Remove `RcVec` and `RcSlice`.Nicholas Nethercote-160/+0
They're both unused now.
2018-12-12Use `TokenStream::concat` more.Nicholas Nethercote-17/+11
It's a better choice in a few places.
2018-12-12Use `Lrc<Vec<TokenStream>>` instead of `RcVec<TokenStream>`.Nicholas Nethercote-17/+17
This shrinks: - ThinTokenStream: 16 to 8 bytes - TokenTree: 32 to 24 bytes - TokenStream: 40 to 32 bytes The only downside is that in a couple of places this requires using `to_vec()` (which allocates) instead of `sub_slice()`. But those places are rarely executed, so it doesn't hurt perf. Overall, this reduces instruction counts on numerous benchmarks by up to 3%.
2018-12-12XXX: SymbolIndexNicholas Nethercote-0/+4