Commit Graph

98348 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
5f6bec8ecf parser: drive-by: simplify parse_arg_general. 2019-08-24 21:53:55 +02:00
Mazdak Farrokhzad
95792b4d5a parser: let stmts & for exprs: allow or-patterns. 2019-08-24 21:53:55 +02:00
Mazdak Farrokhzad
92d66a1317 parser: document parse_pat. 2019-08-24 21:53:55 +02:00
Mazdak Farrokhzad
b7178ef983 parser: parse_pats -> parse_top_pat{_unpack}. 2019-08-24 21:53:55 +02:00
Mazdak Farrokhzad
8f6a0cdb0f parser: document ban_unexpected_or_or. 2019-08-24 21:32:49 +02:00
Mazdak Farrokhzad
39f5e5bec4 parser: move maybe_recover_unexpected_comma to a more appropriate place. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
6498959377 parser: use eat_or_separator for leading vert. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
dc5bbaf7b2 parser: improve parse_pat_with_or docs. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
7b59b4f14d parser: extract eat_or_separator. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
a4a34ab62d parser: integrate maybe_recover_unexpected_comma in parse_pat_with_or. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
21d9b85c0d parser: extract maybe_recover_unexpected_comma. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
f852c7ce1c parser: simplify parse_pat_with_or. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
5f57feec0a parser: multiple-pattern-typo: cover more or-pattern places. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
d34ee769b0 parser: move multiple-pattern-typo -> or-patterns directory. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
30b841dce0 parser: improve or-patterns recovery. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
0bbea47794 parser: refactor parse_pat_with_or + use it in [p0, p1, ..] pats. 2019-08-24 21:32:48 +02:00
Mazdak Farrokhzad
1ba7550a89 parser: type alias type Expected = Option<&'static str>;. 2019-08-24 21:31:54 +02:00
Mazdak Farrokhzad
5299d8a191 parser: extract ban_unexpected_or_or. 2019-08-24 21:31:54 +02:00
Edd Barrett
a4b3dbe4c1 Improve the documentation for std::hint::black_box. 2019-08-24 19:00:13 +01:00
Mazdak Farrokhzad
5fbfcd8872 typeck/pat.rs: extract error_inexistent_fields. 2019-08-24 19:57:05 +02:00
Mazdak Farrokhzad
ba2a784c38 typeck/pat.rs: extract error_unmentioned_fields. 2019-08-24 19:57:05 +02:00
Mazdak Farrokhzad
25f605ae99 typeck/pat.rs: extract error_field_already_bound. 2019-08-24 19:57:05 +02:00
Mazdak Farrokhzad
729fbeb70b typeck/pat.rs: extract diagnostics from check_pat_slice. 2019-08-24 19:57:05 +02:00
Mazdak Farrokhzad
2ab69aef03 typeck/pat.rs: extract new_ref_ty. 2019-08-24 19:57:05 +02:00
Mazdak Farrokhzad
97986b5704 typeck/pat.rs: some common imports. 2019-08-24 19:57:05 +02:00
Mazdak Farrokhzad
41e8aed3cf typeck/pat.rs: check_pat_walk -> check_pat.
It's just shorter and we usually don't use the `_walk` suffix.
2019-08-24 19:57:05 +02:00
Mazdak Farrokhzad
65deeae76d typeck/pat.rs: check_pat_top is the entry point.
This clarifies the fact that type checking patterns unconditionally
starts with `BindByValue` as the default binding mode making the
notion of a default binding mode internal to type checking patterns.
2019-08-24 19:56:56 +02:00
bors
eeba189cfb Auto merge of #63858 - matthiaskrgr:submodule_upd, r=oli-obk
submodules: update clippy from cd3df6be to 2bcb6155

