Skip to content

Commit d0811c9

Browse files
committed
Auto merge of #41145 - matthewjasper:stabilize-relaxed-adts, r=petrochenkov
Stabilize rfc 1506 - Clarified ADT Kinds Closes #35626 Documentation: - [ ] Reference rust-lang/reference#37 - [ ] Book? - [ ] Rust by example?
2 parents ffb0e2d + 6627ef2 commit d0811c9

File tree

6 files changed

+3
-60
lines changed

6 files changed

+3
-60
lines changed

src/doc/unstable-book/src/SUMMARY.md

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
- [prelude_import](language-features/prelude-import.md)
7272
- [proc_macro](language-features/proc-macro.md)
7373
- [quote](language-features/quote.md)
74-
- [relaxed_adts](language-features/relaxed-adts.md)
7574
- [repr_align](language-features/repr-align.md)
7675
- [repr_simd](language-features/repr-simd.md)
7776
- [rustc_attrs](language-features/rustc-attrs.md)

src/doc/unstable-book/src/language-features/relaxed-adts.md

-10
This file was deleted.

src/libsyntax/feature_gate.rs

+3-25
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,6 @@ declare_features! (
269269
// Allows `impl Trait` in function return types.
270270
(active, conservative_impl_trait, "1.12.0", Some(34511)),
271271

272-
// Permits numeric fields in struct expressions and patterns.
273-
(active, relaxed_adts, "1.12.0", Some(35626)),
274-
275272
// The `!` type
276273
(active, never_type, "1.13.0", Some(35121)),
277274

@@ -422,7 +419,10 @@ declare_features! (
422419
(accepted, windows_subsystem, "1.18.0", Some(37499)),
423420
// Allows `break {expr}` with a value inside `loop`s.
424421
(accepted, loop_break_value, "1.19.0", Some(37339)),
422+
// Permits numeric fields in struct expressions and patterns.
423+
(accepted, relaxed_adts, "1.19.0", Some(35626)),
425424
);
425+
426426
// If you change this, please modify src/doc/unstable-book as well. You must
427427
// move that documentation into the relevant place in the other docs, and
428428
// remove the chapter on the flag.
@@ -1104,10 +1104,6 @@ fn contains_novel_literal(item: &ast::MetaItem) -> bool {
11041104
}
11051105
}
11061106

1107-
fn starts_with_digit(s: &str) -> bool {
1108-
s.as_bytes().first().cloned().map_or(false, |b| b >= b'0' && b <= b'9')
1109-
}
1110-
11111107
impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
11121108
fn visit_attribute(&mut self, attr: &ast::Attribute) {
11131109
if !attr.span.allows_unstable() {
@@ -1291,15 +1287,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
12911287
ast::ExprKind::InPlace(..) => {
12921288
gate_feature_post!(&self, placement_in_syntax, e.span, EXPLAIN_PLACEMENT_IN);
12931289
}
1294-
ast::ExprKind::Struct(_, ref fields, _) => {
1295-
for field in fields {
1296-
if starts_with_digit(&field.ident.node.name.as_str()) {
1297-
gate_feature_post!(&self, relaxed_adts,
1298-
field.span,
1299-
"numeric fields in struct expressions are unstable");
1300-
}
1301-
}
1302-
}
13031290
ast::ExprKind::Lit(ref lit) => {
13041291
if let ast::LitKind::Int(_, ref ty) = lit.node {
13051292
match *ty {
@@ -1339,15 +1326,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
13391326
pattern.span,
13401327
"box pattern syntax is experimental");
13411328
}
1342-
PatKind::Struct(_, ref fields, _) => {
1343-
for field in fields {
1344-
if starts_with_digit(&field.node.ident.name.as_str()) {
1345-
gate_feature_post!(&self, relaxed_adts,
1346-
field.span,
1347-
"numeric fields in struct patterns are unstable");
1348-
}
1349-
}
1350-
}
13511329
PatKind::Range(_, _, RangeEnd::Excluded) => {
13521330
gate_feature_post!(&self, exclusive_range_pattern, pattern.span,
13531331
"exclusive range pattern syntax is experimental");

src/test/compile-fail/numeric-fields-feature-gate.rs

-20
This file was deleted.

src/test/compile-fail/numeric-fields.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(relaxed_adts)]
12-
1311
struct S(u8, u16);
1412

1513
fn main() {

src/test/run-pass/numeric-fields.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(relaxed_adts)]
12-
1311
struct S(u8, u16);
1412

1513
fn main() {

0 commit comments

Comments
 (0)