Skip to content
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

Stabilize Self and associated types in struct expressions and patterns #39282

Merged
merged 1 commit into from
Jan 27, 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
10 changes: 0 additions & 10 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3328,16 +3328,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}
Def::Struct(..) | Def::Union(..) | Def::TyAlias(..) |
Def::AssociatedTy(..) | Def::SelfTy(..) => {
match def {
Def::AssociatedTy(..) | Def::SelfTy(..)
if !self.tcx.sess.features.borrow().more_struct_aliases => {
emit_feature_err(&self.tcx.sess.parse_sess,
"more_struct_aliases", path_span, GateIssue::Language,
"`Self` and associated types in struct \
expressions and patterns are unstable");
}
_ => {}
}
match ty.sty {
ty::TyAdt(adt, substs) if !adt.is_enum() => {
Some((adt.struct_variant(), adt.did, substs))
Expand Down
6 changes: 2 additions & 4 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,6 @@ declare_features! (
// The #![windows_subsystem] attribute
(active, windows_subsystem, "1.14.0", Some(37499)),

// Allows using `Self` and associated types in struct expressions and patterns.
(active, more_struct_aliases, "1.14.0", Some(37544)),


// Allows #[link(..., cfg(..))]
(active, link_cfg, "1.14.0", Some(37406)),

Expand Down Expand Up @@ -378,6 +374,8 @@ declare_features! (
// Allows `..` in tuple (struct) patterns
(accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)),
(accepted, item_like_imports, "1.14.0", Some(35120)),
// Allows using `Self` and associated types in struct expressions and patterns.
(accepted, more_struct_aliases, "1.14.0", Some(37544)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great feature! does this version need to be updated (Should be 1.16, right)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know.
For active features it's the version in which it was implemented. What does this version mean exactly for accepted and removed features, something else?
I never cared to update it previously.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, let's see if anyone can say if there's a reason to update it. For library features it's neat to see it in the docs, I guess here it doesn't actually show anywhere?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this version mean exactly for accepted and removed features, something else?

Note the comment above the first declare_features! block: "The version numbers here correspond to the version in which the current status was set."

I guess here it doesn't actually show anywhere?

It is at least displayed in the message of the lint for #[feature]-gate attributes for already-stable features.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR: #39552

);
// (changing above list without updating src/doc/reference.md makes @cmr sad)

Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/struct-path-associated-type.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(more_struct_aliases)]

struct S;

trait Tr {
Expand Down
31 changes: 0 additions & 31 deletions src/test/compile-fail/struct-path-self-feature-gate.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/test/compile-fail/struct-path-self-type-mismatch.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(more_struct_aliases)]

struct Foo<A> { inner: A }

trait Bar { fn bar(); }
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/struct-path-self.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(more_struct_aliases)]

struct S;

trait Tr {
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/struct-path-associated-type.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(more_struct_aliases)]

struct S<T, U = u16> {
a: T,
b: U,
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/struct-path-self.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(more_struct_aliases)]

use std::ops::Add;

struct S<T, U = u16> {
Expand Down