Skip to content

Commit 299d696

Browse files
committed
Stabilize param_attrs in Rust 1.39.0
1 parent 34e82a7 commit 299d696

23 files changed

+93
-204
lines changed

src/doc/unstable-book/src/language-features/param-attrs.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/libsyntax/feature_gate/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ declare_features! (
243243
(accepted, async_await, "1.39.0", Some(50547), None),
244244
/// Allows mixing bind-by-move in patterns and references to those identifiers in guards.
245245
(accepted, bind_by_move_pattern_guards, "1.39.0", Some(15287), None),
246+
/// Allows attributes in formal function parameters.
247+
(accepted, param_attrs, "1.39.0", Some(60406), None),
246248

247249
// -------------------------------------------------------------------------
248250
// feature-group-end: accepted features

src/libsyntax/feature_gate/active.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,6 @@ declare_features! (
489489
/// Allows the user of associated type bounds.
490490
(active, associated_type_bounds, "1.34.0", Some(52662), None),
491491

492-
/// Attributes on formal function params.
493-
(active, param_attrs, "1.36.0", Some(60406), None),
494-
495492
/// Allows calling constructor functions in `const fn`.
496493
(active, const_constructor, "1.37.0", Some(61456), None),
497494

src/libsyntax/feature_gate/check.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,6 @@ pub fn check_crate(krate: &ast::Crate,
892892
}
893893
}
894894

895-
gate_all!(param_attrs, "attributes on function parameters are unstable");
896895
gate_all!(let_chains, "`let` expressions in this position are experimental");
897896
gate_all!(async_closure, "async closures are unstable");
898897
gate_all!(yields, generators, "yield syntax is experimental");

src/libsyntax/parse/attr.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@ const DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG: &str = "an inner attribute is not \
1919
permitted in this context";
2020

2121
impl<'a> Parser<'a> {
22-
crate fn parse_param_attributes(&mut self) -> PResult<'a, Vec<ast::Attribute>> {
23-
let attrs = self.parse_outer_attributes()?;
24-
self.sess.gated_spans.param_attrs.borrow_mut()
25-
.extend(attrs.iter().map(|a| a.span));
26-
Ok(attrs)
27-
}
28-
2922
/// Parses attributes that appear before an item.
3023
crate fn parse_outer_attributes(&mut self) -> PResult<'a, Vec<ast::Attribute>> {
3124
let mut attrs: Vec<ast::Attribute> = Vec::new();

src/libsyntax/parse/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ pub type PResult<'a, T> = Result<T, DiagnosticBuilder<'a>>;
4242
/// used and should be feature gated accordingly in `check_crate`.
4343
#[derive(Default)]
4444
pub struct GatedSpans {
45-
/// Spans collected for gating `param_attrs`, e.g. `fn foo(#[attr] x: u8) {}`.
46-
pub param_attrs: Lock<Vec<Span>>,
4745
/// Spans collected for gating `let_chains`, e.g. `if a && let b = c {}`.
4846
pub let_chains: Lock<Vec<Span>>,
4947
/// Spans collected for gating `async_closure`, e.g. `async || ..`.

src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ impl<'a> Parser<'a> {
979979
is_name_required: impl Fn(&token::Token) -> bool,
980980
) -> PResult<'a, Param> {
981981
let lo = self.token.span;
982-
let attrs = self.parse_param_attributes()?;
982+
let attrs = self.parse_outer_attributes()?;
983983
if let Some(mut param) = self.parse_self_param()? {
984984
param.attrs = attrs.into();
985985
return self.recover_bad_self_param(param, is_trait_item);
@@ -1362,7 +1362,7 @@ impl<'a> Parser<'a> {
13621362
/// Returns the parsed optional self parameter with attributes and whether a self
13631363
/// shortcut was used.
13641364
fn parse_self_parameter_with_attrs(&mut self) -> PResult<'a, Option<Param>> {
1365-
let attrs = self.parse_param_attributes()?;
1365+
let attrs = self.parse_outer_attributes()?;
13661366
let param_opt = self.parse_self_param()?;
13671367
Ok(param_opt.map(|mut param| {
13681368
param.attrs = attrs.into();

src/libsyntax/parse/parser/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ impl<'a> Parser<'a> {
11761176
/// Parses a parameter in a closure header (e.g., `|arg, arg|`).
11771177
fn parse_fn_block_param(&mut self) -> PResult<'a, Param> {
11781178
let lo = self.token.span;
1179-
let attrs = self.parse_param_attributes()?;
1179+
let attrs = self.parse_outer_attributes()?;
11801180
let pat = self.parse_pat(PARAM_EXPECTED)?;
11811181
let t = if self.eat(&token::Colon) {
11821182
self.parse_ty()?

src/test/ui/lint/lint-unused-mut-variables.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Exercise the unused_mut attribute in some positive and negative cases
44

55
#![deny(unused_mut)]
6-
#![feature(async_closure, param_attrs)]
6+
#![feature(async_closure)]
77

88
async fn baz_async(
99
mut a: i32,

src/test/ui/lint/lint-unused-variables.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// compile-flags: --cfg something
22
// edition:2018
33

4-
#![feature(async_closure, param_attrs)]
4+
#![feature(async_closure)]
55
#![deny(unused_variables)]
66

77
async fn foo_async(

0 commit comments

Comments
 (0)