Commit Graph

207 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 689e29f0f5 Rollup merge of #67835 - euclio:delimiter-wording, r=Centril
tweak wording of mismatched delimiter errors

This PR improves the wording of the "incorrect delimiter" error messages. Here's a quick rationale:

- *"un-closed" -> "unclosed"*: "unclosed" is valid English, so there's no need to hyphenate the prefix. This should be pretty uncontroversial, I think.
- *"close delimiter" -> "closing delimiter"*: In my anecdotal experience, I've always heard "closing delimiter" or "closing parenthesis". In addition, the codebase already uses this terminology in comments and function names more than "close delimiter", which could indicate that it's more intuitive.
- "incorrect delimiter" -> "mismatched delimiter": "Incorrect delimiter" is vague; why is it incorrect? "mismatched" clearly indicates why the delimiter is causing the error.

r? @estebank
2020-01-04 02:19:54 +01:00
Mazdak Farrokhzad 814e3af8bd Rollup merge of #67786 - Centril:canon-span, r=petrochenkov
Nix reexports from `rustc_span` in `syntax`

Remove reexports `syntax::{source_map, symbol, edition}` and use `rustc_span` paths directly.

r? @petrochenkov
2020-01-04 02:19:49 +01:00
Andy Russell 7fd014d569 tweak wording of mismatched delimiter errors 2020-01-03 08:40:15 -05:00
Yuki Okushi b0649c0c5f Rollup merge of #67807 - lzutao:toilet-closure, r=Centril
Use drop instead of the toilet closure `|_| ()`
2020-01-03 17:56:30 +09:00
Mazdak Farrokhzad b1aad76586 Normalize syntax::edition imports. 2020-01-02 19:31:38 +01:00
Mazdak Farrokhzad 75e4783f63 Normalize syntax::source_map imports. 2020-01-02 13:57:04 +01:00
Lzu Tao dd8f072233 Use drop instead of the toilet closure |_| () 2020-01-02 08:56:12 +00:00
Vadim Petrochenkov 70f1d57048 Rename syntax_pos to rustc_span in source code 2020-01-01 09:15:18 +03:00
Mazdak Farrokhzad 3cca3c6ace Rollup merge of #67744 - Centril:reduce-diversity, r=petrochenkov
parser: reduce diversity in error handling mechanisms

Instead of having e.g. `span_err`, `fatal`, etc., we prefer to move towards uniformly using `struct_span_err` thus making it harder to emit fatal and/or unstructured diagnostics.

This PR also de-fatalizes some diagnostics.

r? @estebank
2019-12-31 19:19:38 +01:00
Mazdak Farrokhzad 2e7806146c parser: bug -> span_bug 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad 4ae9c1c3ec parser::diagnostics: remove fn fatal 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad 2e812c1c5f parser::pat: remove .fatal calls 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad 6fba125912 parser::path: remove .fatal calls 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad 51fb599849 parser::module: remove .fatal calls 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad 13ca924988 parser::item: remove .fatal calls 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad 46ec6becf2 parser::attr: remove .fatal calls 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad 85dbbaa492 process_potential_macro_variable: de-fatalize an error 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad 5a64ba6386 parser: span_fatal -> struct_span_err 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad b6fc87c5b9 de-fatalize some errors 2019-12-31 04:33:34 +01:00
Mazdak Farrokhzad 2091062bf6 parser: call .struct_span_err directly 2019-12-31 04:33:34 +01:00
Charles Lew 8f84d9e1de Inline and remove nfc_symbol_from method. 2019-12-31 09:37:45 +08:00
Charles Lew 7f9cc88f4a Add symbol normalization for proc_macro_server. 2019-12-31 09:37:45 +08:00
Vadim Petrochenkov a2823e3af6 Rename libsyntax_ext and libsyntax_expand in code 2019-12-30 19:18:17 +03:00
Vadim Petrochenkov b9a9c5b4fd Make things build again 2019-12-30 19:18:16 +03:00
bors da3629b05f Auto merge of #67112 - Centril:expr-polish, r=estebank
Refactor expression parsing thoroughly

Based on https://github.com/rust-lang/rust/pull/66994 together with which this has refactored basically the entirety of `expr.rs`.

