Skip to content

Commit 463affe

Browse files
committed
Auto merge of #39282 - petrochenkov:selfstab, r=nikomatsakis
Stabilize Self and associated types in struct expressions and patterns Rebase of #37734 Closes #37544 r? @nikomatsakis
2 parents 8367fb7 + 5056a43 commit 463affe

8 files changed

+2
-55
lines changed

src/librustc_typeck/check/mod.rs

-10
Original file line numberDiff line numberDiff line change
@@ -3306,16 +3306,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
33063306
}
33073307
Def::Struct(..) | Def::Union(..) | Def::TyAlias(..) |
33083308
Def::AssociatedTy(..) | Def::SelfTy(..) => {
3309-
match def {
3310-
Def::AssociatedTy(..) | Def::SelfTy(..)
3311-
if !self.tcx.sess.features.borrow().more_struct_aliases => {
3312-
emit_feature_err(&self.tcx.sess.parse_sess,
3313-
"more_struct_aliases", path_span, GateIssue::Language,
3314-
"`Self` and associated types in struct \
3315-
expressions and patterns are unstable");
3316-
}
3317-
_ => {}
3318-
}
33193309
match ty.sty {
33203310
ty::TyAdt(adt, substs) if !adt.is_enum() => {
33213311
Some((adt.struct_variant(), adt.did, substs))

src/libsyntax/feature_gate.rs

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

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

@@ -381,6 +377,8 @@ declare_features! (
381377
// Allows `..` in tuple (struct) patterns
382378
(accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)),
383379
(accepted, item_like_imports, "1.14.0", Some(35120)),
380+
// Allows using `Self` and associated types in struct expressions and patterns.
381+
(accepted, more_struct_aliases, "1.14.0", Some(37544)),
384382
);
385383
// (changing above list without updating src/doc/reference.md makes @cmr sad)
386384

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)