Skip to content

Commit ee055a1

Browse files
committed
Stabilize type-macros
Closes #27245
1 parent eaf71f8 commit ee055a1

14 files changed

+9
-54
lines changed

src/libsyntax/ext/expand.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -491,18 +491,7 @@ fn expand_trait_item(ti: ast::TraitItem, fld: &mut MacroExpander)
491491
pub fn expand_type(t: P<ast::Ty>, fld: &mut MacroExpander) -> P<ast::Ty> {
492492
let t = match t.node.clone() {
493493
ast::TyKind::Mac(mac) => {
494-
if fld.cx.ecfg.features.unwrap().type_macros {
495-
expand_mac_invoc(mac, None, Vec::new(), t.span, fld)
496-
} else {
497-
feature_gate::emit_feature_err(
498-
&fld.cx.parse_sess.span_diagnostic,
499-
"type_macros",
500-
t.span,
501-
feature_gate::GateIssue::Language,
502-
"type macros are experimental");
503-
504-
DummyResult::raw_ty(t.span)
505-
}
494+
expand_mac_invoc(mac, None, Vec::new(), t.span, fld)
506495
}
507496
_ => t
508497
};

src/libsyntax/feature_gate.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,6 @@ declare_features! (
213213
// Allows associated type defaults
214214
(active, associated_type_defaults, "1.2.0", Some(29661)),
215215

216-
// Allows macros to appear in the type position.
217-
(active, type_macros, "1.3.0", Some(27245)),
218-
219216
// allow `repr(simd)`, and importing the various simd intrinsics
220217
(active, repr_simd, "1.4.0", Some(27731)),
221218

@@ -321,6 +318,8 @@ declare_features! (
321318
// mean anything
322319
(accepted, test_accepted_feature, "1.0.0", None),
323320
(accepted, tuple_indexing, "1.0.0", None),
321+
// Allows macros to appear in the type position.
322+
(accepted, type_macros, "1.13.0", Some(27245)),
324323
(accepted, while_let, "1.0.0", None),
325324
// Allows `#[deprecated]` attribute
326325
(accepted, deprecated, "1.9.0", Some(29935))

src/test/compile-fail/issue-30007.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(type_macros)]
12-
1311
macro_rules! t {
1412
() => ( String ; ); //~ ERROR macro expansion ignores token `;`
1513
}

src/test/compile-fail/issue-32950.rs

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

11-
#![feature(type_macros, concat_idents)]
11+
#![feature(concat_idents)]
1212

1313
#[derive(Debug)] //~ NOTE in this expansion
1414
struct Baz<T>(

src/test/compile-fail/macro-context.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(type_macros)]
12-
1311
// (typeof used because it's surprisingly hard to find an unparsed token after a stmt)
1412
macro_rules! m {
1513
() => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof`

src/test/compile-fail/macro-error.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(type_macros)]
12-
1311
macro_rules! foo {
1412
($a:expr) => $a; //~ ERROR macro rhs must be delimited
1513
}

src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs

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

11-
#![feature(pub_restricted, type_macros)]
11+
#![feature(pub_restricted)]
1212

1313
mod foo {
1414
type T = ();

src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs

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

11-
#![feature(pub_restricted, type_macros)]
11+
#![feature(pub_restricted)]
1212

1313
macro_rules! define_struct {
1414
($t:ty) => {

src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs

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

11-
#![feature(pub_restricted, type_macros)]
11+
#![feature(pub_restricted)]
1212

1313
macro_rules! define_struct {
1414
($t:ty) => {

src/test/compile-fail/syntax-extension-minor.rs

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

11-
#![feature(concat_idents, type_macros)]
11+
#![feature(concat_idents)]
1212

1313
pub fn main() {
1414
struct Foo;

src/test/compile-fail/type-macros-fail.rs

-22
This file was deleted.

src/test/run-pass/simd-intrinsic-generic-cast.rs

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

11-
#![feature(repr_simd, platform_intrinsics, concat_idents,
12-
type_macros, test)]
11+
#![feature(repr_simd, platform_intrinsics, concat_idents, test)]
1312
#![allow(non_camel_case_types)]
1413

1514
extern crate test;

src/test/run-pass/type-macros-hlist.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(type_macros)]
12-
1311
use std::ops::*;
1412

1513
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]

src/test/run-pass/type-macros-simple.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(type_macros)]
12-
1311
macro_rules! Tuple {
1412
{ $A:ty,$B:ty } => { ($A, $B) }
1513
}

0 commit comments

Comments
 (0)