Yuki Okushi
ca806cfe45
Rollup merge of #68135 - calebcartwright:rustc-parse-visibilities, r=Centril
...
restore some rustc_parse visibilities for rustfmt
In https://github.com/rust-lang/rust/pull/65495/commits/c189565edc5c9fc516170885b3a3061b936205fb some visibilities were reduced on the parse mod (which now resides in the rustc_parse crate) as part of some refactoring and splitting up of libsyntax. However, rustfmt needs access to a few of those items that are no longer visible.
This restores the visibility on those items rustfmt depends on.
https://github.com/rust-lang/rustfmt/issues/3903#issuecomment-563596269
https://github.com/rust-lang/rustfmt/issues/4009
cc @topecongiro
2020-01-13 16:44:18 +09:00
Mazdak Farrokhzad
82c19b4388
Rollup merge of #68108 - varkor:chained-comparison-suggestions, r=Centril
...
Add suggestions when encountering chained comparisons
Ideally, we'd also prevent the type error, which is just extra noise, but that will require moving the error from the parser, and I think the suggestion makes things clear enough for now.
Fixes https://github.com/rust-lang/rust/issues/65659 .
2020-01-12 03:28:02 +01:00
Caleb Cartwright
ed039e8f84
restore some rustc_parse visibilities
2020-01-11 13:19:57 -06:00
Mazdak Farrokhzad
4eee796679
Rollup merge of #68120 - Centril:ban-range-to-dotdotdot, r=oli-obk
...
Ban `...X` pats, harden tests, and improve diagnostics
Follow up to https://github.com/rust-lang/rust/pull/67258#issuecomment-565656155 and https://github.com/rust-lang/rust/pull/67258#discussion_r357879932 .
r? @cramertj @oli-obk
2020-01-11 12:36:15 +01:00
Mazdak Farrokhzad
883932c6ba
Ban ...X pats, harden tests, and improve diagnostics.
...
Also fix a bug with the span passed in `mk_range`.
2020-01-11 08:58:58 +01:00
Mazdak Farrokhzad
cacda2d7a0
Rollup merge of #68084 - estebank:ice-68000, r=varkor
...
Do not ICE on unicode next point
Use `shrink_to_hi` instead of `next_point` and fix `next_point`.
Fix #68000 , fix #68091 , fix #68092 .
2020-01-11 04:02:28 +01:00
Mazdak Farrokhzad
f361b71a7d
nix syntax::early_buffered_lints
2020-01-11 03:26:16 +01:00
Mazdak Farrokhzad
1af8c10bd4
simplify feature_err imports
2020-01-11 03:19:50 +01:00
Mazdak Farrokhzad
7c78090690
get_features -> rustc_parse::config
2020-01-11 03:17:36 +01:00
varkor
088a1808d2
Add suggestions when encountering chained comparisons
2020-01-11 01:56:25 +00:00
Yuki Okushi
7ae0618e0a
Rollup merge of #68050 - Centril:canon-error, r=Mark-Simulacrum
...
Canonicalize rustc_error imports
r? @Mark-Simulacrum
2020-01-11 04:50:53 +09:00
Esteban Küber
b93ef68245
Change next_point when shrink_to_hi is more appropriate
2020-01-10 11:23:59 -08:00
Mazdak Farrokhzad
8bd3d240e3
nix syntax::errors & prefer rustc_errors over errors
2020-01-10 07:41:30 +01:00
Mazdak Farrokhzad
d5598aa7a0
Introduce #![feature(half_open_range_patterns)].
...
This feature adds `X..`, `..X`, and `..=X` patterns.
2020-01-10 07:29:04 +01:00
Esteban Küber
fcd850fc5d
Do not ICE on unicode next point
...
Use `shrink_to_hi` instead of `next_point`
Fix #68000 .
2020-01-09 22:10:18 -08:00
Mazdak Farrokhzad
6f3f1c537b
Rollup merge of #68073 - Centril:fix-68062, r=estebank
...
expect `fn` after `const unsafe` / `const extern`
Fixes #68062
r? @estebank @petrochenkov
cc @Aaron1011
2020-01-10 02:47:36 +01:00
Mazdak Farrokhzad
2307f0c4ea
Rollup merge of #68071 - estebank:ice-67995, r=Centril
...
Extend support of `_` in type parameters
- Account for `impl Trait<_>`.
- Provide a reasonable `Span` for empty `Generics` in `impl`s.
- Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`.
- Fix #67995 . Follow up to #67597 .
2020-01-10 02:47:34 +01:00
Dylan MacKenzie
31edbe9aca
Reject const in inherent impls
2020-01-09 16:47:05 -08:00
Dylan MacKenzie
0cf52a7dd8
Parse ?const Trait bound syntax
...
The grammar also handles `?const ?Trait` even though this is
semantically redundant.
2020-01-09 16:46:15 -08:00
Dylan MacKenzie
1c3fe9de4e
Parse impl const Trait for Ty syntax
2020-01-09 16:46:14 -08:00
Esteban Küber
c751961d29
Extend support of _ in type parameters
...
- Account for `impl Trait<_>`.
- Provide a reasonable `Span` for empty `Generics` in `impl`s.
- Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`.
- Fix #67995 .
2020-01-09 14:20:53 -08:00
Mazdak Farrokhzad
915db7ae64
expect fn after const unsafe / const extern
2020-01-09 23:02:34 +01:00
Mazdak Farrokhzad
2c3e5d3de0
- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
...
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
2020-01-08 04:25:33 +01:00
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