Changes:
````
Refactor some minor things
Use more if-chains
Refactor 'lint_or_fun_call'
Refactor 'check_unwrap_or_default'
Refactor 'check_impl_item'
Add missing field to LitKind::Str
Run update_lints for Unicode lint
Re-add false positive check
Add raw string regression test for useless_format lint
Re-factor useless_format lint
Update Unicode lint tests
Add two more tests, allow 2 other lints.
Fix `temporary_cstring_as_ptr` false negative
Add more testcases for redundant_pattern_matching
Fix suggestions for redundant_pattern_matching
Add note on how to find the latest beta commit
Remove feature gate for async_await
Update if_chain doc link
Requested test cleanup
Requested changes
Ignore lines starting with '#'
run-rustfix for unseparated-prefix-literals
Add autofixable suggestion for unseparated integer literal suffices
Further text improvements
Add image
docs: Explain how to update the changelog
````

r? @oli-obk  @Manishearth
2019-08-24 17:49:35 +00:00
Matthew Jasper
365ff62fca Don't unwrap the result of span_to_snippet
It can return `Err` due to macros being expanded across crates or
files.
2019-08-24 18:25:34 +01:00
Mazdak Farrokhzad
9d69783a46 typeck/pat.rs: (*) -> (note_1) for clarity. 2019-08-24 19:15:52 +02:00
Mazdak Farrokhzad
862bb385d1 typeck/pat.rs: simplify check_pat_walk. 2019-08-24 19:15:47 +02:00
Mazdak Farrokhzad
f09f1a7139 typeck/pat.rs: extract check_pat_slice. 2019-08-24 19:15:42 +02:00
Mazdak Farrokhzad
b4a4e718de typeck/pat.rs: extract check_pat_ref. 2019-08-24 19:15:36 +02:00
Mazdak Farrokhzad
3de221a862 typeck/pat.rs: extract check_pat_box. 2019-08-24 19:15:31 +02:00
Mazdak Farrokhzad
3a51caa648 typeck/pat.rs: extract check_pat_tuple. 2019-08-24 19:15:26 +02:00
Mazdak Farrokhzad
c16248d3a1 typeck/pat.rs: extract check_pat_ident. 2019-08-24 19:15:21 +02:00
Mazdak Farrokhzad
d4afae943f typeck/pat.rs: extract check_pat_range. 2019-08-24 19:15:16 +02:00
Mazdak Farrokhzad
d891e70b64 typeck/pat.rs: extract check_pat_lit. 2019-08-24 19:15:11 +02:00
Mazdak Farrokhzad
23dc37d21d typeck/pat.rs: extract calc_default_binding_mode. 2019-08-24 19:15:05 +02:00
Mazdak Farrokhzad
3ec5d07b1d typeck/pat.rs: simplify peel_off_references. 2019-08-24 19:14:59 +02:00
Mazdak Farrokhzad
8b4114b0d4 typeck/pat.rs: extract peel_off_references and define def_bm algorithm more declaratively. 2019-08-24 19:14:46 +02:00
Mazdak Farrokhzad
d1580eef65 typeck/pat.rs: extract is_non_ref_pat. 2019-08-24 19:14:08 +02:00
Mazdak Farrokhzad
dbe6d59d6e typeck/pat.rs: move note out of check_dereferenceable as it angers VSCode. 2019-08-24 19:13:53 +02:00
Mazdak Farrokhzad
11d40910cd typeck: move check_pat_walk and children to pat.rs. 2019-08-24 19:13:06 +02:00
Aaron Hill
1498608135
Improve Rustdoc's handling of procedural macros
Fixes #58700
Fixes #58696
Fixes #49553
Fixes #52210

This commit removes the special rustdoc handling for proc macros, as we
can now
retrieve their span and attributes just like any other item.

A new command-line option is added to rustdoc: `--crate-type`. This
takes the same options as rustc's `--crate-type` option. However, all
values other than `proc-macro` are treated the same. This allows Rustdoc
to enable 'proc macro mode' when handling a proc macro crate.

In compiletest, a new 'rustdoc-flags' option is added. This allows us to
pass in the '--proc-macro-crate' flag in the absence of Cargo.

