Skip to content

Commit

Permalink
Auto merge of #41145 - matthewjasper:stabilize-relaxed-adts, r=petroc…
Browse files Browse the repository at this point in the history
…henkov

Stabilize rfc 1506 - Clarified ADT Kinds

Closes #35626

Documentation:

- [ ] Reference rust-lang/reference#37
- [ ] Book?
- [ ] Rust by example?
  • Loading branch information
bors committed May 25, 2017
2 parents ffb0e2d + 6627ef2 commit d0811c9
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 60 deletions.
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 @@ -71,7 +71,6 @@
- [prelude_import](language-features/prelude-import.md)
- [proc_macro](language-features/proc-macro.md)
- [quote](language-features/quote.md)
- [relaxed_adts](language-features/relaxed-adts.md)
- [repr_align](language-features/repr-align.md)
- [repr_simd](language-features/repr-simd.md)
- [rustc_attrs](language-features/rustc-attrs.md)
Expand Down
10 changes: 0 additions & 10 deletions src/doc/unstable-book/src/language-features/relaxed-adts.md

This file was deleted.

28 changes: 3 additions & 25 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,6 @@ declare_features! (
// Allows `impl Trait` in function return types.
(active, conservative_impl_trait, "1.12.0", Some(34511)),

// Permits numeric fields in struct expressions and patterns.
(active, relaxed_adts, "1.12.0", Some(35626)),

// The `!` type
(active, never_type, "1.13.0", Some(35121)),

Expand Down Expand Up @@ -422,7 +419,10 @@ declare_features! (
(accepted, windows_subsystem, "1.18.0", Some(37499)),
// Allows `break {expr}` with a value inside `loop`s.
(accepted, loop_break_value, "1.19.0", Some(37339)),
// Permits numeric fields in struct expressions and patterns.
(accepted, relaxed_adts, "1.19.0", Some(35626)),
);

// If you change this, please modify src/doc/unstable-book as well. You must
// move that documentation into the relevant place in the other docs, and
// remove the chapter on the flag.
Expand Down Expand Up @@ -1104,10 +1104,6 @@ fn contains_novel_literal(item: &ast::MetaItem) -> bool {
}
}

fn starts_with_digit(s: &str) -> bool {
s.as_bytes().first().cloned().map_or(false, |b| b >= b'0' && b <= b'9')
}

impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
fn visit_attribute(&mut self, attr: &ast::Attribute) {
if !attr.span.allows_unstable() {
Expand Down Expand Up @@ -1291,15 +1287,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
ast::ExprKind::InPlace(..) => {
gate_feature_post!(&self, placement_in_syntax, e.span, EXPLAIN_PLACEMENT_IN);
}
ast::ExprKind::Struct(_, ref fields, _) => {
for field in fields {
if starts_with_digit(&field.ident.node.name.as_str()) {
gate_feature_post!(&self, relaxed_adts,
field.span,
"numeric fields in struct expressions are unstable");
}
}
}
ast::ExprKind::Lit(ref lit) => {
if let ast::LitKind::Int(_, ref ty) = lit.node {
match *ty {
Expand Down Expand Up @@ -1339,15 +1326,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
pattern.span,
"box pattern syntax is experimental");
}
PatKind::Struct(_, ref fields, _) => {
for field in fields {
if starts_with_digit(&field.node.ident.name.as_str()) {
gate_feature_post!(&self, relaxed_adts,
field.span,
"numeric fields in struct patterns are unstable");
}
}
}
PatKind::Range(_, _, RangeEnd::Excluded) => {
gate_feature_post!(&self, exclusive_range_pattern, pattern.span,
"exclusive range pattern syntax is experimental");
Expand Down
20 changes: 0 additions & 20 deletions src/test/compile-fail/numeric-fields-feature-gate.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/test/compile-fail/numeric-fields.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(relaxed_adts)]

struct S(u8, u16);

fn main() {
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/numeric-fields.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(relaxed_adts)]

struct S(u8, u16);

fn main() {
Expand Down

0 comments on commit d0811c9

Please sign in to comment.