Commit Graph

3635 Commits

Author SHA1 Message Date
Aleksey Kladov fdb8752850 cleanup shebang handling in the lexer 2019-04-04 13:31:53 +03:00
Mazdak Farrokhzad d2fd3fe957 Rollup merge of #59041 - saleemjaffer:trait_doc_comment_better_error_msg, r=pnkfelix
fixes rust-lang#56766

fixes #56766
2019-04-01 17:29:53 +02:00
Mazdak Farrokhzad c28704c2a8 Rollup merge of #59453 - estebank:recover-tuple-parse, r=petrochenkov
Recover from parse error in tuple syntax
2019-03-30 07:51:36 +01:00
Esteban Küber 9ea6790a64 Deduplicate parse recovery code 2019-03-28 19:58:45 -07:00
Mazdak Farrokhzad 73f9832ee4 Rollup merge of #59476 - nnethercote:TokenStreamBuilder-SmallVec, r=petrochenkov
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-29 02:40:54 +01:00
Nicholas Nethercote 17a8aff20a 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%.

It also reduces instruction counts by up to 1.4% across a range of
rustc-perf benchmark runs.
2019-03-29 09:32:58 +11:00
Esteban Küber e3918cf621 Recover from parse error in tuple syntax 2019-03-28 04:47:37 -07:00
Mazdak Farrokhzad dcd531ea15 Rollup merge of #59198 - estebank:recovered-pattern, r=zackmdavis
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-28 08:43:32 +01:00
Josh Stone be34621ffc Rollup merge of #59421 - estebank:tuple-index-suffix, r=petrochenkov
Reject integer suffix when tuple indexing

Fix #59418.

r? @varkor
2019-03-27 18:15:35 -07:00
Josh Stone c818c1a1d6 Rollup merge of #57565 - petrochenkov:turbowarn, r=Centril
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-27 18:15:19 -07:00
Esteban Küber 8d1cc72cf9 Add specific message for tuple struct invoked with suffixed numeric field name 2019-03-26 12:32:32 -07:00
Esteban Küber 1bb3694b1a Reword invalid suffixe errors 2019-03-26 12:09:13 -07:00
Esteban Küber c7ddb83980 Use expect_no_suffix for error 2019-03-26 10:18:18 -07:00
Mazdak Farrokhzad b316514dbd Rollup merge of #59150 - estebank:type-ascription, r=varkor
Expand suggestions for type ascription parse errors

Fix #51222. CC #48016, #47666, #54516, #34255.
2019-03-26 09:05:39 +01:00
Esteban Küber 6ad77b0938 review comments 2019-03-25 21:38:23 -07:00
Esteban Küber 91b7423760 Reject integer suffix when tuple indexing 2019-03-25 16:11:21 -07:00
David Wood 5c3d1e5d76 Separate variant id and variant constructor id.
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-24 12:10:16 +03:00
Esteban Küber 9bfb0ef818 Tweak unsupported negative trait bounds message 2019-03-23 13:05:30 -07:00
Vadim Petrochenkov 4b382946e4 syntax: Remove warning for unnecessary path disambiguators 2019-03-23 17:20:11 +03:00
bors d51a437e28 Auto merge of #59058 - petrochenkov:assocrecov3, r=estebank
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-23 05:51:16 +00:00
Esteban Küber d72ef21ddd Reword type ascription note to reduce verbosity 2019-03-22 20:14:20 -07:00
Esteban Küber 44a086ef39 Review comment 2019-03-22 19:50:18 -07:00
Esteban Küber 8ba1a97e37 Expand suggestions for type ascription parse errors 2019-03-22 19:50:18 -07:00
Mazdak Farrokhzad 9d33d6fa4b Rollup merge of #59322 - estebank:diag-tweak, r=davidtwco
Tweak incorrect escaped char diagnostic
2019-03-22 19:31:34 +01:00
Mazdak Farrokhzad 5a0e4510a8 Rollup merge of #59266 - estebank:struct-parse-recovery, r=petrochenkov
Do not complain about non-existing fields after parse recovery

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.

Fix #57361.
2019-03-22 19:31:24 +01:00
bors a85ec7c2c0 Auto merge of #59031 - estebank:recover-from-comaless, r=petrochenkov
Recover from missing comma between enum variants and from bad `pub` kw

Fix #56579. Fix #56473.
2019-03-22 04:52:10 +00:00
Esteban Küber a8120d660a Tweak incorrect escaped char diagnostic 2019-03-20 11:45:25 -07:00
Esteban Küber 757eb67992 review comments 2019-03-19 13:17:25 -07:00
bors cd45b19bd2 Auto merge of #58872 - rep-nop:diagnostic-fix-56031, r=petrochenkov
Adds help message in error for invalid `impl for T` syntax

