about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate/check.rs
AgeCommit message (Collapse)AuthorLines
2019-11-06Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, ↵Mazdak Farrokhzad-1/+1
r=estebank Rename `LocalInternedString` and more This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses. r? @estebank
2019-11-02Simplify various `Symbol` use points.Nicholas Nethercote-1/+1
Including removing a bunch of unnecessary `.as_str()` calls, and a bunch of unnecessary sigils.
2019-10-31syntax: disable the new early feature-gatings added in #65742.Eduard-Mihai Burtescu-0/+15
2019-10-31Revert "pre-expansion gate trait_alias."Eduard-Mihai Burtescu-0/+9
This reverts commit 2d182b82ce5ecfe8090ba3d4e78f1cd72c072ef1.
2019-10-31Revert "pre-expansion gate associated_type_bounds"Eduard-Mihai Burtescu-1/+14
This reverts commit c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7.
2019-10-31Revert "pre-expansion gate crate_visibility_modifier"Eduard-Mihai Burtescu-0/+8
This reverts commit 04c661ba021730bc13d33c6d55cb9aad05026f36.
2019-10-31Revert "pre-expansion gate const_generics"Eduard-Mihai Burtescu-1/+11
This reverts commit 49cbfa1a6f6469ddbc0e88161e52104cc87aea9b.
2019-10-31Revert "pre-expansion gate decl_macro"Eduard-Mihai Burtescu-0/+5
This reverts commit 1f470ceac2202ecffe8a15acc1139edb9ad4a03b.
2019-10-31Revert "pre-expansion gate box_patterns"Eduard-Mihai Burtescu-1/+14
This reverts commit 2aff6b36d7ed5c25700669a92b4a43200ee0fe6b.
2019-10-31Revert "pre-expansion gate exclusive_range_pattern"Eduard-Mihai Burtescu-1/+6
This reverts commit 665a876e307933c6480a6c55a3e38e88937aff2c.
2019-10-31Revert "pre-expansion gate try_blocks"Eduard-Mihai Burtescu-0/+3
This reverts commit 1935ba658c576f14397c2c7a26a6642cf08f26a6.
2019-10-31Revert "pre-expansion gate label_break_value"Eduard-Mihai Burtescu-0/+6
This reverts commit 137ded8ab1edf5112c45e0b6854272ae2e9d3a6d.
2019-10-31Revert "pre-expansion gate box_syntax"Eduard-Mihai Burtescu-0/+6
This reverts commit e4ed8865786a787a7b0c045f7674569b6be0e9bc.
2019-10-31Revert "pre-expansion gate type_ascription"Eduard-Mihai Burtescu-0/+15
This reverts commit 15a6c09b6e8a977f2c6f5a73de01a20d00b37930.
2019-10-29Rollup merge of #65809 - roblabla:eficall-abi, r=nagisaMazdak Farrokhzad-0/+4
Add new EFIAPI ABI Fixes #54527 Adds a new ABI, "efiapi", which reflects the calling convention as specified by [the current spec UEFI spec](https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_7_A%20Sept%206.pdf#G6.999903). When compiling for x86_64, we should select the `win64` ABI, while on all other architectures (Itanium, x86, ARM and ARM64 and RISC-V), we should select the `C` ABI. Currently, this is done by just turning it into the C ABI everywhere except on x86_64, where it's turned into the win64 ABI. Should we prevent this ABI from being used on unsupported architectures, and if so, how would this be done?
2019-10-25Add new EFIAPI ABIroblabla-0/+4
Adds a new ABI for the EFIAPI calls. This ABI should reflect the latest version of the UEFI specification at the time of commit (UEFI spec 2.8, URL below). The specification says that for x86_64, we should follow the win64 ABI, while on all other supported platforms (ia32, itanium, arm, arm64 and risc-v), we should follow the C ABI. To simplify the implementation, we will simply follow the C ABI on all platforms except x86_64, even those technically unsupported by the UEFI specification. https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
2019-10-24pre-expansion gate type_ascriptionMazdak Farrokhzad-15/+6
2019-10-24pre-expansion gate box_syntaxMazdak Farrokhzad-6/+1
2019-10-24pre-expansion gate label_break_valueMazdak Farrokhzad-6/+1
2019-10-24dedup GAT gate checksMazdak Farrokhzad-16/+21
2019-10-24pre-expansion gate try_blocksMazdak Farrokhzad-3/+1
2019-10-24pre-expansion gate exclusive_range_patternMazdak Farrokhzad-6/+2
2019-10-24pre-expansion gate box_patternsMazdak Farrokhzad-14/+2
2019-10-24pre-expansion gate decl_macroMazdak Farrokhzad-5/+1
2019-10-24pre-expansion gate const_genericsMazdak Farrokhzad-11/+2
2019-10-24pre-expansion gate crate_visibility_modifierMazdak Farrokhzad-8/+1
2019-10-24pre-expansion gate associated_type_boundsMazdak Farrokhzad-14/+2
2019-10-24pre-expansion gate trait_alias.Mazdak Farrokhzad-9/+1
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-1/+1
2019-10-15Rollup merge of #65426 - ↵Mazdak Farrokhzad-1/+1
nnethercote:rm-custom-LocalInternedString-PartialEq-impls, r=petrochenkov Remove custom `PartialEq` impls for `LocalInternedString`. This is on-trend with the recent changes simplifying `LocalInternedString` and reducing its use. r? @petrochenkov
2019-10-15syntax::parse::sess -> syntax::sessMazdak Farrokhzad-1/+2
2019-10-15move maybe_report_invalid_custom_discriminants to feature_gateMazdak Farrokhzad-3/+47
2019-10-15Remove custom `PartialEq` impls for `LocalInternedString`.Nicholas Nethercote-1/+1
This is on-trend with the recent changes simplifying `LocalInternedString` and reducing its use.
2019-10-13simplify maybe_stage_featuresMazdak Farrokhzad-14/+8
2019-10-02Add support for 'extern const fn'Aaron Hill-0/+1
This works just as you might expect - an 'extern const fn' is a 'const fn' that is callable from foreign code. Currently, panicking is not allowed in consts. When RFC 2345 is stabilized, then panicking in an 'extern const fn' will produce a compile-time error when invoked at compile time, and an abort when invoked at runtime. Since this is extending the language (we're allowing the `const` keyword in a new context), I believe that this will need an FCP. However, it's a very minor change, so I didn't think that filing an RFC was necessary. This will allow libc (and other FFI crates) to make many functions `const`, without having to give up on making them `extern` as well.
2019-09-28syntax: don't keep a redundant c_variadic flag in the AST.Eduard-Mihai Burtescu-3/+8
2019-09-26Rename `ForeignItem.node` to `ForeignItem.kind`varkor-1/+1
2019-09-26Rename `Item.node` to `Item.kind`varkor-1/+1
2019-09-26Rename `Ty.node` to `Ty.kind`varkor-2/+2
2019-09-26Rename `TraitItem.node` to `TraitItem.kind`varkor-1/+1
2019-09-26Rename `ImplItem.node` to `ImplItem.kind`varkor-1/+1
2019-09-26Rename `Pat.node` to `Pat.kind`varkor-2/+2
2019-09-26Rename `Expr.node` to `Expr.kind`varkor-1/+1
For both `ast::Expr` and `hir::Expr`.
2019-09-21Rollup merge of #64010 - c410-f3r:stabilize-attrs-fn, r=CentrilMazdak Farrokhzad-1/+0
Stabilize `param_attrs` in Rust 1.39.0 # Stabilization proposal I propose that we stabilize `#![feature(param_attrs)]`. Tracking issue: #60406 Version: 1.39 (2019-09-26 => beta, 2019-11-07 => stable). ## What is stabilized It is now possible to add outer attributes like `#[cfg(..)]` on formal parameters of functions, closures, and function pointer types. For example: ```rust fn len( #[cfg(windows)] slice: &[u16], #[cfg(not(windows))] slice: &[u8], ) -> usize { slice.len() } ``` ## What isn't stabilized * Documentation comments like `/// Doc` on parameters. * Code expansion of a user-defined `#[proc_macro_attribute]` macro used on parameters. * Built-in attributes other than `cfg`, `cfg_attr`, `allow`, `warn`, `deny`, and `forbid`. Currently, only the lints `unused_variables` and `unused_mut` have effect and may be controlled on parameters. ## Motivation The chief motivations for stabilizing `param_attrs` include: * Finer conditional compilation with `#[cfg(..)]` and linting control of variables. * Richer macro DSLs created by users. * External tools and compiler internals can take advantage of the additional information that the parameters provide. For more examples, see the [RFC][rfc motivation]. ## Reference guide In the grammar of function and function pointer, the grammar of variadic tails (`...`) and parameters are changed respectively from: ```rust FnParam = { pat:Pat ":" }? ty:Type; VaradicTail = "..."; ``` into: ```rust FnParam = OuterAttr* { pat:Pat ":" }? ty:Type; VaradicTail = OuterAttr* "..."; ``` The grammar of a closure parameter is changed from: ```rust ClosureParam = pat:Pat { ":" ty:Type }?; ``` into: ```rust ClosureParam = OuterAttr* pat:Pat { ":" ty:Type }?; ``` More generally, where there's a list of formal (value) parameters separated or terminated by `,` and delimited by `(` and `)`. Each parameter in that list may optionally be prefixed by `OuterAttr+`. Note that in all cases, `OuterAttr*` applies to the whole parameter and not just the pattern. This distinction matters in pretty printing and in turn for macros. ## History * On 2018-10-15, @Robbepop proposes [RFC 2565][rfc], "Attributes in formal function parameter position". * On 2019-04-30, [RFC 2565][rfc] is merged and the tracking issue is made. * On 2019-06-12, a partial implementation was completed. The implementation was done in [#60669][60669] by @c410-f3r and the PR was reviewed by @petrochenkov and @Centril. * On 2019-07-29, [#61238][61238] was fixed in [#61856][61856]. The issue fixed was that lint attributes on function args had no effect. The PR was written by @c410-f3r and reviewed by @matthewjasper, @petrochenkov, and @oli-obk. * On 2019-08-02, a bug [#63210][63210] was filed wherein the attributes on formal parameters would not be passed to macros. The issue was about forgetting to call the relevant method in `fn print_arg` in the pretty printer. In [#63212][63212], written by @Centril on 2019-08-02 and reviewed by @davidtwco, the issue aforementioned was fixed. * This PR stabilizes `param_attrs`. ## Tests * [On Rust 2018, attributes aren't permitted on function parameters without a pattern in trait definitions.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-2018.rs) * [All attributes that should be allowed. This includes `cfg`, `cfg_attr`, and lints check attributes.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-allowed.rs) * [Built-in attributes, which should be forbidden, e.g., `#[test]`, are.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs) * [`cfg` and `cfg_attr` are properly evaluated.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.rs) * [`unused_mut`](https://github.com/rust-lang/rust/blob/46f405ec4d7c6bf16fc2eaafe7541019f1da2996/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.rs) and [`unused_variables`](https://github.com/rust-lang/rust/blob/master/src/test/ui/lint/lint-unused-variables.rs) are correctly applied to parameter patterns. * [Pretty printing takes formal parameter attributes into account.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-pretty.rs) ## Possible future work * Custom attributes inside function parameters aren't currently supported but it is something being worked on internally. * Since documentation comments are syntactic sugar for `#[doc(...)]`, it is possible to allow literal `/// Foo` comments on function parameters. [rfc motivation]: https://github.com/rust-lang/rfcs/blob/master/text/2565-formal-function-parameter-attributes.md#motivation [rfc]: https://github.com/rust-lang/rfcs/pull/2565 [60669]: https://github.com/rust-lang/rust/pull/60669 [61856]: https://github.com/rust-lang/rust/pull/61856 [63210]: https://github.com/rust-lang/rust/issues/63210 [61238]: https://github.com/rust-lang/rust/issues/61238 [63212]: https://github.com/rust-lang/rust/pull/63212 This report is a collaborative work with @Centril.
2019-09-14feature_gate: Eliminate `check::Context`Vadim Petrochenkov-59/+51
Use `PostExpansionVisitor` directly instead
2019-09-14feature_gate: Merge various attribute gating functionsVadim Petrochenkov-82/+40
2019-09-14feature_gate: Remove dead code from attribute checkingVadim Petrochenkov-42/+8
Same checks are performed during name resolution, and all attributes go through name resolution now
2019-09-11Stabilize `param_attrs` in Rust 1.39.0Caio-1/+0
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: libsyntaxAlexander Regueiro-2/+2
2019-08-25Refactor feature gate checking codePascal Hertleif-18/+22
Tries to clarify the filtering of active features and make the code more expressive.