]> git.lizzy.rs Git - rust.git/commitdiff
Stabilize type-macros
authorDaniele Baracchi <daniele.baracchi@gmail.com>
Wed, 24 Aug 2016 11:07:43 +0000 (13:07 +0200)
committerDaniele Baracchi <daniele.baracchi@gmail.com>
Fri, 26 Aug 2016 15:27:20 +0000 (17:27 +0200)
Closes #27245

14 files changed:
src/libsyntax/ext/expand.rs
src/libsyntax/feature_gate.rs
src/test/compile-fail/issue-30007.rs
src/test/compile-fail/issue-32950.rs
src/test/compile-fail/macro-context.rs
src/test/compile-fail/macro-error.rs
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs
src/test/compile-fail/syntax-extension-minor.rs
src/test/compile-fail/type-macros-fail.rs [deleted file]
src/test/run-pass/simd-intrinsic-generic-cast.rs
src/test/run-pass/type-macros-hlist.rs
src/test/run-pass/type-macros-simple.rs

index 031d9a2d3f46e781debb012b0325b787345ddcfb..26599208ec0091270f6f18767541ae38d92e4c71 100644 (file)
@@ -491,18 +491,7 @@ fn expand_trait_item(ti: ast::TraitItem, fld: &mut MacroExpander)
 pub fn expand_type(t: P<ast::Ty>, fld: &mut MacroExpander) -> P<ast::Ty> {
     let t = match t.node.clone() {
         ast::TyKind::Mac(mac) => {
-            if fld.cx.ecfg.features.unwrap().type_macros {
-                expand_mac_invoc(mac, None, Vec::new(), t.span, fld)
-            } else {
-                feature_gate::emit_feature_err(
-                    &fld.cx.parse_sess.span_diagnostic,
-                    "type_macros",
-                    t.span,
-                    feature_gate::GateIssue::Language,
-                    "type macros are experimental");
-
-                DummyResult::raw_ty(t.span)
-            }
+            expand_mac_invoc(mac, None, Vec::new(), t.span, fld)
         }
         _ => t
     };
index d746f8e21141f4001d3e7823c4561474f68a8803..dc68e0646346473cca52a5ed9dceadbc296770ea 100644 (file)
@@ -213,9 +213,6 @@ pub fn new() -> Features {
     // Allows associated type defaults
     (active, associated_type_defaults, "1.2.0", Some(29661)),
 
-    // Allows macros to appear in the type position.
-    (active, type_macros, "1.3.0", Some(27245)),
-
     // allow `repr(simd)`, and importing the various simd intrinsics
     (active, repr_simd, "1.4.0", Some(27731)),
 
@@ -321,6 +318,8 @@ pub fn new() -> Features {
     // mean anything
     (accepted, test_accepted_feature, "1.0.0", None),
     (accepted, tuple_indexing, "1.0.0", None),
+    // Allows macros to appear in the type position.
+    (accepted, type_macros, "1.13.0", Some(27245)),
     (accepted, while_let, "1.0.0", None),
     // Allows `#[deprecated]` attribute
     (accepted, deprecated, "1.9.0", Some(29935))
index 95a52cb232a490ddcb95106dd58139c02cb43b7c..fa0b75da999c29127d17e8f42b975f8dda479376 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(type_macros)]
-
 macro_rules! t {
     () => ( String ; );     //~ ERROR macro expansion ignores token `;`
 }
index e8ca1c1fa98ff4a99c755f274b3a7d3aa2c8f799..20e5b1d72d3d71a9f8ce4c9e716b1f1362db9f8c 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(type_macros, concat_idents)]
+#![feature(concat_idents)]
 
 #[derive(Debug)] //~ NOTE in this expansion
 struct Baz<T>(
index 5d07f0747ff435316db7367cd4ea210baa74e02d..4aa0a3023bb109ed5398458c65e258329a1e6928 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(type_macros)]
-
 // (typeof used because it's surprisingly hard to find an unparsed token after a stmt)
 macro_rules! m {
     () => ( i ; typeof );   //~ ERROR expected expression, found reserved keyword `typeof`
index a69188da58d1667686ab896b9d0d005805b76337..4a6dbf014a1cace35ae973c1daa5cf77ca3bade8 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(type_macros)]
-
 macro_rules! foo {
     ($a:expr) => $a; //~ ERROR macro rhs must be delimited
 }
index 9cc53386d465c50484f6e57d926a1a0ca96299b5..f3dcf405a68a6276abc0e99abc36df62e5baef40 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted, type_macros)]
+#![feature(pub_restricted)]
 
 mod foo {
     type T = ();
index 01466c6a85a5ae5c94e7887bd22c68e308668b3e..3bf8ca30a6c3fe42df1b46936704d56cdce21c24 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted, type_macros)]
+#![feature(pub_restricted)]
 
 macro_rules! define_struct {
     ($t:ty) => {
index ef187a1daed37106f6529f2df1a46deeb012cfe6..febe224fb84dcf14ce2294d6b1940109b13e9843 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(pub_restricted, type_macros)]
+#![feature(pub_restricted)]
 
 macro_rules! define_struct {
     ($t:ty) => {
index 3e36b126523a7f84828dd5fd7180ae54724c5aaf..f06e3544e575dec1874a39eb9dc1eeb2b735aae0 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(concat_idents, type_macros)]
+#![feature(concat_idents)]
 
 pub fn main() {
     struct Foo;
diff --git a/src/test/compile-fail/type-macros-fail.rs b/src/test/compile-fail/type-macros-fail.rs
deleted file mode 100644 (file)
index 4712e2b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! Id {
-    ($T:tt) => ($T);
-}
-
-struct Foo<T> {
-    x: Id!(T)
-    //~^ ERROR: type macros are experimental (see issue #27245)
-}
-
-fn main() {
-    let foo = Foo { x: i32 };
-}
index a20dd3ef72a54cd831eebf714931095419dd00ad..2efd9333999b24ca0f83834b7be300b849cb7f19 100644 (file)
@@ -8,8 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(repr_simd, platform_intrinsics, concat_idents,
-           type_macros, test)]
+#![feature(repr_simd, platform_intrinsics, concat_idents, test)]
 #![allow(non_camel_case_types)]
 
 extern crate test;
index 803b0eae99e887f1ff72a0fdc86c8856354ab1e2..84c0983de80c83abfb580d9dedcd2b4f9122ff16 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(type_macros)]
-
 use std::ops::*;
 
 #[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
index 22dfd507f7e2e6e0c2e65021b1a62f805f640e37..7d1045cf3f1a82e0950e2298044b30c4dfada22e 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(type_macros)]
-
 macro_rules! Tuple {
     { $A:ty,$B:ty } => { ($A, $B) }
 }