about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-04-05Rollup merge of #59687 - matklad:shebang, r=petrochenkovMazdak Farrokhzad-11/+5
cleanup shebang handling in the lexer
2019-04-05Increase `Span` from 4 bytes to 8 bytes.Nicholas Nethercote-1/+1
This increases the size of some important types, such as `ast::Expr` and `mir::Statement`. However, it drastically reduces how much the interner is used, and the fields are more natural sizes that don't require bit operations to extract. As a result, instruction counts drop across a range of workloads, by as much as 12% for incremental "check" builds of `script-servo`. Peak memory usage goes up a little for some cases, but down by more for some other cases -- as much as 18% for non-incremental builds of `packed-simd`. The commit also: - removes the `repr(packed)`, because it has negligible effect, but can cause undefined behaviour; - replaces explicit impls of common traits (`Copy`, `PartialEq`, etc.) with derived ones.
2019-04-04Simplify doc comment lexingAleksey Kladov-17/+5
is_doc_comment function checks the first four chars, but this is redundant, `doc_comment` local var has the same info.
2019-04-04Rollup merge of #59671 - matklad:lexer, r=eddybMazdak Farrokhzad-8/+8
Make some of lexer's API private Lexer is a `pub` type, so it feels wrong that its fields are just pub (I guess it wasn't exported initially), so let's minimize visibility. Context: I am looking into extracting rust-lexer into a library, which can be shared by rust-analyzer and rustc. I hope that a simple interface like `fn next_token(src: &str) -> (TokenKind, usize)` would work, but to try this out I need to understand what is the current API of the lexer.
2019-04-04cleanup shebang handling in the lexerAleksey Kladov-11/+5
2019-04-03Deny internal lints on non conflicting cratesflip1995-0/+1
- libarena - librustc_allocator - librustc_borrowck - librustc_codegen_ssa - librustc_codegen_utils - librustc_driver - librustc_errors - librustc_incremental - librustc_metadata - librustc_passes - librustc_privacy - librustc_resolve - librustc_save_analysis - librustc_target - librustc_traits - libsyntax - libsyntax_ext - libsyntax_pos
2019-04-03make StringReader methods privateAleksey Kladov-2/+2
2019-04-03make StringReader fields privateAleksey Kladov-6/+6
2019-04-02Rename `colorful-json` to `json-rendered` and make it a selection instead of ↵Oliver Scherer-9/+9
a bool
2019-04-02Update more unit test to new APIOliver Scherer-0/+2
2019-04-02Emit ansi color codes in the `rendered` field of json diagnosticsOliver Scherer-10/+19
2019-04-01Rollup merge of #59041 - saleemjaffer:trait_doc_comment_better_error_msg, ↵Mazdak Farrokhzad-0/+16
r=pnkfelix fixes rust-lang#56766 fixes #56766
2019-03-31Auto merge of #59507 - nnethercote:indent-with-SPACES, r=petrochenkovbors-3/+19
Optimize indentation in the pretty printer. Currently the pretty-printer calls `write!` for every space of indentation. On some workloads the indentation level can exceed 100, and a faster implementation reduces instruction counts by up to 7% on a few workloads.
2019-04-01Optimize indentation in the pretty printer.Nicholas Nethercote-3/+19
Currently the pretty-printer calls `write!` for every space of indentation. On some workloads the indentation level can exceed 100, and a faster implementation reduces instruction counts by up to 7% on a few workloads.
2019-03-31Convert symbols to strings for pretty printingJohn Kåre Alsaker-14/+11
2019-03-31Fix lifetime on LocalInternedString::get functionJohn Kåre Alsaker-7/+12
2019-03-30Rollup merge of #59525 - pnkfelix:whitelist-some-rustc-attrs, r=petrochenkovMazdak Farrokhzad-1/+15
Whitelist some rustc attrs These rustc attrs are used within libcore, and were causing failures when one mixed incremental compilation with bootstrapping (due to a default of `-D warnings` when bootstrapping). Fix #59523 Fix #59524 Cc #58633
2019-03-30Rollup merge of #59453 - estebank:recover-tuple-parse, r=petrochenkovMazdak Farrokhzad-26/+57
Recover from parse error in tuple syntax
2019-03-29Whitelist rustc_layout_scalar_valid_range_{start,end} so incr comp does not ↵Felix S. Klock II-0/+14
flag them as unused.
2019-03-29Whitelist `rustc_on_unimplemented` to avoid erroneous flagging as an unused ↵Felix S. Klock II-1/+1
attribute.
2019-03-29Rollup merge of #59510 - varkor:rename-type_parameters, r=eddybMazdak Farrokhzad-9/+9
Rename `type_parameters` to `generics` and so on Some old variable names had fallen through the generics generalisation pull requests.
2019-03-29Rollup merge of #59473 - estebank:borrow-sugg-inside-macro, r=davidtwcoMazdak Farrokhzad-0/+60
Do not emit incorrect borrow suggestion involving macros and fix overlapping multiline spans Fix #58298.
2019-03-28Deduplicate parse recovery codeEsteban Küber-35/+43
2019-03-29Rollup merge of #59476 - nnethercote:TokenStreamBuilder-SmallVec, r=petrochenkovMazdak Farrokhzad-7/+10
Use `SmallVec` in `TokenStreamBuilder`. This reduces by 12% the number of allocations done for a "clean incremental" of `webrender_api`, which reduces the instruction count by about 0.5%. r? @petrochenkov
2019-03-29Rollup merge of #59423 - varkor:walk_mac-visit_path, r=petrochenkovMazdak Farrokhzad-2/+2
Visit path in `walk_mac` Fixes https://github.com/rust-lang/rust/issues/54110.
2019-03-29Rename `type_parameters` to `generics` and so onvarkor-9/+9
2019-03-29Use `SmallVec` in `TokenStreamBuilder`.Nicholas Nethercote-7/+10
This reduces by 12% the number of allocations done for a "clean incremental" of `webrender_api`, which reduces the instruction count by about 0.5%. It also reduces instruction counts by up to 1.4% across a range of rustc-perf benchmark runs.
2019-03-28Recover from parse error in tuple syntaxEsteban Küber-8/+31
2019-03-28Rollup merge of #59198 - estebank:recovered-pattern, r=zackmdavisMazdak Farrokhzad-1/+1
Do not complain about unmentioned fields in recovered patterns When the parser has to recover from malformed code in a pattern, do not complain about missing fields. Fix #59145.
2019-03-27Account for fully overlapping multiline annotationsEsteban Küber-0/+60
When two multiline span labels point at the same span, we special case the output to avoid weird behavior: ``` foo( _____^ |_____| || bar, || ); || ^ ||______| |______foo baz ``` instead showing ``` foo( _____^ | bar, | ); | ^ | | |______foo baz ```
2019-03-27Rollup merge of #59421 - estebank:tuple-index-suffix, r=petrochenkovJosh Stone-50/+52
Reject integer suffix when tuple indexing Fix #59418. r? @varkor
2019-03-27Rollup merge of #57565 - petrochenkov:turbowarn, r=CentrilJosh Stone-22/+11
syntax: Remove warning for unnecessary path disambiguators `rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in https://github.com/rust-lang/rust/pull/43540 (where it was introduced). One hardcoded warning less. Closes https://github.com/rust-lang/rust/issues/58055 r? @nikomatsakis
2019-03-27Visit path in `walk_mac`varkor-2/+2
2019-03-26Add specific message for tuple struct invoked with suffixed numeric field nameEsteban Küber-1/+2
2019-03-26Reword invalid suffixe errorsEsteban Küber-7/+6
2019-03-26Use `expect_no_suffix` for errorEsteban Küber-8/+1
2019-03-26Rollup merge of #59150 - estebank:type-ascription, r=varkorMazdak Farrokhzad-15/+68
Expand suggestions for type ascription parse errors Fix #51222. CC #48016, #47666, #54516, #34255.
2019-03-25review commentsEsteban Küber-1/+1
2019-03-25Reject integer suffix when tuple indexingEsteban Küber-43/+52
2019-03-25Auto merge of #59256 - petrochenkov:derval2, r=Zoxcbors-38/+38
Make meta-item API compatible with `LocalInternedString::get` soundness fix r? @Zoxc
2019-03-24Remove methods is_struct/is_tuple/is_unit from VariantDataVadim Petrochenkov-62/+38
2019-03-24Separate variant id and variant constructor id.David Wood-25/+33
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-23Tweak unsupported negative trait bounds messageEsteban Küber-7/+14
2019-03-23syntax: Remove warning for unnecessary path disambiguatorsVadim Petrochenkov-22/+11
2019-03-23Auto merge of #59058 - petrochenkov:assocrecov3, r=estebankbors-88/+82
syntax: Better recovery for `$ty::AssocItem` and `ty!()::AssocItem` This PR improves on https://github.com/rust-lang/rust/pull/46788 covering a few missing cases. Fixes https://github.com/rust-lang/rust/issues/52307 Fixes https://github.com/rust-lang/rust/issues/53776 r? @estebank
2019-03-22Reword type ascription note to reduce verbosityEsteban Küber-5/+1
2019-03-22Review commentEsteban Küber-2/+2
2019-03-22Hide "type ascription is experimental error" unless it's the only oneEsteban Küber-2/+6
In order to minimize the verbosity of common syntax errors that are parsed as type ascription, hide the feature gate error unless there are no other errors being emitted by the parser.
2019-03-22Expand suggestions for type ascription parse errorsEsteban Küber-13/+66
2019-03-22Rollup merge of #59322 - estebank:diag-tweak, r=davidtwcoMazdak Farrokhzad-23/+28
Tweak incorrect escaped char diagnostic