summary refs log tree commit diff
path: root/src/libsyntax/feature_gate.rs
AgeCommit message (Collapse)AuthorLines
2019-08-05Auto merge of #63248 - petrochenkov:nomarker, r=matthewjasperbors-5/+0
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-04Rename `ItemImplKind::Type` to `ItemImplKind::TyAlias`varkor-1/+1
2019-08-03Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion ↵Vadim Petrochenkov-5/+0
infrastructure to elsewhere
2019-08-02Replace "existential" by "opaque"varkor-4/+4
2019-08-02Switch existential_type to type_alias_impl_traitvarkor-5/+8
2019-07-30Rollup merge of #63095 - Centril:incomplete-features-lint, r=varkorMazdak Farrokhzad-13/+4
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-30Pacify tidy, the merciless.Mazdak Farrokhzad-1/+1
2019-07-30Unsupport the await!(..) macro.Mazdak Farrokhzad-17/+4
2019-07-30Turn INCOMPLETE_FEATURES into a lint.Mazdak Farrokhzad-13/+4
2019-07-29Rollup merge of #63092 - Centril:update-impl-trait-gates, r=varkorMazdak Farrokhzad-2/+2
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-29Rollup merge of #63077 - petrochenkov:nolangfeat, r=petrochenkovMazdak Farrokhzad-18/+0
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-29Update existential_type + impl_trait_in_bindings issue numbers.Mazdak Farrokhzad-2/+2
2019-07-28cleanup: Remove some language features related to built-in macrosVadim Petrochenkov-18/+0
They are now library features.
2019-07-28Adjust feature gating of subslice patterns accordingly.Mazdak Farrokhzad-5/+17
2019-07-24syntax_ext: Reuse built-in attribute template checking for macro attributesVadim Petrochenkov-88/+2
2019-07-24syntax_ext: Turn `#[global_allocator]` into a regular attribute macroVadim Petrochenkov-1/+0
2019-07-22add rustc_private as a proper language feature gateAleksey Kladov-0/+3
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-18Auto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddybbors-2/+5
rustc/rustc_mir: Implement RFC 2203. This PR implements RFC 2203, allowing constants in array repeat expressions. Part of #49147. r? @eddyb
2019-07-13Tweak wording in feature gate errorsEsteban Küber-3/+3
2019-07-11Remove feature gate `dropck_parametricity` completelyLzu Tao-12/+2
Therefore we also remove `#[unsafe_destructor_blind_to_params]` attribute completly.
2019-07-09normalize use of backticks in compiler messages for libsyntax/feature_gateSamy Kacimi-13/+13
https://github.com/rust-lang/rust/issues/60532
2019-07-07syntax: Add feature gate.David Wood-2/+5
This commit adds a `const_in_array_repeat_expressions` feature gate and only create `Candidate::Repeat` if it is enabled.
2019-07-07Rollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomezMazdak Farrokhzad-0/+4
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-07syntax: Migrate built-in macros to the regular stability checkingVadim Petrochenkov-21/+1
2019-07-06rustdoc: set cfg(doctest) when collecting doctestsQuietMisdreavus-0/+4
2019-07-06Fix tidy issuesVadim Petrochenkov-1/+1
2019-07-06`#[rustc_transparent_macro]` -> `#[rustc_macro_transparency = ...]`Vadim Petrochenkov-1/+3
2019-07-06`#[rustc_doc_only_macro]` -> `#[rustc_builtin_macro]`Vadim Petrochenkov-1/+1
2019-07-05Rollup merge of #62133 - petrochenkov:norustc, r=eddybMazdak Farrokhzad-13/+47
Feature gate `rustc` attributes harder Fixes https://github.com/rust-lang/rust/issues/62116
2019-07-03Add separate 'async_closure' feature gate.Mazdak Farrokhzad-24/+28
2019-07-03Rollup merge of #62255 - Centril:slice-patterns-change-issue, r=varkorMark Rousskov-2/+2
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-02more nits + typosNiko Matsakis-1/+1
2019-07-02feature-gate member constraints outside of async-awaitNiko Matsakis-0/+3
Minimizes risk.
2019-07-01Auto merge of #61682 - Centril:stabilize-type_alias_enum_variants, ↵bors-3/+2
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-06-30Switch tracking issue for 'slice_patterns'.Mazdak Farrokhzad-2/+2
2019-06-30Feature gate `rustc` attributes harderVadim Petrochenkov-0/+8
2019-06-30Make sure `#[rustc_doc_only_macro]` and other rustc attributes are registeredVadim Petrochenkov-13/+39
2019-06-26Fix clippy::redundant_field_namesIgor Matuszewski-1/+1
2019-06-25Auto merge of #60732 - jswrenn:arbitrary_enum_discriminant, r=pnkfelixbors-5/+32
Implement arbitrary_enum_discriminant Implements RFC rust-lang/rfcs#2363 (tracking issue #60553).
2019-06-23let_chains: Move feature gating to pre-expansion.Mazdak Farrokhzad-25/+11
2019-06-23let_chains: Add feature gate.Mazdak Farrokhzad-1/+30
2019-06-21Implement arbitrary_enum_discriminantJohn Wrenn-5/+32
2019-06-16Auto merge of #61347 - Centril:stabilize-underscore_const_names, r=petrochenkovbors-11/+3
Stabilize underscore_const_names in 1.37.0 You are now permitted to write: ```rust const _: $type_expression = $term_expression; ``` That is, we change the [grammar of items](https://github.com/rust-lang-nursery/wg-grammar/blob/9d1984d7ae8d6576f943566539a31a5800644c57/grammar/item.lyg#L3-L42), as written in [the *`.lyg`* notation](https://github.com/rust-lang/gll/tree/263bf161dad903e67aa65fc591ced3cab18afa2a#grammar), from: ```java Item = attrs:OuterAttr* vis:Vis? kind:ItemKind; ItemKind = | ... | Const:{ "const" name:IDENT ":" ty:Type "=" value:Expr ";" } | ... ; ``` into: ```java Item = attrs:OuterAttr* vis:Vis? kind:ItemKind; ItemKind = | ... | Const:{ "const" name:IdentOrUnderscore ":" ty:Type "=" value:Expr ";" } | ... ; IdentOrUnderscore = | Named:IDENT | NoName:"_" ; ``` r? @petrochenkov
2019-06-15cleanup some new active feature gates.Mazdak Farrokhzad-3/+2
2019-06-15Stabilize type_alias_enum_variants.Mazdak Farrokhzad-3/+2
2019-06-12Auto merge of #60669 - c410-f3r:attrs-fn, r=petrochenkovbors-0/+15
Allow attributes in formal function parameters Implements https://github.com/rust-lang/rust/issues/60406. This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made. **TODO** - [x] Forbid some built-in attributes. - [x] Expand cfg/cfg_attr
2019-06-10Implement RFC 2645 (transparent enums and unions)Michael Bradshaw-0/+6
Tracking issue: #60405
2019-06-10Stabilize underscore_const_names.Mazdak Farrokhzad-11/+3
2019-06-09Auto merge of #61229 - Centril:stabilize-repr_align_enum, r=nagisabors-14/+3
Stabilize #![feature(repr_align_enum)] in Rust 1.37.0 On an `enum` item, you may now write: ```rust #[repr(align(X))] enum Foo { // ... } ``` This has equivalent effects to first defining: ```rust #[repr(align(X))] struct AlignX<T>(T); ``` and then using `AlignX<Foo>` in `Foo`'s stead. r? @nagisa
2019-06-09Allow attributes in formal function parametersCaio-0/+15