Fixes #56031.
2019-03-18 08:03:05 +00:00
Esteban Küber 6007e6f649 Do not complain about non-existing fields after parse recovery
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-17 20:09:53 -07:00
Esteban Küber 0a09e76c96 Simplify check 2019-03-16 17:47:57 -07:00
Esteban Küber 1aa43af370 parse full visibility when recovering 2019-03-16 17:47:57 -07:00
Esteban Küber b2b9555f95 Recover from incorrect pub kw in "reasonable" places 2019-03-16 17:47:57 -07:00
Esteban Küber 532dd4475b Recover from missing comma between enum variants 2019-03-16 17:47:00 -07:00
Vadim Petrochenkov 2fd4cbb3f2 Fix rebase 2019-03-16 23:14:42 +03:00
Vadim Petrochenkov 0cf96131f4 Refactor away NestedMetaItemKind
Remove methods `Attribute::span` and `MetaItem::span` duplicating public fields
2019-03-16 23:14:42 +03:00
Vadim Petrochenkov 63116d313d Rename MetaItem::ident to MetaItem::path 2019-03-16 23:13:15 +03:00
Vadim Petrochenkov 6ad55b3dec syntax: Introduce Ident::can_be_raw 2019-03-16 23:13:15 +03:00
Esteban Küber 6cd6759cfc 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.
2019-03-14 18:28:24 -07:00
Andy Russell 5abd6d9492 add suggestions to invalid macro item error 2019-03-13 15:24:36 -04:00
Mazdak Farrokhzad ad7b650815 Rollup merge of #58876 - estebank:numeric-lifetime, r=petrochenkov
Parse lifetimes that start with a number and give specific error

Fix #58786.
2019-03-13 03:33:36 +01:00
Vadim Petrochenkov 1ab8ca3532 Address review comments 2019-03-12 10:37:15 +03:00
Vadim Petrochenkov 79c3651988 syntax: Optimize maybe_whole/maybe_whole_expr slightly 2019-03-12 10:25:03 +03:00
Vadim Petrochenkov 18229bb1ad syntax: Better recovery for $ty::AssocItem and ty!()::AssocItem 2019-03-12 10:25:03 +03:00
Esteban Küber f690821d58 review comments 2019-03-09 11:08:51 -08:00
topecongiro 2309625941 Expose new_sub_parser_from_file
This function is useful when external tools like rustfmt want to parse
internal files without parsing a whole crate.
2019-03-09 21:59:54 +09:00
Saleem Jaffer fcfc796389 fixes rust-lang#56766 2019-03-09 13:30:42 +05:30
bors c9f8304351 Auto merge of #59012 - pietroalbini:rollup, r=pietroalbini
Rollup of 24 pull requests

Successful merges:

 - #58080 (Add FreeBSD armv6 and armv7 targets)
 - #58204 (On return type `impl Trait` for block with no expr point at last semi)
 - #58269 (Add librustc and libsyntax to rust-src distribution.)
 - #58369 (Make the Entry API of HashMap<K, V> Sync and Send)
 - #58861 (Expand where negative supertrait specific error is shown)
 - #58877 (Suggest removal of `&` when borrowing macro and appropriate)
 - #58883 (Suggest appropriate code for unused field when destructuring pattern)
 - #58891 (Remove stray ` in the docs for the FromIterator implementation for Option)
 - #58893 (race condition in thread local storage example)
 - #58906 (Monomorphize generator field types for debuginfo)
 - #58911 (Regression test for #58435.)
 - #58912 (Regression test for #58813)
 - #58916 (Fix release note problems noticed after merging.)
 - #58918 (Regression test added for an async ICE.)
 - #58921 (Add an explicit test for issue #50582)
 - #58926 (Make the lifetime parameters of tcx consistent.)
 - #58931 (Elide invalid method receiver error when it contains TyErr)
 - #58940 (Remove JSBackend from config.toml)
 - #58950 (Add self to mailmap)
 - #58961 (On incorrect cfg literal/identifier, point at the right span)
 - #58963 (libstd: implement Error::source for io::Error)
 - #58970 (delay_span_bug in wfcheck's ty.lift_to_tcx unwrap)
 - #58984 (Teach `-Z treat-err-as-bug` to take a number of errors to emit)
 - #59007 (Add a test for invalid const arguments)

Failed merges:

 - #58959 (Add release notes for PR #56243)

r? @ghost
2019-03-09 05:19:48 +00:00
Esteban Küber 0a505a71d3 Parse lifetimes that start with a number and give specific error 2019-03-08 16:56:31 -08:00
Pietro Albini 72d4c1ed67 Rollup merge of #58984 - estebank:multi-treat-err-as-bug, r=oli-obk
Teach `-Z treat-err-as-bug` to take a number of errors to emit

`-Z treat-err-as-bug` will cause `rustc` to panic after the first error is reported, like previously. `-Z treat-err-as-bug=2` will cause `rustc` to panic after 2 errors have been reported.

Fix #58983.
2019-03-08 09:42:13 +01:00