From 3b4fe7ef37c3ff2afcfda8577f010d3fe926bde5 Mon Sep 17 00:00:00 2001 From: Alexey Shmalko Date: Wed, 1 May 2019 22:42:57 +0300 Subject: Group and sort feature_gate.rs --- src/libsyntax/feature_gate.rs | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 012fcbdd8c8..2a1f3c48014 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -109,15 +109,14 @@ macro_rules! declare_features { // stable (active). // // Note that the features should be grouped into internal/user-facing -// and then sorted by version inside those groups. -// FIXME(60361): Enforce ^-- with tidy. +// and then sorted by version inside those groups. This is inforced with tidy. // // N.B., `tools/tidy/src/features.rs` parses this information directly out of the // source, so take care when modifying it. declare_features! ( // ------------------------------------------------------------------------- - // Internal feature gates. + // feature-group-start: internal feature gates // ------------------------------------------------------------------------- // no tracking issue START @@ -211,12 +210,12 @@ declare_features! ( // no tracking issue END - // Allows using the `may_dangle` attribute (RFC 1327). - (active, dropck_eyepatch, "1.10.0", Some(34761), None), - // Allows using `#[structural_match]` which indicates that a type is structurally matchable. (active, structural_match, "1.8.0", Some(31434), None), + // Allows using the `may_dangle` attribute (RFC 1327). + (active, dropck_eyepatch, "1.10.0", Some(34761), None), + // Allows using the `#![panic_runtime]` attribute. (active, panic_runtime, "1.10.0", Some(32837), None), @@ -252,7 +251,11 @@ declare_features! ( (active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)), // ------------------------------------------------------------------------- - // Actual feature gates (target features). + // feature-group-end: internal feature gates + // ------------------------------------------------------------------------- + + // ------------------------------------------------------------------------- + // feature-group-start: actual feature gates (target features) // ------------------------------------------------------------------------- // FIXME: Document these and merge with the list below. @@ -275,7 +278,11 @@ declare_features! ( (active, f16c_target_feature, "1.36.0", Some(44839), None), // ------------------------------------------------------------------------- - // Actual feature gates. + // feature-group-end: actual feature gates (target features) + // ------------------------------------------------------------------------- + + // ------------------------------------------------------------------------- + // feature-group-start: actual feature gates // ------------------------------------------------------------------------- // Allows using `asm!` macro with which inline assembly can be embedded. @@ -340,9 +347,6 @@ declare_features! ( // Permits specifying whether a function should permit unwinding or abort on unwind. (active, unwind_attributes, "1.4.0", Some(58760), None), - // Allows using `#[naked]` on functions. - (active, naked_functions, "1.9.0", Some(32408), None), - // Allows `#[no_debug]`. (active, no_debug, "1.5.0", Some(29721), None), @@ -358,6 +362,9 @@ declare_features! ( // Allows specialization of implementations (RFC 1210). (active, specialization, "1.7.0", Some(31844), None), + // Allows using `#[naked]` on functions. + (active, naked_functions, "1.9.0", Some(32408), None), + // Allows `cfg(target_has_atomic = "...")`. (active, cfg_target_has_atomic, "1.9.0", Some(32976), None), @@ -545,6 +552,10 @@ declare_features! ( // Allows using C-variadics. (active, c_variadic, "1.34.0", Some(44930), None), + + // ------------------------------------------------------------------------- + // feature-group-end: actual feature gates + // ------------------------------------------------------------------------- ); // Some features are known to be incomplete and using them is likely to have -- cgit 1.4.1-3-g733a5 From 2fe50bc01bf9023b64a72407bb41a1f3b7245abd Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 3 May 2019 13:04:26 +0900 Subject: Propagate mutability from arguments to local bindings in async fn --- src/libsyntax/parse/parser.rs | 10 ++++------ src/test/ui/async-await/mutable-arguments.rs | 10 ++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 src/test/ui/async-await/mutable-arguments.rs (limited to 'src/libsyntax') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f70acb3e7da..c5173aa5569 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -8725,9 +8725,9 @@ impl<'a> Parser<'a> { // Check if this is a ident pattern, if so, we can optimize and avoid adding a // `let = __argN;` statement, instead just adding a `let = ;` // statement. - let (ident, is_simple_pattern) = match input.pat.node { - PatKind::Ident(_, ident, _) => (ident, true), - _ => (ident, false), + let (binding_mode, ident, is_simple_pattern) = match input.pat.node { + PatKind::Ident(binding_mode, ident, _) => (binding_mode, ident, true), + _ => (BindingMode::ByValue(Mutability::Immutable), ident, false), }; // Construct an argument representing `__argN: ` to replace the argument of the @@ -8755,9 +8755,7 @@ impl<'a> Parser<'a> { let move_local = Local { pat: P(Pat { id, - node: PatKind::Ident( - BindingMode::ByValue(Mutability::Immutable), ident, None, - ), + node: PatKind::Ident(binding_mode, ident, None), span, }), // We explicitly do not specify the type for this statement. When the user's diff --git a/src/test/ui/async-await/mutable-arguments.rs b/src/test/ui/async-await/mutable-arguments.rs new file mode 100644 index 00000000000..4d6dba74097 --- /dev/null +++ b/src/test/ui/async-await/mutable-arguments.rs @@ -0,0 +1,10 @@ +// edition:2018 +// run-pass + +#![feature(async_await)] + +async fn foo(n: u32, mut vec: Vec) { + vec.push(n); +} + +fn main() {} -- cgit 1.4.1-3-g733a5