Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fd4d50d4
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,发现更多精彩内容 >>
提交
fd4d50d4
编写于
12月 26, 2019
作者:
C
Camille GILLOT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move diagnostic_items queries to librustc_passes.
上级
2a14d165
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
16 deletion
+21
-16
src/librustc/lib.rs
src/librustc/lib.rs
+0
-1
src/librustc/ty/context.rs
src/librustc/ty/context.rs
+0
-8
src/librustc_passes/diagnostic_items.rs
src/librustc_passes/diagnostic_items.rs
+19
-7
src/librustc_passes/lib.rs
src/librustc_passes/lib.rs
+2
-0
未找到文件。
src/librustc/lib.rs
浏览文件 @
fd4d50d4
...
...
@@ -99,7 +99,6 @@
pub
mod
middle
{
pub
mod
cstore
;
pub
mod
dependency_format
;
pub
mod
diagnostic_items
;
pub
mod
exported_symbols
;
pub
mod
free_region
;
pub
mod
lang_items
;
...
...
src/librustc/ty/context.rs
浏览文件 @
fd4d50d4
...
...
@@ -2759,14 +2759,6 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
assert_eq!
(
id
,
LOCAL_CRATE
);
tcx
.arena
.alloc
(
middle
::
lang_items
::
collect
(
tcx
))
};
providers
.diagnostic_items
=
|
tcx
,
id
|
{
assert_eq!
(
id
,
LOCAL_CRATE
);
middle
::
diagnostic_items
::
collect
(
tcx
)
};
providers
.all_diagnostic_items
=
|
tcx
,
id
|
{
assert_eq!
(
id
,
LOCAL_CRATE
);
middle
::
diagnostic_items
::
collect_all
(
tcx
)
};
providers
.maybe_unused_trait_import
=
|
tcx
,
id
|
tcx
.maybe_unused_trait_imports
.contains
(
&
id
);
providers
.maybe_unused_extern_crates
=
|
tcx
,
cnum
|
{
assert_eq!
(
cnum
,
LOCAL_CRATE
);
...
...
src/librustc_passes/diagnostic_items.rs
浏览文件 @
fd4d50d4
...
...
@@ -9,12 +9,13 @@
//!
//! * Compiler internal types like `Ty` and `TyCtxt`
use
crate
::
hir
::
def_id
::{
DefId
,
LOCAL_CRATE
};
use
crate
::
ty
::
TyCtxt
;
use
crate
::
util
::
nodemap
::
FxHashMap
;
use
rustc
::
hir
::
def_id
::{
DefId
,
LOCAL_CRATE
};
use
rustc
::
ty
::
query
::
Providers
;
use
rustc
::
ty
::
TyCtxt
;
use
rustc
::
util
::
nodemap
::
FxHashMap
;
use
crate
::
hir
;
use
crate
::
hir
::
itemlikevisit
::
ItemLikeVisitor
;
use
rustc
::
hir
;
use
rustc
::
hir
::
itemlikevisit
::
ItemLikeVisitor
;
use
syntax
::
ast
;
use
syntax
::
symbol
::{
sym
,
Symbol
};
...
...
@@ -93,7 +94,7 @@ fn extract(attrs: &[ast::Attribute]) -> Option<Symbol> {
}
/// Traverse and collect the diagnostic items in the current
pub
fn
collect
<
'tcx
>
(
tcx
:
TyCtxt
<
'tcx
>
)
->
&
'tcx
FxHashMap
<
Symbol
,
DefId
>
{
fn
collect
<
'tcx
>
(
tcx
:
TyCtxt
<
'tcx
>
)
->
&
'tcx
FxHashMap
<
Symbol
,
DefId
>
{
// Initialize the collector.
let
mut
collector
=
DiagnosticItemCollector
::
new
(
tcx
);
...
...
@@ -104,7 +105,7 @@ pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx FxHashMap<Symbol, DefId> {
}
/// Traverse and collect all the diagnostic items in all crates.
pub
fn
collect_all
<
'tcx
>
(
tcx
:
TyCtxt
<
'tcx
>
)
->
&
'tcx
FxHashMap
<
Symbol
,
DefId
>
{
fn
collect_all
<
'tcx
>
(
tcx
:
TyCtxt
<
'tcx
>
)
->
&
'tcx
FxHashMap
<
Symbol
,
DefId
>
{
// Initialize the collector.
let
mut
collector
=
FxHashMap
::
default
();
...
...
@@ -117,3 +118,14 @@ pub fn collect_all<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx FxHashMap<Symbol, DefId> {
tcx
.arena
.alloc
(
collector
)
}
pub
fn
provide
(
providers
:
&
mut
Providers
<
'_
>
)
{
providers
.diagnostic_items
=
|
tcx
,
id
|
{
assert_eq!
(
id
,
LOCAL_CRATE
);
collect
(
tcx
)
};
providers
.all_diagnostic_items
=
|
tcx
,
id
|
{
assert_eq!
(
id
,
LOCAL_CRATE
);
collect_all
(
tcx
)
};
}
src/librustc_passes/lib.rs
浏览文件 @
fd4d50d4
...
...
@@ -22,6 +22,7 @@
pub
mod
ast_validation
;
mod
check_const
;
pub
mod
dead
;
mod
diagnostic_items
;
pub
mod
entry
;
pub
mod
hir_stats
;
mod
intrinsicck
;
...
...
@@ -32,6 +33,7 @@
pub
fn
provide
(
providers
:
&
mut
Providers
<
'_
>
)
{
check_const
::
provide
(
providers
);
diagnostic_items
::
provide
(
providers
);
entry
::
provide
(
providers
);
loops
::
provide
(
providers
);
liveness
::
provide
(
providers
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录