Commit Graph

98394 Commits

Author SHA1 Message Date
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
Christian
55f8dde6c8 Added an extra line to make the formatting conform to the rest of the document. 2019-08-24 13:38:09 +02:00
Christian
a577316b0a Removed the confusing FnOnce example. closes #47091 2019-08-24 13:36:57 +02:00
bors
478464570e Auto merge of #63637 - alexcrichton:remove-libtest-step, r=Mark-Simulacrum
bootstrap: Merge the libtest build step with libstd

Since its inception rustbuild has always worked in three stages: one for
libstd, one for libtest, and one for rustc. These three stages were
architected around crates.io dependencies, where rustc wants to depend
on crates.io crates but said crates don't explicitly depend on libstd,
requiring a sysroot assembly step in the middle. This same logic was
applied for libtest where libtest wants to depend on crates.io crates
(`getopts`) but `getopts` didn't say that it depended on std, so it
needed `std` built ahead of time.

Lots of time has passed since the inception of rustbuild, however,
and we've since gotten to the point where even `std` itself is depending
on crates.io crates (albeit with some wonky configuration). This
commit applies the same logic to the two dependencies that the `test`
crate pulls in from crates.io, `getopts` and `unicode-width`. Over the
many years since rustbuild's inception `unicode-width` was the only
dependency picked up by the `test` crate, so the extra configuration
necessary to get crates building in this crate graph is unlikely to be
too much of a burden on developers.

After this patch it means that there are now only two build phasese of
rustbuild, one for libstd and one for rustc. The libtest/libproc_macro
build phase is all lumped into one now with `std`.

This was originally motivated by rust-lang/cargo#7216 where Cargo was
having to deal with synthesizing dependency edges but this commit makes
them explicit in this repository.
2019-08-24 05:39:52 +00:00
bors
c2f3174a27 Auto merge of #63824 - Centril:split-feature_gate, r=oli-obk
Refactor `feature_gate.rs` into modules & cleanup

Split `src/libsyntax/feature_gate.rs` into `src/libsyntax/feature_gate/` with files:
- `accepted.rs` (accepted feature gates)
- `removed.rs` (...)
- `active.rs` (...)
- `builtin_attrs.rs` (definition of builtin attributes and their gates as well as gating `cfg` flags)
- `check.rs` (post expansion checking of feature gates)
- `mod.rs` (just reexports)

Additionally, `tidy.rs` is adjusted to respect the new scheme.

Also, `builtin_attrs.rs` sees some cleanup, organization, and DSL-ification to reduce repetition.

This is probably best read commit-by-commit I think.

r? @oli-obk
2019-08-24 01:50:03 +00:00
Wesley Wiser
d6bf776bc6 Fix incremental tests 2019-08-23 21:36:57 -04:00
Oliver Scherer
7dff647d23 Ensure miri can do bit ops on pointer values 2019-08-24 02:23:56 +02:00
Alex Crichton
b47c9690d2 bootstrap: Merge the libtest build step with libstd
Since its inception rustbuild has always worked in three stages: one for
libstd, one for libtest, and one for rustc. These three stages were
architected around crates.io dependencies, where rustc wants to depend
on crates.io crates but said crates don't explicitly depend on libstd,
requiring a sysroot assembly step in the middle. This same logic was
applied for libtest where libtest wants to depend on crates.io crates
(`getopts`) but `getopts` didn't say that it depended on std, so it
needed `std` built ahead of time.

Lots of time has passed since the inception of rustbuild, however,
and we've since gotten to the point where even `std` itself is depending
on crates.io crates (albeit with some wonky configuration). This
commit applies the same logic to the two dependencies that the `test`
crate pulls in from crates.io, `getopts` and `unicode-width`. Over the
many years since rustbuild's inception `unicode-width` was the only
dependency picked up by the `test` crate, so the extra configuration
necessary to get crates building in this crate graph is unlikely to be
too much of a burden on developers.

After this patch it means that there are now only two build phasese of
rustbuild, one for libstd and one for rustc. The libtest/libproc_macro
build phase is all lumped into one now with `std`.

This was originally motivated by rust-lang/cargo#7216 where Cargo was
having to deal with synthesizing dependency edges but this commit makes
them explicit in this repository.
2019-08-23 16:46:11 -07:00
bors
4993524682 Auto merge of #63814 - malbarbo:wasi-error-kind, r=alexcrichton
Implement decode_error_kind for wasi

Based on the implementation for unix targets,
2019-08-23 22:09:07 +00:00
Baoshan
602bea3c12
Merge pull request #8 from Wind-River/set_name_003
VxWorks does not provide a way to set the task name except at creation time
2019-08-23 14:50:01 -07:00
Baoshan Pang
912feabfc2 VxWorks does not provide a way to set the task name except at creation time 2019-08-23 14:39:38 -07:00
Esteban Küber
055f7e2ec2 Extend comment 2019-08-23 13:45:18 -07:00