Commit Graph

98079 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
6a73199da6 or_patterns: add run-rustfix tests. 2019-08-25 05:45:51 +02:00
Mazdak Farrokhzad
1caaa40768 parser: gracefully handle fn foo(A | B: type). 2019-08-25 05:45:19 +02:00
Mazdak Farrokhzad
083963e58c parser: 'while parsing this or-pattern...' 2019-08-25 01:50:21 +02:00
Mazdak Farrokhzad
1202cb0e2b parser: simplify parse_pat_with_or_{inner} 2019-08-25 01:00:19 +02:00
Mazdak Farrokhzad
0ab8430332 parser: reword || recovery. 2019-08-24 23:44:28 +02:00
Mazdak Farrokhzad
e3747722fb parser: extract recover_inner_leading_vert. 2019-08-24 23:10:46 +02:00
Mazdak Farrokhzad
3a405421e7 parse_top_pat: silence leading vert gating sometimes. 2019-08-24 23:05:04 +02:00
Mazdak Farrokhzad
a9ef8592e4 parser: bool -> TopLevel. 2019-08-24 22:48:23 +02:00
Mazdak Farrokhzad
b2966e651d parser: bool -> GateOr. 2019-08-24 22:29:57 +02:00
Mazdak Farrokhzad
b205055c7b parser: better recovery for || in inner pats. 2019-08-24 21:53:55 +02:00
Mazdak Farrokhzad
1ffea18ddb or-patterns: harden feature gating tests. 2019-08-24 21:53:55 +02:00
Mazdak Farrokhzad
d3b3bceffb move feature-gate-or_patterns.* -> ui/or-patterns/ 2019-08-24 21:53:55 +02:00
Mazdak Farrokhzad
f35432e188 or-patterns: add syntactic tests. 2019-08-24 21:53:55 +02:00
Mazdak Farrokhzad
a9af18bed5 move ui/or-pattern-mismatch -> ui/or-patterns/. 2019-08-24 21:53:55 +02:00
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
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
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
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
bors
9eae1fc0ea Auto merge of #63819 - najamelan:patch-1, r=Centril
rustc docs: Update single-use-lifetimes

When using this, rustc emits a warning that the lint has been renamed (to having an 's' at the end)
2019-08-23 16:22:06 +00:00
Marco A L Barbosa
c8838efe35 Implement decode_error_kind for wasi
Based on the implementation for unix targets
2019-08-23 10:48:38 -03:00
bors
3def0f3d5b Auto merge of #63815 - sebastinez:sebastinez-doc-#63792, r=jonas-schievink
Update occurences of as_slice to as_str in comments

Fix #63792
2019-08-23 12:40:32 +00:00
bors
f834695781 Auto merge of #63521 - newpavlov:redox_builder, r=pietroalbini
Re-enable Redox builder (take 2)

Closes: #63160
2019-08-23 08:58:24 +00:00
bors
0507d49755 Auto merge of #63808 - Rosto75:master, r=KodrAus
A bunch of minor documentation tweaks and fixes.
2019-08-23 05:11:41 +00:00
bors
a71e32e407 Auto merge of #63801 - jeremystucki:patch-1, r=jonas-schievink
Update .mailmap
2019-08-23 01:27:58 +00:00
Mazdak Farrokhzad
3e061f7c49 --bless some tests due to message format change. 2019-08-23 01:42:05 +02:00
Mazdak Farrokhzad
3cfb6bc73a Fix tidy fallout due to feature_gate.rs refactoring. 2019-08-23 01:41:54 +02:00
Mazdak Farrokhzad
6febb75ec8 syntax: move feature_gate.rs. 2019-08-23 01:41:54 +02:00
Mazdak Farrokhzad
87eafd6c1b syntax: extract check.rs. 2019-08-23 01:41:49 +02:00
Mazdak Farrokhzad
e5aa2dd1ff builtin_attrs.rs: retain FIXMEs. 2019-08-23 01:41:13 +02:00
Mazdak Farrokhzad
d286fe0b8d builtin_attrs.rs: organize! 2019-08-23 01:41:04 +02:00
Mazdak Farrokhzad
584388c4aa builtin_attrs.rs: cleanup with (un)gated!. 2019-08-23 01:40:52 +02:00