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 type-macros #36014

Merged
merged 1 commit into from
Aug 27, 2016
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
13 changes: 1 addition & 12 deletions src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
5 changes: 2 additions & 3 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,6 @@ declare_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)),

Expand Down Expand Up @@ -321,6 +318,8 @@ declare_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))
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/issue-30007.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(type_macros)]

macro_rules! t {
() => ( String ; ); //~ ERROR macro expansion ignores token `;`
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-32950.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/macro-context.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(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`
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/macro-error.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(type_macros)]

macro_rules! foo {
($a:expr) => $a; //~ ERROR macro rhs must be delimited
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/syntax-extension-minor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 0 additions & 22 deletions src/test/compile-fail/type-macros-fail.rs

This file was deleted.

3 changes: 1 addition & 2 deletions src/test/run-pass/simd-intrinsic-generic-cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/type-macros-hlist.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(type_macros)]

use std::ops::*;

#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/type-macros-simple.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(type_macros)]

macro_rules! Tuple {
{ $A:ty,$B:ty } => { ($A, $B) }
}
Expand Down