Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
38542cca
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
38542cca
编写于
2月 13, 2015
作者:
M
Manish Goregaokar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Feature gate custom attributes (fixes #22203)
上级
531a06e5
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
54 addition
and
0 deletion
+54
-0
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+54
-0
未找到文件。
src/libsyntax/feature_gate.rs
浏览文件 @
38542cca
...
...
@@ -134,6 +134,9 @@
// Allows using the unsafe_no_drop_flag attribute (unlikely to
// switch to Accepted; see RFC 320)
(
"unsafe_no_drop_flag"
,
"1.0.0"
,
Active
),
// Allows the use of custom attributes; RFC 572
(
"custom_attribute"
,
"1.0.0"
,
Active
)
];
// (changing above list without updating src/doc/reference.md makes @cmr sad)
...
...
@@ -155,6 +158,43 @@ enum Status {
// Attributes that have a special meaning to rustc or rustdoc
pub
static
KNOWN_ATTRIBUTES
:
&
'static
[(
&
'static
str
,
AttributeType
)]
=
&
[
// Normal attributes
(
"warn"
,
Normal
),
(
"allow"
,
Normal
),
(
"forbid"
,
Normal
),
(
"deny"
,
Normal
),
(
"macro_reexport"
,
Normal
),
(
"macro_use"
,
Normal
),
(
"plugin"
,
Normal
),
(
"macro_export"
,
Normal
),
(
"plugin_registrar"
,
Normal
),
(
"cfg"
,
Normal
),
(
"main"
,
Normal
),
(
"lang"
,
Normal
),
(
"start"
,
Normal
),
(
"test"
,
Normal
),
(
"bench"
,
Normal
),
(
"simd"
,
Normal
),
(
"repr"
,
Normal
),
(
"path"
,
Normal
),
(
"staged_api"
,
Normal
),
(
"abi"
,
Normal
),
(
"rustc_move_fragments"
,
Normal
),
(
"rustc_variance"
,
Normal
),
(
"unsafe_destructor"
,
Normal
),
(
"automatically_derived"
,
Normal
),
(
"no_mangle"
,
Normal
),
(
"no_link"
,
Normal
),
(
"derive"
,
Normal
),
(
"should_fail"
,
Normal
),
(
"ignore"
,
Normal
),
(
"no_implicit_prelude"
,
Normal
),
(
"reexport_test_harness_main"
,
Normal
),
(
"link_args"
,
Normal
),
(
"macro_escape"
,
Normal
),
// FIXME: #14408 whitelist docs since rustdoc looks at them
(
"doc"
,
Whitelisted
),
...
...
@@ -199,11 +239,13 @@ enum Status {
// Crate level attributes
(
"crate_name"
,
CrateLevel
),
(
"crate_type"
,
CrateLevel
),
(
"crate_id"
,
CrateLevel
),
(
"feature"
,
CrateLevel
),
(
"no_start"
,
CrateLevel
),
(
"no_main"
,
CrateLevel
),
(
"no_std"
,
CrateLevel
),
(
"no_builtins"
,
CrateLevel
),
(
"recursion_limit"
,
CrateLevel
),
];
#[derive(PartialEq,
Copy)]
...
...
@@ -557,6 +599,18 @@ fn visit_attribute(&mut self, attr: &ast::Attribute) {
"unsafe_no_drop_flag has unstable semantics
\
and may be removed in the future"
);
}
// Custom attribute check
let
name
=
attr
.name
();
if
KNOWN_ATTRIBUTES
.iter
()
.all
(|
&
(
n
,
_
)|
n
!=
name
)
{
self
.gate_feature
(
"custom_attribute"
,
attr
.span
,
format!
(
"The attribute `{}` is currently
\
unknown to the the compiler and
\
may have meaning
\
added to it in the future"
,
attr
.name
())
.as_slice
());
}
}
fn
visit_pat
(
&
mut
self
,
pattern
:
&
ast
::
Pat
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录