Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ee055a1f
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ee055a1f
编写于
8月 24, 2016
作者:
D
Daniele Baracchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stabilize type-macros
Closes #27245
上级
eaf71f8d
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
9 addition
and
54 deletion
+9
-54
src/libsyntax/ext/expand.rs
src/libsyntax/ext/expand.rs
+1
-12
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+2
-3
src/test/compile-fail/issue-30007.rs
src/test/compile-fail/issue-30007.rs
+0
-2
src/test/compile-fail/issue-32950.rs
src/test/compile-fail/issue-32950.rs
+1
-1
src/test/compile-fail/macro-context.rs
src/test/compile-fail/macro-context.rs
+0
-2
src/test/compile-fail/macro-error.rs
src/test/compile-fail/macro-error.rs
+0
-2
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs
...mpile-fail/privacy/restricted/tuple-struct-fields/test.rs
+1
-1
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs
...pile-fail/privacy/restricted/tuple-struct-fields/test2.rs
+1
-1
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs
...pile-fail/privacy/restricted/tuple-struct-fields/test3.rs
+1
-1
src/test/compile-fail/syntax-extension-minor.rs
src/test/compile-fail/syntax-extension-minor.rs
+1
-1
src/test/compile-fail/type-macros-fail.rs
src/test/compile-fail/type-macros-fail.rs
+0
-22
src/test/run-pass/simd-intrinsic-generic-cast.rs
src/test/run-pass/simd-intrinsic-generic-cast.rs
+1
-2
src/test/run-pass/type-macros-hlist.rs
src/test/run-pass/type-macros-hlist.rs
+0
-2
src/test/run-pass/type-macros-simple.rs
src/test/run-pass/type-macros-simple.rs
+0
-2
未找到文件。
src/libsyntax/ext/expand.rs
浏览文件 @
ee055a1f
...
...
@@ -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
};
...
...
src/libsyntax/feature_gate.rs
浏览文件 @
ee055a1f
...
...
@@ -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
))
...
...
src/test/compile-fail/issue-30007.rs
浏览文件 @
ee055a1f
...
...
@@ -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 `;`
}
...
...
src/test/compile-fail/issue-32950.rs
浏览文件 @
ee055a1f
...
...
@@ -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
>
(
...
...
src/test/compile-fail/macro-context.rs
浏览文件 @
ee055a1f
...
...
@@ -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`
...
...
src/test/compile-fail/macro-error.rs
浏览文件 @
ee055a1f
...
...
@@ -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
}
...
...
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test.rs
浏览文件 @
ee055a1f
...
...
@@ -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
=
();
...
...
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test2.rs
浏览文件 @
ee055a1f
...
...
@@ -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
)
=>
{
...
...
src/test/compile-fail/privacy/restricted/tuple-struct-fields/test3.rs
浏览文件 @
ee055a1f
...
...
@@ -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
)
=>
{
...
...
src/test/compile-fail/syntax-extension-minor.rs
浏览文件 @
ee055a1f
...
...
@@ -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
;
...
...
src/test/compile-fail/type-macros-fail.rs
已删除
100644 → 0
浏览文件 @
eaf71f8d
// 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
};
}
src/test/run-pass/simd-intrinsic-generic-cast.rs
浏览文件 @
ee055a1f
...
...
@@ -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
;
...
...
src/test/run-pass/type-macros-hlist.rs
浏览文件 @
ee055a1f
...
...
@@ -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)]
...
...
src/test/run-pass/type-macros-simple.rs
浏览文件 @
ee055a1f
...
...
@@ -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
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录