Commit Graph

1129 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
975455b37d syntax: extract removed.rs feature gates. 2019-08-23 01:39:38 +02:00
Mazdak Farrokhzad
b873743c02 syntax: extract accepted.rs feature gates. 2019-08-23 01:39:29 +02:00
Mazdak Farrokhzad
0e8a1a4e78
Rollup merge of #63762 - rust-lang:fix-async-date, r=Mark-Simulacrum
`async_await` was stabilized in 1.39.0, not 1.38.0.

r? @Mark-Simulacrum
2019-08-21 11:52:28 +02:00
Mazdak Farrokhzad
b6556744b5
Rollup merge of #63755 - Centril:simplify-prexp-gating, r=petrochenkov
Use dedicated type for spans in pre-expansion gating.

- Simplify the overall pre-expansion gating "experience".
2019-08-21 11:52:23 +02:00
Mazdak Farrokhzad
418eb181ca
async_await was stabilized in 1.39.0, not 1.38.0. 2019-08-21 00:23:08 +02:00
Mazdak Farrokhzad
777a12c3a4 Use dedicated type for spans in pre-expansion gating. 2019-08-20 20:26:37 +02:00
Mazdak Farrokhzad
b0d4782948 Stabilize 'async_await'. 2019-08-20 02:38:02 +02:00
Dan Robertson
1870537f27
initial implementation of or-pattern parsing
Initial implementation of parsing or-patterns e.g., `Some(Foo | Bar)`.
This is a partial implementation of RFC 2535.
2019-08-17 15:55:40 +00:00
Mazdak Farrokhzad
20661f18df Simplify pre-expansion gating in general. 2019-08-16 19:24:15 +02:00
Mazdak Farrokhzad
4087fc583e Feature gate 'yield ?' pre-expansion. 2019-08-16 19:24:15 +02:00
Caio
6a42b0b28d Merge Variant and Variant_ 2019-08-14 14:47:01 -03:00
bors
e1d7e4ae82 Auto merge of #63248 - petrochenkov:nomarker, r=matthewjasper
Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion infrastructure to elsewhere

As described in https://github.com/rust-lang/rust/pull/62086#issuecomment-515195477.

Reminder:
- `derive(PartialEq, Eq)` makes the type it applied to a "structural match" type, so constants of this type can be used in patterns (and const generics in the future).
- `derive(Copy)` notifies other derives that the type it applied to implements `Copy`, so `derive(Clone)` can generate optimized code and other derives can generate code working with `packed` types and types with `rustc_layout_scalar_valid_range` attributes.

First, the special behavior is now enabled after properly resolving the derives, rather than after textually comparing them with `"Copy"`, `"PartialEq"` and `"Eq"` in `fn add_derived_markers`.

The markers are no longer kept as attributes in AST since derives cannot modify items and previously did it through hacks in the expansion infra.
Instead, the markers are now kept in a "global context" available from all the necessary places, namely - resolver.

