Skip to content

Commit 5056a43

Browse files
committed
Stabilize Self and associated types in struct expressions and patterns
1 parent 249b444 commit 5056a43

8 files changed

+2
-55
lines changed

src/librustc_typeck/check/mod.rs

-10
Original file line numberDiff line numberDiff line change
@@ -3328,16 +3328,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
33283328
}
33293329
Def::Struct(..) | Def::Union(..) | Def::TyAlias(..) |
33303330
Def::AssociatedTy(..) | Def::SelfTy(..) => {
3331-
match def {
3332-
Def::AssociatedTy(..) | Def::SelfTy(..)
3333-
if !self.tcx.sess.features.borrow().more_struct_aliases => {
3334-
emit_feature_err(&self.tcx.sess.parse_sess,
3335-
"more_struct_aliases", path_span, GateIssue::Language,
3336-
"`Self` and associated types in struct \
3337-
expressions and patterns are unstable");
3338-
}
3339-
_ => {}
3340-
}
33413331
match ty.sty {
33423332
ty::TyAdt(adt, substs) if !adt.is_enum() => {
33433333
Some((adt.struct_variant(), adt.did, substs))

src/libsyntax/feature_gate.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,6 @@ declare_features! (
295295
// The #![windows_subsystem] attribute
296296
(active, windows_subsystem, "1.14.0", Some(37499)),
297297

298-
// Allows using `Self` and associated types in struct expressions and patterns.
299-
(active, more_struct_aliases, "1.14.0", Some(37544)),
300-
301-
302298
// Allows #[link(..., cfg(..))]
303299
(active, link_cfg, "1.14.0", Some(37406)),
304300

@@ -378,6 +374,8 @@ declare_features! (
378374
// Allows `..` in tuple (struct) patterns
379375
(accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)),
380376
(accepted, item_like_imports, "1.14.0", Some(35120)),
377+
// Allows using `Self` and associated types in struct expressions and patterns.
378+
(accepted, more_struct_aliases, "1.14.0", Some(37544)),
381379
);
382380
// (changing above list without updating src/doc/reference.md makes @cmr sad)
383381

src/test/compile-fail/struct-path-associated-type.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(more_struct_aliases)]
12-
1311
struct S;
1412

1513
trait Tr {

src/test/compile-fail/struct-path-self-feature-gate.rs

-31
This file was deleted.

src/test/compile-fail/struct-path-self-type-mismatch.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(more_struct_aliases)]
12-
1311
struct Foo<A> { inner: A }
1412

1513
trait Bar { fn bar(); }

src/test/compile-fail/struct-path-self.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(more_struct_aliases)]
12-
1311
struct S;
1412

1513
trait Tr {

src/test/run-pass/struct-path-associated-type.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(more_struct_aliases)]
12-
1311
struct S<T, U = u16> {
1412
a: T,
1513
b: U,

src/test/run-pass/struct-path-self.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(more_struct_aliases)]
12-
1311
use std::ops::Add;
1412

1513
struct S<T, U = u16> {

0 commit comments

Comments
 (0)