I've opened [an additional PR to
Cargo](https://github.com/rust-lang/cargo/pull/7159) to support passing
in this flag.
These two PRS can be merged in any order - the Cargo changes will not
take effect until the 'cargo' submodule is updated in this repository.
2019-08-24 13:11:57 -04:00
Caio
6a3d517314 Modifies how Arg, Arm, Field, FieldPattern and Variant are visited
Part of the necessary work to accomplish #63468.
2019-08-24 13:54:40 -03:00
Matthias Krüger
9bbe8aed4b submodules: update clippy from cd3df6be to 2bcb6155
Changes:
````
Refactor some minor things
Use more if-chains
Refactor 'lint_or_fun_call'
Refactor 'check_unwrap_or_default'
Refactor 'check_impl_item'
Add missing field to LitKind::Str
Run update_lints for Unicode lint
Re-add false positive check
Add raw string regression test for useless_format lint
Re-factor useless_format lint
Update Unicode lint tests
Add two more tests, allow 2 other lints.
Fix `temporary_cstring_as_ptr` false negative
Add more testcases for redundant_pattern_matching
Fix suggestions for redundant_pattern_matching
Add note on how to find the latest beta commit
Remove feature gate for async_await
Update if_chain doc link
Requested test cleanup
Requested changes
Ignore lines starting with '#'
run-rustfix for unseparated-prefix-literals
Add autofixable suggestion for unseparated integer literal suffices
Further text improvements
Add image
docs: Explain how to update the changelog
````
2019-08-24 18:47:43 +02:00
Pascal Hertleif
c9619a4202 Use doc comments for feature gate descriptions
This is just in preparation for future usage of these texts.
2019-08-24 17:47:26 +02:00
Pascal Hertleif
8ca9c7bbe5 Fix tidy feature gate error reporting
Feature gate definitions were split into multiple files in #63824 but
tidy kept reporting the hard-coded path. Now, it shows the full path
to the correct file.
2019-08-24 17:45:03 +02:00
bors
5ade61a4f1 Auto merge of #63823 - petrochenkov:noapply2, r=matthewjasper
Audit uses of `apply_mark` in built-in macros + Remove default macro transparencies

Every use of `apply_mark` in a built-in or procedural macro is supposed to look like this
```rust
location.with_ctxt(SyntaxContext::root().apply_mark(ecx.current_expansion.id))
```
where `SyntaxContext::root()` means that the built-in/procedural macro is defined directly, rather than expanded from some other macro.

However, few people understood what `apply_mark` does, so we had a lot of copy-pasted uses of it looking e.g. like
```rust
span = span.apply_mark(ecx.current_expansion.id);
```
, which doesn't really make sense for procedural macros, but at the same time is not too harmful, if the macros use the traditional `macro_rules` hygiene.

So, to fight this, we stop using `apply_mark` directly in built-in macro implementations, and follow the example of regular proc macros instead and use analogues of `Span::def_site()` and `Span::call_site()`, which are much more intuitive and less error-prone.
- `ecx.with_def_site_ctxt(span)` takes the `span`'s location and combines it with a def-site context.
- `ecx.with_call_site_ctxt(span)` takes the `span`'s location and combines it with a call-site context.

Even if called multiple times (which sometimes happens due to some historical messiness of the built-in macro code) these functions will produce the same result, unlike `apply_mark` which will grow  the mark chain further in this case.

---

After `apply_mark`s in built-in macros are eliminated, the remaining `apply_mark`s are very few in number, so we can start passing the previously implicit `Transparency` argument to them explicitly, thus eliminating the need in `default_transparency` fields in hygiene structures and `#[rustc_macro_transparency]` annotations on built-in macros.

So, the task of making built-in macros opaque can now be formulated as "eliminate `with_legacy_ctxt` in favor of `with_def_site_ctxt`" rather than "replace `#[rustc_macro_transparency = "semitransparent"]` with `#[rustc_macro_transparency = "opaque"]`".

r? @matthewjasper
2019-08-24 14:07:06 +00:00