For `derive(PartialEq, Eq)` the markers are created by the derive macros themselves and then consumed during HIR lowering to add the `#[structural_match]` attribute in HIR.
This is still a hack, but now it's a hack local to two specific macros rather than affecting the whole expansion infra.
Ideally we should find the way to put `#[structural_match]` on the impls rather than on the original item, and then consume it in `rustc_mir`, then no hacks in expansion and lowering will be required.
(I'll make an issue about this for someone else to solve, after this PR lands.)

The marker for `derive(Copy)` cannot be emitted by the `Copy` macro itself because we need to know it *before* the `Copy` macro is expanded for expanding other macros.
So we have to do it in resolve and block expansion of any derives in a `derive(...)` container until we know for sure whether this container has `Copy` in it or not.
Nasty stuff.

r? @eddyb or @matthewjasper
2019-08-05 04:36:51 +00:00
varkor
63659ca9f6 Rename ItemImplKind::Type to ItemImplKind::TyAlias 2019-08-04 20:16:41 +01:00
Vadim Petrochenkov
2a9b75281b Move special treatment of derive(Copy, PartialEq, Eq) from expansion infrastructure to elsewhere 2019-08-03 23:57:35 +03:00
varkor
c28ce3e4ca Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
varkor
87738fe834 Switch existential_type to type_alias_impl_trait 2019-08-02 02:44:35 +01:00
Mazdak Farrokhzad
dbf54ad324
Rollup merge of #63095 - Centril:incomplete-features-lint, r=varkor
Turn `INCOMPLETE_FEATURES` into lint

We do this because it is annoying to see the warning when building rustc and because this is better from a "separation of concerns" POV.

The drawback to this change is that this will respect `--cap-lints`.
Also note that this is not a buffered lint so if there are fatal parser errors then the lint will not trigger.

r? @varkor
2019-07-30 22:43:34 +02:00
Mazdak Farrokhzad
b21f0a313e Pacify tidy, the merciless. 2019-07-30 10:55:45 +02:00
Mazdak Farrokhzad
758931948f Unsupport the await!(..) macro. 2019-07-30 10:55:45 +02:00
Mazdak Farrokhzad
dcc4b994b9 Turn INCOMPLETE_FEATURES into a lint. 2019-07-30 10:32:43 +02:00
Mazdak Farrokhzad
f8321d0d97
Rollup merge of #63092 - Centril:update-impl-trait-gates, r=varkor
Update `impl Trait` gate issues

cc https://github.com/rust-lang/rust/issues/63065
cc https://github.com/rust-lang/rust/issues/63063

r? @varkor cc @alexreg
2019-07-29 02:11:00 +02:00
Mazdak Farrokhzad
7f2c3e1723
Rollup merge of #63077 - petrochenkov:nolangfeat, r=petrochenkov
cleanup: Remove some language features related to built-in macros

They are now library features.
Cleanup after https://github.com/rust-lang/rust/pull/62086.
The unstable book files are moved because tidy complained.
2019-07-29 02:10:57 +02:00
Mazdak Farrokhzad
2a49dd0db6 Update existential_type + impl_trait_in_bindings issue numbers. 2019-07-29 00:09:18 +02:00
Vadim Petrochenkov
b92697b8fb cleanup: Remove some language features related to built-in macros
They are now library features.
2019-07-28 14:14:48 +03:00
Mazdak Farrokhzad
12250a2017 Adjust feature gating of subslice patterns accordingly. 2019-07-28 06:53:38 +02:00
Vadim Petrochenkov
76b1ffaf6c syntax_ext: Reuse built-in attribute template checking for macro attributes 2019-07-24 12:29:45 +03:00
Vadim Petrochenkov
433024147a syntax_ext: Turn #[global_allocator] into a regular attribute macro 2019-07-24 12:29:44 +03:00
Aleksey Kladov
27b703dd40 add rustc_private as a proper language feature gate
At the moment, `rustc_private` as a (library) feature exists by
accident: `char::is_xid_start`, `char::is_xid_continue` methods in
libcore define it.
2019-07-22 16:32:13 +03:00
bors
a3369981de Auto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddyb
rustc/rustc_mir: Implement RFC 2203.

This PR implements RFC 2203, allowing constants in array repeat
expressions. Part of #49147.

r? @eddyb
2019-07-18 20:41:40 +00:00
Esteban Küber
84dfb2c4d7 Tweak wording in feature gate errors 2019-07-13 12:03:05 -07:00
Lzu Tao
8347917dd9 Remove feature gate dropck_parametricity completely
Therefore we also remove `#[unsafe_destructor_blind_to_params]`
attribute completly.
2019-07-11 18:44:56 +00:00
Samy Kacimi
41e71b0c93
normalize use of backticks in compiler messages for libsyntax/feature_gate
https://github.com/rust-lang/rust/issues/60532
2019-07-09 14:13:28 +02:00
David Wood
3cca4ceed8
syntax: Add feature gate.
This commit adds a `const_in_array_repeat_expressions` feature gate and
only create `Candidate::Repeat` if it is enabled.
2019-07-07 19:51:29 +01:00
Mazdak Farrokhzad
fe807fcf3e
Rollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomez
rustdoc: set cfg(doctest) when collecting doctests

Note: This PR builds on top of https://github.com/rust-lang/rust/pull/61199; only the last commit is specific to this PR.

As discussed in https://github.com/rust-lang/rust/pull/61199, we want the ability to isolate items to only when rustdoc is collecting doctests, but we can't use `cfg(test)` because of libcore's `#![cfg(not(test))]`. This PR proposes a new cfg flag, `cfg(doctest)`, specific to this situation, rather than reusing an existing flag. I've isolated it behind a feature gate so that we can contain the effects to nightly only. (A stable workaround that can be used in lieu of `#[cfg(doctest)]` is `#[cfg(rustdoc)] #[doc(hidden)]`, at least once https://github.com/rust-lang/rust/pull/61351 lands.)

Tracking issue: https://github.com/rust-lang/rust/issues/62210
2019-07-07 17:00:18 +02:00
Vadim Petrochenkov
1ee0ce82cb syntax: Migrate built-in macros to the regular stability checking 2019-07-07 13:04:07 +03:00
QuietMisdreavus
bed54cf854 rustdoc: set cfg(doctest) when collecting doctests 2019-07-06 21:37:17 -05:00
Vadim Petrochenkov
987be89db3 Fix tidy issues 2019-07-06 16:59:08 +03:00
Vadim Petrochenkov
22d6d8ac76 #[rustc_transparent_macro] -> #[rustc_macro_transparency = ...] 2019-07-06 16:59:08 +03:00
Vadim Petrochenkov
15042a3c1c #[rustc_doc_only_macro] -> #[rustc_builtin_macro] 2019-07-06 16:59:08 +03:00
Mazdak Farrokhzad
0224532493
Rollup merge of #62133 - petrochenkov:norustc, r=eddyb
Feature gate `rustc` attributes harder

Fixes https://github.com/rust-lang/rust/issues/62116
2019-07-05 20:26:54 +02:00
Mazdak Farrokhzad
bb7fbb99a2 Add separate 'async_closure' feature gate. 2019-07-03 23:59:36 +02:00
Mark Rousskov
ea6c1fcf34
Rollup merge of #62255 - Centril:slice-patterns-change-issue, r=varkor
Switch tracking issue for `#![feature(slice_patterns)]`

Switches the tracking issue for `#![feature(slice_patterns)]` to a fresh one in https://github.com/rust-lang/rust/issues/62254 due to new RFCs.

Closes https://github.com/rust-lang/rust/issues/23121.

r? @varkor
2019-07-03 09:59:25 -04:00
Niko Matsakis
076b0d0f5c more nits + typos 2019-07-02 12:25:23 -04:00
Niko Matsakis
74a6efbf00 feature-gate member constraints outside of async-await
Minimizes risk.
2019-07-02 12:25:22 -04:00
bors
5748825cc8 Auto merge of #61682 - Centril:stabilize-type_alias_enum_variants, r=petrochenkov
Stabilize `type_alias_enum_variants` in Rust 1.37.0

Stabilize `#![feature(type_alias_enum_variants)]` which allows type-relative resolution with highest priority to `enum` variants in both expression and pattern contexts. For example, you may now write:

```rust
enum Option<T> {
    None,
    Some(T),
}

type OptAlias<T> = Option<T>;

fn work_on_alias(x: Option<u8>) -> u8 {
    match x {
        OptAlias::Some(y) => y + 1,
        OptAlias::None => 0,
    }
}
```

Closes https://github.com/rust-lang/rfcs/issues/2218
Closes https://github.com/rust-lang/rust/issues/52118

r? @petrochenkov
2019-07-01 03:11:19 +00:00
Mazdak Farrokhzad
de00ae7266 Switch tracking issue for 'slice_patterns'. 2019-06-30 23:23:11 +02:00
Vadim Petrochenkov
e4e7eb2d58 Feature gate rustc attributes harder 2019-06-30 13:57:12 +03:00
Vadim Petrochenkov
0ffb6438a6 Make sure #[rustc_doc_only_macro] and other rustc attributes are registered 2019-06-30 12:47:33 +03:00
Igor Matuszewski
12806b7050 Fix clippy::redundant_field_names 2019-06-26 13:59:58 +02:00
bors
303f77ee1d Auto merge of #60732 - jswrenn:arbitrary_enum_discriminant, r=pnkfelix
Implement arbitrary_enum_discriminant

Implements RFC rust-lang/rfcs#2363 (tracking issue #60553).
2019-06-25 15:12:11 +00:00