Skip to content

Commit d49a8d5

Browse files
author
Alexander Regueiro
committed
Removed feature gate.
1 parent 5f19cdc commit d49a8d5

11 files changed

+7
-138
lines changed

src/doc/unstable-book/src/language-features/self-struct-ctor.md

-33
This file was deleted.

src/librustc/hir/lowering.rs

-16
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ use syntax::ast;
6767
use syntax::ast::*;
6868
use syntax::errors;
6969
use syntax::ext::hygiene::{Mark, SyntaxContext};
70-
use syntax::feature_gate::{emit_feature_err, GateIssue};
7170
use syntax::print::pprust;
7271
use syntax::ptr::P;
7372
use syntax::source_map::{self, respan, CompilerDesugaringKind, Spanned};
@@ -3628,7 +3627,6 @@ impl<'a> LoweringContext<'a> {
36283627
ParamMode::Optional,
36293628
ImplTraitContext::disallowed(),
36303629
);
3631-
self.check_self_struct_ctor_feature(&qpath);
36323630
hir::PatKind::TupleStruct(
36333631
qpath,
36343632
pats.iter().map(|x| self.lower_pat(x)).collect(),
@@ -3643,7 +3641,6 @@ impl<'a> LoweringContext<'a> {
36433641
ParamMode::Optional,
36443642
ImplTraitContext::disallowed(),
36453643
);
3646-
self.check_self_struct_ctor_feature(&qpath);
36473644
hir::PatKind::Path(qpath)
36483645
}
36493646
PatKind::Struct(ref path, ref fields, etc) => {
@@ -4039,7 +4036,6 @@ impl<'a> LoweringContext<'a> {
40394036
ParamMode::Optional,
40404037
ImplTraitContext::disallowed(),
40414038
);
4042-
self.check_self_struct_ctor_feature(&qpath);
40434039
hir::ExprKind::Path(qpath)
40444040
}
40454041
ExprKind::Break(opt_label, ref opt_expr) => {
@@ -5102,18 +5098,6 @@ impl<'a> LoweringContext<'a> {
51025098
ThinVec::new()));
51035099
P(self.expr_call(e.span, from_err, hir_vec![e]))
51045100
}
5105-
5106-
fn check_self_struct_ctor_feature(&self, qp: &hir::QPath) {
5107-
if let hir::QPath::Resolved(_, ref p) = qp {
5108-
if p.segments.len() == 1 &&
5109-
p.segments[0].ident.name == keywords::SelfType.name() &&
5110-
!self.sess.features_untracked().self_struct_ctor {
5111-
emit_feature_err(&self.sess.parse_sess, "self_struct_ctor",
5112-
p.span, GateIssue::Language,
5113-
"`Self` struct constructors are unstable");
5114-
}
5115-
}
5116-
}
51175101
}
51185102

