Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
16958569
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,发现更多精彩内容 >>
提交
16958569
编写于
8月 21, 2018
作者:
V
varkor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Iterate through all crates in stability.rs rather than lib_features.rs
上级
d06fa3a4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
12 deletion
+27
-12
src/librustc/middle/lib_features.rs
src/librustc/middle/lib_features.rs
+1
-6
src/librustc/middle/stability.rs
src/librustc/middle/stability.rs
+26
-6
未找到文件。
src/librustc/middle/lib_features.rs
浏览文件 @
16958569
...
...
@@ -17,7 +17,7 @@
use
ty
::
TyCtxt
;
use
syntax
::
symbol
::
Symbol
;
use
syntax
::
ast
::{
Attribute
,
MetaItem
,
MetaItemKind
};
use
syntax_pos
::
{
Span
,
DUMMY_SP
}
;
use
syntax_pos
::
Span
;
use
hir
::
intravisit
::{
self
,
NestedVisitorMap
,
Visitor
};
use
rustc_data_structures
::
fx
::{
FxHashSet
,
FxHashMap
};
use
errors
::
DiagnosticId
;
...
...
@@ -152,11 +152,6 @@ fn visit_attribute(&mut self, attr: &'tcx Attribute) {
pub
fn
collect
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
)
->
LibFeatures
{
let
mut
collector
=
LibFeatureCollector
::
new
(
tcx
);
for
&
cnum
in
tcx
.crates
()
.iter
()
{
for
&
(
feature
,
since
)
in
tcx
.defined_lib_features
(
cnum
)
.iter
()
{
collector
.collect_feature
(
feature
,
since
,
DUMMY_SP
);
}
}
intravisit
::
walk_crate
(
&
mut
collector
,
tcx
.hir
.krate
());
collector
.lib_features
}
src/librustc/middle/stability.rs
浏览文件 @
16958569
...
...
@@ -846,14 +846,34 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
remaining_lib_features
.remove
(
&
Symbol
::
intern
(
"libc"
));
remaining_lib_features
.remove
(
&
Symbol
::
intern
(
"test"
));
for
(
feature
,
stable
)
in
tcx
.lib_features
()
.to_vec
()
{
if
let
Some
(
since
)
=
stable
{
if
let
Some
(
span
)
=
remaining_lib_features
.get
(
&
feature
)
{
// Warn if the user has enabled an already-stable lib feature.
unnecessary_stable_feature_lint
(
tcx
,
*
span
,
feature
,
since
);
let
check_features
=
|
remaining_lib_features
:
&
mut
FxHashMap
<
_
,
_
>
,
defined_features
:
&
Vec
<
_
>
|
{
for
&
(
feature
,
since
)
in
defined_features
{
if
let
Some
(
since
)
=
since
{
if
let
Some
(
span
)
=
remaining_lib_features
.get
(
&
feature
)
{
// Warn if the user has enabled an already-stable lib feature.
unnecessary_stable_feature_lint
(
tcx
,
*
span
,
feature
,
since
);
}
}
remaining_lib_features
.remove
(
&
feature
);
if
remaining_lib_features
.is_empty
()
{
break
;
}
}
};
// We always collect the lib features declared in the current crate, even if there are
// no unknown features, because the collection also does feature attribute validation.
let
local_defined_features
=
tcx
.lib_features
()
.to_vec
();
if
!
remaining_lib_features
.is_empty
()
{
check_features
(
&
mut
remaining_lib_features
,
&
local_defined_features
);
for
&
cnum
in
&*
tcx
.crates
()
{
if
remaining_lib_features
.is_empty
()
{
break
;
}
check_features
(
&
mut
remaining_lib_features
,
&
tcx
.defined_lib_features
(
cnum
));
}
remaining_lib_features
.remove
(
&
feature
);
}
for
(
feature
,
span
)
in
remaining_lib_features
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录