parent
eaf71f8d10
commit
ee055a1ff3
14 changed files with 9 additions and 54 deletions
|
@ -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> {
|
pub fn expand_type(t: P<ast::Ty>, fld: &mut MacroExpander) -> P<ast::Ty> {
|
||||||
let t = match t.node.clone() {
|
let t = match t.node.clone() {
|
||||||
ast::TyKind::Mac(mac) => {
|
ast::TyKind::Mac(mac) => {
|
||||||
if fld.cx.ecfg.features.unwrap().type_macros {
|
expand_mac_invoc(mac, None, Vec::new(), t.span, fld)
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => t
|
_ => t
|
||||||
};
|
};
|
||||||
|
|
|
@ -213,9 +213,6 @@ declare_features! (
|
||||||
// Allows associated type defaults
|
// Allows associated type defaults
|
||||||
(active, associated_type_defaults, "1.2.0", Some(29661)),
|
(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
|
// allow `repr(simd)`, and importing the various simd intrinsics
|
||||||
(active, repr_simd, "1.4.0", Some(27731)),
|
(active, repr_simd, "1.4.0", Some(27731)),
|
||||||
|
|
||||||
|
@ -321,6 +318,8 @@ declare_features! (
|
||||||
// mean anything
|
// mean anything
|
||||||
(accepted, test_accepted_feature, "1.0.0", None),
|
(accepted, test_accepted_feature, "1.0.0", None),
|
||||||
(accepted, tuple_indexing, "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),
|
(accepted, while_let, "1.0.0", None),
|
||||||
// Allows `#[deprecated]` attribute
|
// Allows `#[deprecated]` attribute
|
||||||
(accepted, deprecated, "1.9.0", Some(29935))
|
(accepted, deprecated, "1.9.0", Some(29935))
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(type_macros)]
|
|
||||||
|
|
||||||
macro_rules! t {
|
macro_rules! t {
|
||||||
() => ( String ; ); //~ ERROR macro expansion ignores token `;`
|
() => ( String ; ); //~ ERROR macro expansion ignores token `;`
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(type_macros, concat_idents)]
|
#![feature(concat_idents)]
|
||||||
|
|
||||||
#[derive(Debug)] //~ NOTE in this expansion
|
#[derive(Debug)] //~ NOTE in this expansion
|
||||||
struct Baz<T>(
|
struct Baz<T>(
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(type_macros)]
|
|
||||||
|
|
||||||
// (typeof used because it's surprisingly hard to find an unparsed token after a stmt)
|
// (typeof used because it's surprisingly hard to find an unparsed token after a stmt)
|
||||||
macro_rules! m {
|
macro_rules! m {
|
||||||
() => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof`
|
() => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof`
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(type_macros)]
|
|
||||||
|
|
||||||
macro_rules! foo {
|
macro_rules! foo {
|
||||||
($a:expr) => $a; //~ ERROR macro rhs must be delimited
|
($a:expr) => $a; //~ ERROR macro rhs must be delimited
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(pub_restricted, type_macros)]
|
#![feature(pub_restricted)]
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
type T = ();
|
type T = ();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(pub_restricted, type_macros)]
|
#![feature(pub_restricted)]
|
||||||
|
|
||||||
macro_rules! define_struct {
|
macro_rules! define_struct {
|
||||||
($t:ty) => {
|
($t:ty) => {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(pub_restricted, type_macros)]
|
#![feature(pub_restricted)]
|
||||||
|
|
||||||
macro_rules! define_struct {
|
macro_rules! define_struct {
|
||||||
($t:ty) => {
|
($t:ty) => {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(concat_idents, type_macros)]
|
#![feature(concat_idents)]
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
|
@ -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 };
|
|
||||||
}
|
|
|
@ -8,8 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(repr_simd, platform_intrinsics, concat_idents,
|
#![feature(repr_simd, platform_intrinsics, concat_idents, test)]
|
||||||
type_macros, test)]
|
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
|
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(type_macros)]
|
|
||||||
|
|
||||||
use std::ops::*;
|
use std::ops::*;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(type_macros)]
|
|
||||||
|
|
||||||
macro_rules! Tuple {
|
macro_rules! Tuple {
|
||||||
{ $A:ty,$B:ty } => { ($A, $B) }
|
{ $A:ty,$B:ty } => { ($A, $B) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue