Skip to content

Remove struct_field_attributes feature gate #42656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
- [start](language-features/start.md)
- [static_nobundle](language-features/static-nobundle.md)
- [stmt_expr_attributes](language-features/stmt-expr-attributes.md)
- [struct_field_attributes](language-features/struct-field-attributes.md)
- [structural_match](language-features/structural-match.md)
- [target_feature](language-features/target-feature.md)
- [thread_local](language-features/thread-local.md)
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
#![feature(discriminant_value)]
#![feature(specialization)]
#![feature(manually_drop)]
#![feature(struct_field_attributes)]

#![cfg_attr(stage0, unstable(feature = "rustc_private", issue = "27812"))]
#![cfg_attr(stage0, feature(rustc_private))]
#![cfg_attr(stage0, feature(staged_api))]
#![cfg_attr(stage0, feature(struct_field_attributes))]

#![cfg_attr(unix, feature(libc))]
#![cfg_attr(test, feature(test))]
Expand Down
28 changes: 0 additions & 28 deletions src/libsyntax/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ impl<'a> StripUnconfigured<'a> {
ast::ExprKind::Struct(path, fields, base) => {
let fields = fields.into_iter()
.filter_map(|field| {
self.visit_struct_field_attrs(field.attrs());
self.configure(field)
})
.collect();
Expand Down Expand Up @@ -256,17 +255,6 @@ impl<'a> StripUnconfigured<'a> {
}

pub fn configure_struct_expr_field(&mut self, field: ast::Field) -> Option<ast::Field> {
if !self.features.map(|features| features.struct_field_attributes).unwrap_or(true) {
if !field.attrs.is_empty() {
let mut err = feature_err(self.sess,
"struct_field_attributes",
field.span,
GateIssue::Language,
"attributes on struct literal fields are unstable");
err.emit();
}
}

self.configure(field)
}

Expand All @@ -275,7 +263,6 @@ impl<'a> StripUnconfigured<'a> {
if let ast::PatKind::Struct(path, fields, etc) = pattern.node {
let fields = fields.into_iter()
.filter_map(|field| {
self.visit_struct_field_attrs(field.attrs());
self.configure(field)
})
.collect();
Expand All @@ -284,21 +271,6 @@ impl<'a> StripUnconfigured<'a> {
pattern
})
}

fn visit_struct_field_attrs(&mut self, attrs: &[ast::Attribute]) {
// flag the offending attributes
for attr in attrs.iter() {
if !self.features.map(|features| features.struct_field_attributes).unwrap_or(true) {
let mut err = feature_err(
self.sess,
"struct_field_attributes",
attr.span,
GateIssue::Language,
"attributes on struct pattern or literal fields are unstable");
err.emit();
}
}
}
}

impl<'a> fold::Folder for StripUnconfigured<'a> {
Expand Down
5 changes: 2 additions & 3 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,6 @@ declare_features! (
// Declarative macros 2.0 (`macro`).
(active, decl_macro, "1.17.0", Some(39412)),

// Allows attributes on struct literal fields.
(active, struct_field_attributes, "1.16.0", Some(38814)),

// Allows #[link(kind="static-nobundle"...]
(active, static_nobundle, "1.16.0", Some(37403)),

Expand Down Expand Up @@ -430,6 +427,8 @@ declare_features! (
(accepted, relaxed_adts, "1.19.0", Some(35626)),
// Coerces non capturing closures to function pointers
(accepted, closure_to_fn_coercion, "1.19.0", Some(39817)),
// Allows attributes on struct literal fields.
(accepted, struct_field_attributes, "1.20.0", Some(38814)),
);

// If you change this, please modify src/doc/unstable-book as well. You must
Expand Down
22 changes: 0 additions & 22 deletions src/test/compile-fail/struct-field-attr-feature-gate.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/test/compile-fail/struct-field-cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(struct_field_attributes)]

struct Foo {
present: (),
}
Expand Down