r? @estebank
2019-12-29 19:30:53 +00:00
Vadim Petrochenkov 3d57b8bcc0 doc comments: Less attribute mimicking 2019-12-28 12:33:18 +03:00
Charles Lew 0bcddfe23a Normalize identifiers in librustc_parse. 2019-12-26 13:12:58 +08:00
bors a4cd03dee2 Auto merge of #66296 - Centril:bindings_after_at-init, r=pnkfelix
Initial implementation of `#![feature(bindings_after_at)]`

Following up on #16053, under the gate `#![feature(bindings_after_at)]`, `x @ Some(y)` is allowed subject to restrictions necessary for soundness.

The implementation and test suite should be fairly complete now.

One aspect that is not covered is the interaction with nested `#![feature(or_patterns)]`.
This is not possible to test at the moment in a good way because that feature has not progressed sufficiently and has fatal errors in MIR building. We should make sure to add such tests before we stabilize both features (but shipping one of them is fine).

r? @pnkfelix
cc @nikomatsakis @matthewjasper @pcwalton
cc https://github.com/rust-lang/rust/issues/65490
2019-12-23 21:49:44 +00:00
Mazdak Farrokhzad 5f92a56ed6 Introduce #![feature(bindings_after_at)].
Under the gate, `x @ Some(y)` is allowed.
This is subject to various restrictions for soundness.
2019-12-23 14:47:19 +01:00
Mazdak Farrokhzad 7a246acf0a fix rebase fallout 2019-12-23 14:08:50 +01:00
Mazdak Farrokhzad 05c26a445b refactor assoc op parsing 2019-12-23 13:55:45 +01:00
Mazdak Farrokhzad e43a7ef1d4 simplify parse_prefix_range_expr 2019-12-23 13:55:10 +01:00
Mazdak Farrokhzad 8456c403e1 extract parse_not_expr 2019-12-23 13:55:04 +01:00
Mazdak Farrokhzad efdea63c43 extract parse_prefix_expr 2019-12-23 13:51:21 +01:00
Mazdak Farrokhzad 4cfcfe9e20 extract parse_neg_expr 2019-12-23 13:51:02 +01:00
Mazdak Farrokhzad f6ab439436 extract parse_deref_expr 2019-12-23 13:50:56 +01:00
Mazdak Farrokhzad ada388b2b8 extract is_mistaken_not_ident_negation 2019-12-23 13:50:50 +01:00
Mazdak Farrokhzad 80eeefb05f extract recover_not_expr 2019-12-23 13:49:14 +01:00
Mazdak Farrokhzad 00cc8a1b0c simplify parse_assoc_op_cast 2019-12-23 13:48:47 +01:00
Mazdak Farrokhzad 84f9bf1a06 refactor parse_address_of -> parse_borrow_expr 2019-12-23 13:48:45 +01:00
Mazdak Farrokhzad af5ac23a23 simplify parse_dot_call_or_expr 2019-12-23 13:47:52 +01:00
Mazdak Farrokhzad 7ae12c9385 extract parse_dot_base_expr 2019-12-23 13:47:44 +01:00
Mazdak Farrokhzad bc95228f1b extract parse_dot_suffix_expr 2019-12-23 13:45:45 +01:00
Mazdak Farrokhzad 9c6bbf1252 extract error_unexpected_after_dot and de-fatalize 2019-12-23 13:45:13 +01:00
Mazdak Farrokhzad ff5762b78a extract recover_field_access_by_float_lit 2019-12-23 13:44:38 +01:00
Mazdak Farrokhzad a15d0cde57 extract parse_tuple_field_access_expr 2019-12-23 13:44:12 +01:00
Mazdak Farrokhzad 287ba5d0c8 extract parse_fn_call_expr 2019-12-23 13:44:06 +01:00
Mazdak Farrokhzad 98701b2c61 extract parse_index_expr & refactor parse_dot_suffix 2019-12-23 13:44:02 +01:00
Mazdak Farrokhzad 0bb3dad5a6 extract error_float_lits-must_have_int_part 2019-12-23 13:43:35 +01:00
Mazdak Farrokhzad aa8adba8fb simplify parse_literal_maybe_minus 2019-12-23 13:43:28 +01:00