51195103
fn body_ids(bodies: &BTreeMap<hir::BodyId, hir::Body>) -> Vec<hir::BodyId> {

src/libsyntax/feature_gate.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,6 @@ declare_features! (
475475
// Non-builtin attributes in inner attribute position
476476
(active, custom_inner_attributes, "1.30.0", Some(54726), None),
477477

478-
// Self struct constructor (RFC 2302)
479-
(active, self_struct_ctor, "1.30.0", Some(51994), None),
480-
481478
// allow mixing of bind-by-move in patterns and references to
482479
// those identifiers in guards, *if* we are using MIR-borrowck
483480
// (aka NLL). Essentially this means you need to be on
@@ -688,9 +685,11 @@ declare_features! (
688685
(accepted, macro_literal_matcher, "1.31.0", Some(35625), None),
689686
// Use `?` as the Kleene "at most one" operator
690687
(accepted, macro_at_most_once_rep, "1.32.0", Some(48075), None),
688+
// Self struct constructor (RFC 2302)
689+
(accepted, self_struct_ctor, "1.32.0", Some(51994), None),
691690
);
692691

693-
// If you change this, please modify src/doc/unstable-book as well. You must
692+
// If you change this, please modify `src/doc/unstable-book` as well. You must
694693
// move that documentation into the relevant place in the other docs, and
695694
// remove the chapter on the flag.
696695

src/test/run-pass/rfcs/rfc-2302-self-struct-ctor.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// run-pass
22

3-
#![feature(self_struct_ctor)]
4-
53
#![allow(dead_code)]
64

75
use std::fmt::Display;

src/test/ui/feature-gates/feature-gate-self-struct-ctor.rs

-22
This file was deleted.

src/test/ui/feature-gates/feature-gate-self-struct-ctor.stderr

-19
This file was deleted.

src/test/ui/issues/issue-56202.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// compile-pass
22

3-
#![feature(self_struct_ctor)]
4-
53
trait FooTrait {}
64

75
trait BarTrait {

src/test/ui/keyword/keyword-self-as-identifier.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@
1010

1111
fn main() {
1212
let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope
13-
//~^ ERROR `Self` struct constructors are unstable (see issue #51994)
1413
}

src/test/ui/keyword/keyword-self-as-identifier.stderr

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@ error[E0531]: cannot find unit struct/variant or constant `Self` in this scope
44
LL | let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope
55
| ^^^^ not found in this scope
66

7-
error[E0658]: `Self` struct constructors are unstable (see issue #51994)
8-
--> $DIR/keyword-self-as-identifier.rs:12:9
9-
|
10-
LL | let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope
11-
| ^^^^
12-
|
13-
= help: add #![feature(self_struct_ctor)] to the crate attributes to enable
14-
15-
error: aborting due to 2 previous errors
7+
error: aborting due to 1 previous error
168

179
Some errors occurred: E0531, E0658.
1810
For more information about an error, try `rustc --explain E0531`.

src/test/ui/self/self_type_keyword-2.rs

-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ use self::Self as Foo; //~ ERROR unresolved import `self::Self`
1313
pub fn main() {
1414
let Self = 5;
1515
//~^ ERROR cannot find unit struct/variant or constant `Self` in this scope
16-
//~^^ ERROR `Self` struct constructors are unstable (see issue #51994)
1716

1817
match 15 {
1918
Self => (),
2019
//~^ ERROR cannot find unit struct/variant or constant `Self` in this scope
21-
//~^^ ERROR `Self` struct constructors are unstable (see issue #51994)
2220
Foo { x: Self } => (),
2321
//~^ ERROR cannot find unit struct/variant or constant `Self` in this scope
24-
//~^^ ERROR `Self` struct constructors are unstable (see issue #51994)
2522
}
2623
}

src/test/ui/self/self_type_keyword-2.stderr

+3-27
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,18 @@ LL | let Self = 5;
1111
| ^^^^ not found in this scope
1212

1313
error[E0531]: cannot find unit struct/variant or constant `Self` in this scope
14-
--> $DIR/self_type_keyword-2.rs:19:9
14+
--> $DIR/self_type_keyword-2.rs:18:9
1515
|
1616
LL | Self => (),
1717
| ^^^^ not found in this scope
1818

1919
error[E0531]: cannot find unit struct/variant or constant `Self` in this scope
20-
--> $DIR/self_type_keyword-2.rs:22:18
20+
--> $DIR/self_type_keyword-2.rs:20:18
2121
|
2222
LL | Foo { x: Self } => (),
2323
| ^^^^ not found in this scope
2424

25-
error[E0658]: `Self` struct constructors are unstable (see issue #51994)
26-
--> $DIR/self_type_keyword-2.rs:14:9
27-
|
28-
LL | let Self = 5;
29-
| ^^^^
30-
|
31-
= help: add #![feature(self_struct_ctor)] to the crate attributes to enable
32-
33-
error[E0658]: `Self` struct constructors are unstable (see issue #51994)
34-
--> $DIR/self_type_keyword-2.rs:19:9
35-
|
36-
LL | Self => (),
37-
| ^^^^
38-
|
39-
= help: add #![feature(self_struct_ctor)] to the crate attributes to enable
40-
41-
error[E0658]: `Self` struct constructors are unstable (see issue #51994)
42-
--> $DIR/self_type_keyword-2.rs:22:18
43-
|
44-
LL | Foo { x: Self } => (),
45-
| ^^^^
46-
|
47-
= help: add #![feature(self_struct_ctor)] to the crate attributes to enable
48-
49-
error: aborting due to 7 previous errors
25+
error: aborting due to 4 previous errors
5026

5127
Some errors occurred: E0432, E0531, E0658.
5228
For more information about an error, try `rustc --explain E0432`.

0 commit comments

Comments
 (0)