Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
993bb072
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,发现更多精彩内容 >>
提交
993bb072
编写于
11月 12, 2020
作者:
V
Vadim Petrochenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc_expand: Mark inner `#![test]` attributes as soft-unstable
上级
ae6aa22c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
37 addition
and
21 deletion
+37
-21
compiler/rustc_resolve/src/macros.rs
compiler/rustc_resolve/src/macros.rs
+14
-15
library/std/src/num/tests.rs
library/std/src/num/tests.rs
+3
-3
src/test/ui/feature-gate/issue-43106-gating-of-test.rs
src/test/ui/feature-gate/issue-43106-gating-of-test.rs
+1
-0
src/test/ui/feature-gate/issue-43106-gating-of-test.stderr
src/test/ui/feature-gate/issue-43106-gating-of-test.stderr
+1
-1
src/test/ui/issues/issue-28134.rs
src/test/ui/issues/issue-28134.rs
+1
-0
src/test/ui/issues/issue-28134.stderr
src/test/ui/issues/issue-28134.stderr
+1
-1
src/test/ui/proc-macro/proc-macro-gates.rs
src/test/ui/proc-macro/proc-macro-gates.rs
+5
-0
src/test/ui/proc-macro/proc-macro-gates.stderr
src/test/ui/proc-macro/proc-macro-gates.stderr
+11
-1
未找到文件。
compiler/rustc_resolve/src/macros.rs
浏览文件 @
993bb072
...
...
@@ -22,7 +22,7 @@
use
rustc_hir
::
def_id
;
use
rustc_middle
::
middle
::
stability
;
use
rustc_middle
::
ty
;
use
rustc_session
::
lint
::
builtin
::
UNUSED_MACROS
;
use
rustc_session
::
lint
::
builtin
::
{
SOFT_UNSTABLE
,
UNUSED_MACROS
}
;
use
rustc_session
::
parse
::
feature_err
;
use
rustc_session
::
Session
;
use
rustc_span
::
edition
::
Edition
;
...
...
@@ -459,22 +459,21 @@ fn smart_resolve_macro_path(
}
// We are trying to avoid reporting this error if other related errors were reported.
if
inner_attr
if
res
!=
Res
::
Err
&&
inner_attr
&&
!
self
.session
.features_untracked
()
.custom_inner_attributes
&&
path
!=
&
sym
::
test
&&
res
!=
Res
::
Err
{
feature_err
(
&
self
.session.parse_sess
,
sym
::
custom_inner_attributes
,
path
.span
,
match
res
{
Res
::
Def
(
..
)
=>
"inner macro attributes are unstable"
,
Res
::
NonMacroAttr
(
..
)
=>
"custom inner attributes are unstable"
,
_
=>
unreachable!
(),
},
)
.emit
();
let
msg
=
match
res
{
Res
::
Def
(
..
)
=>
"inner macro attributes are unstable"
,
Res
::
NonMacroAttr
(
..
)
=>
"custom inner attributes are unstable"
,
_
=>
unreachable!
()
,
};
if
path
==
&
sym
::
test
{
self
.session.parse_sess
.buffer_lint
(
SOFT_UNSTABLE
,
path
.span
,
node_id
,
msg
);
}
else
{
feature_err
(
&
self
.session.parse_sess
,
sym
::
custom_inner_attributes
,
path
.span
,
msg
)
.emit
();
}
}
Ok
((
ext
,
res
))
...
...
library/std/src/num/tests.rs
浏览文件 @
993bb072
...
...
@@ -75,8 +75,8 @@ fn test_checked_mul() {
macro_rules!
test_is_power_of_two
{
(
$test_name:ident
,
$T:ident
)
=>
{
#[test]
fn
$test_name
()
{
#![test]
assert_eq!
((
0
as
$T
)
.is_power_of_two
(),
false
);
assert_eq!
((
1
as
$T
)
.is_power_of_two
(),
true
);
assert_eq!
((
2
as
$T
)
.is_power_of_two
(),
true
);
...
...
@@ -96,8 +96,8 @@ fn $test_name() {
macro_rules!
test_next_power_of_two
{
(
$test_name:ident
,
$T:ident
)
=>
{
#[test]
fn
$test_name
()
{
#![test]
assert_eq!
((
0
as
$T
)
.next_power_of_two
(),
1
);
let
mut
next_power
=
1
;
for
i
in
1
as
$T
..
40
{
...
...
@@ -118,8 +118,8 @@ fn $test_name() {
macro_rules!
test_checked_next_power_of_two
{
(
$test_name:ident
,
$T:ident
)
=>
{
#[test]
fn
$test_name
()
{
#![test]
assert_eq!
((
0
as
$T
)
.checked_next_power_of_two
(),
Some
(
1
));
let
smax
=
$T
::
MAX
>>
1
;
assert_eq!
(
smax
.checked_next_power_of_two
(),
Some
(
smax
+
1
));
...
...
src/test/ui/feature-gate/issue-43106-gating-of-test.rs
浏览文件 @
993bb072
// The non-crate level cases are in issue-43106-gating-of-builtin-attrs.rs.
#![allow(soft_unstable)]
#![test
=
"4200"
]
//~^ ERROR cannot determine resolution for the attribute macro `test`
...
...
src/test/ui/feature-gate/issue-43106-gating-of-test.stderr
浏览文件 @
993bb072
error: cannot determine resolution for the attribute macro `test`
--> $DIR/issue-43106-gating-of-test.rs:
3
:4
--> $DIR/issue-43106-gating-of-test.rs:
4
:4
|
LL | #![test = "4200"]
| ^^^^
...
...
src/test/ui/issues/issue-28134.rs
浏览文件 @
993bb072
// compile-flags: --test
#![allow(soft_unstable)]
#![test]
//~ ERROR cannot determine resolution for the attribute macro `test`
src/test/ui/issues/issue-28134.stderr
浏览文件 @
993bb072
error: cannot determine resolution for the attribute macro `test`
--> $DIR/issue-28134.rs:
3
:4
--> $DIR/issue-28134.rs:
4
:4
|
LL | #![test]
| ^^^^
...
...
src/test/ui/proc-macro/proc-macro-gates.rs
浏览文件 @
993bb072
...
...
@@ -45,4 +45,9 @@ fn attrs() {
//~^ ERROR: custom attributes cannot be applied to expressions
}
fn
test_case
()
{
#![test]
//~ ERROR inner macro attributes are unstable
//~| WARN this was previously accepted
}
fn
main
()
{}
src/test/ui/proc-macro/proc-macro-gates.stderr
浏览文件 @
993bb072
...
...
@@ -76,6 +76,16 @@ LL | let _x = #[identity_attr] println!();
= note: see issue #54727 <https://github.com/rust-lang/rust/issues/54727> for more information
= help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable
error: aborting due to 9 previous errors
error: inner macro attributes are unstable
--> $DIR/proc-macro-gates.rs:49:8
|
LL | #![test]
| ^^^^
|
= note: `#[deny(soft_unstable)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266>
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0658`.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录