about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate
AgeCommit message (Collapse)AuthorLines
2019-10-13Rollup merge of #65214 - Amanieu:cfg_atomic, r=alexcrichtonMazdak Farrokhzad-0/+1
Split non-CAS atomic support off into target_has_atomic_load_store This PR implements my proposed changes in https://github.com/rust-lang/rust/issues/32976#issuecomment-518542029 by removing `target_has_atomic = "cas"` and splitting `target_has_atomic` into two separate `cfg`s: * `target_has_atomic = 8/16/32/64/128`: This indicates the largest width that the target can atomically CAS (which implies support for all atomic operations). * ` target_has_atomic_load_store = 8/16/32/64/128`: This indicates the largest width that the target can support loading or storing atomically (but may not support CAS). cc #32976 r? @alexcrichton
2019-10-13simplify maybe_stage_featuresMazdak Farrokhzad-14/+8
2019-10-08Split non-CAS atomic support off into target_has_atomic_load_storeAmanieu d'Antras-0/+1
2019-10-07Mark #![feature(track_caller)] as incomplete.Adam Perry-0/+1
2019-10-07track_caller feature gate starts in 1.40.0.Adam Perry-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-10-07track_caller run-pass test, lint cleanup, PR review.Adam Perry-5/+2
2019-10-07[RFC 2091] Add #[track_caller] attribute.Ayose-0/+7
- The attribute is behind a feature gate. - Error if both #[naked] and #[track_caller] are applied to the same function. - Error if #[track_caller] is applied to a non-function item. - Error if ABI is not "rust" - Error if #[track_caller] is applied to a trait function. Error codes and descriptions are pending.
2019-10-07Fix compilation error after rebase.Charles Lew-1/+1
2019-10-07Address review comments.Charles Lew-4/+3
2019-10-07Add feature gate for raw_dylib.Charles Lew-1/+10
2019-10-07Auto merge of #64906 - Aaron1011:feature/extern-const-fn, r=Centrilbors-0/+4
Add support for `const unsafe? extern fn` This works just as you might expect - an `const extern fn` is a `const fn` that is callable from foreign code. Currently, panicking is not allowed in `const`s. When https://github.com/rust-lang/rfcs/pull/2345 (https://github.com/rust-lang/rust/issues/51999) is stabilized, then panicking in an `const extern 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. Tracking issue: https://github.com/rust-lang/rust/issues/64926.
2019-10-03plugin_registrary: use normal deprecation instead of hard coded warning.Mazdak Farrokhzad-6/+10
2019-10-03Deprecate `#![plugin]` and `#[plugin_registrar]`.Mazdak Farrokhzad-3/+12
2019-10-02Add support for 'extern const fn'Aaron Hill-0/+4
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-30Stabilize macros in `extern` blocksVadim Petrochenkov-3/+2
Add some tests for macros in extern blocks, remove duplicate tests
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-24add error message for caseAriel Ben-Yehuda-2/+1
2019-09-24reserve `impl<T> From<!> for T`Ariel Ben-Yehuda-0/+4
this is necessary for never-type stabilization
2019-09-21Rollup merge of #64010 - c410-f3r:stabilize-attrs-fn, r=CentrilMazdak Farrokhzad-4/+2
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-83/+43
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-4/+2
2019-09-08Stabilize bind_by_move_pattern_guards in 1.39.0.Mazdak Farrokhzad-3/+2
2019-09-07Rollup merge of #64226 - alexreg:rush-pr-3, r=centrilMazdak Farrokhzad-11/+13
Aggregation of cosmetic changes made during work on REPL PRs: libsyntax Factored out from hacking on rustc for work on the REPL. r? @Centril
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: libsyntaxAlexander Regueiro-11/+13
2019-09-05Remove rustc_diagnostic_macros featureMark Rousskov-6/+0
2019-09-05Restrict error code length to 80 columnsMark Rousskov-0/+5
The global restriction is 100, but since error codes are printed out via --explain we want to restrict them to just 80 columns.
2019-08-30Add a "diagnostic item" schemeOliver Scherer-0/+11
This allows lints and other diagnostics to refer to items by a unique ID instead of relying on whacky path resolution schemes that may break when items are relocated.
2019-08-25Refactor feature gate checking codePascal Hertleif-18/+22
Tries to clarify the filtering of active features and make the code more expressive.
2019-08-25Introduce and use `Feature` type for feature gatesPascal Hertleif-23/+98
This replaces the ad-hoc tuples used in the different feature gate files and unifies their content into a common type, leading to more readable matches and other good stuff that comes from having named fields. It also contains the description of each feature as extracted from the doc comment.
2019-08-24Use doc comments for feature gate descriptionsPascal Hertleif-261/+284
This is just in preparation for future usage of these texts.
2019-08-23syntax: move `feature_gate.rs`.Mazdak Farrokhzad-0/+31
2019-08-23syntax: extract `check.rs`.Mazdak Farrokhzad-2/+953
2019-08-23builtin_attrs.rs: retain FIXMEs.Mazdak Farrokhzad-2/+6
2019-08-23builtin_attrs.rs: organize!Mazdak Farrokhzad-241/+259
2019-08-23builtin_attrs.rs: cleanup with `(un)gated!`.Mazdak Farrokhzad-288/+229
2019-08-23builtin_attrs.rs: refactor `rustc_attrs` entries.Mazdak Farrokhzad-233/+109
2019-08-23builtin_attrs.rs: simplify `cfg_fn`.Mazdak Farrokhzad-8/+7
2019-08-23syntax: extract `builin_attrs.rs`.Mazdak Farrokhzad-1/+724
2019-08-23syntax: extract `active.rs` feature gates.Mazdak Farrokhzad-0/+522
2019-08-23syntax: extract `removed.rs` feature gates.Mazdak Farrokhzad-0/+83
2019-08-23syntax: extract `accepted.rs` feature gates.Mazdak Farrokhzad-0/+236