Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2f28737e
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
2f28737e
编写于
6月 11, 2021
作者:
C
Camille GILLOT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move AST crate.
上级
c520cf22
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
29 deletion
+21
-29
compiler/rustc_driver/src/lib.rs
compiler/rustc_driver/src/lib.rs
+2
-9
compiler/rustc_interface/src/passes.rs
compiler/rustc_interface/src/passes.rs
+8
-6
compiler/rustc_interface/src/queries.rs
compiler/rustc_interface/src/queries.rs
+9
-11
src/librustdoc/core.rs
src/librustdoc/core.rs
+2
-3
未找到文件。
compiler/rustc_driver/src/lib.rs
浏览文件 @
2f28737e
...
...
@@ -46,7 +46,6 @@
use
std
::
fs
;
use
std
::
io
::{
self
,
Read
,
Write
};
use
std
::
lazy
::
SyncLazy
;
use
std
::
mem
;
use
std
::
panic
::{
self
,
catch_unwind
};
use
std
::
path
::
PathBuf
;
use
std
::
process
::{
self
,
Command
,
Stdio
};
...
...
@@ -316,12 +315,12 @@ fn run_compiler(
if
let
Some
(
ppm
)
=
&
sess
.opts.pretty
{
if
ppm
.needs_ast_map
()
{
let
expanded_crate
=
{
&
queries
.expansion
()
?
.peek
()
.0
};
queries
.global_ctxt
()
?
.peek_mut
()
.enter
(|
tcx
|
{
let
expanded_crate
=
queries
.expansion
()
?
.take
()
.0
;
pretty
::
print_after_hir_lowering
(
tcx
,
compiler
.input
(),
&
expanded_crate
,
expanded_crate
,
*
ppm
,
compiler
.output_file
()
.as_ref
()
.map
(|
p
|
&**
p
),
);
...
...
@@ -377,12 +376,6 @@ fn run_compiler(
queries
.global_ctxt
()
?
;
// Drop AST after creating GlobalCtxt to free memory
{
let
_
timer
=
sess
.prof
.generic_activity
(
"drop_ast"
);
mem
::
drop
(
queries
.expansion
()
?
.take
());
}
if
sess
.opts.debugging_opts.no_analysis
||
sess
.opts.debugging_opts.ast_json
{
return
early_exit
();
}
...
...
compiler/rustc_interface/src/passes.rs
浏览文件 @
2f28737e
...
...
@@ -7,7 +7,6 @@
use
rustc_codegen_ssa
::
back
::
link
::
emit_metadata
;
use
rustc_codegen_ssa
::
traits
::
CodegenBackend
;
use
rustc_data_structures
::
parallel
;
use
rustc_data_structures
::
steal
::
Steal
;
use
rustc_data_structures
::
sync
::{
par_iter
,
Lrc
,
OnceCell
,
ParallelIterator
,
WorkerLocal
};
use
rustc_data_structures
::
temp_dir
::
MaybeTempDir
;
use
rustc_errors
::{
ErrorReported
,
PResult
};
...
...
@@ -458,7 +457,7 @@ pub fn lower_to_hir<'res, 'tcx>(
sess
:
&
'tcx
Session
,
lint_store
:
&
LintStore
,
resolver
:
&
'res
mut
Resolver
<
'_
>
,
krate
:
&
'res
ast
::
Crate
,
krate
:
ast
::
Crate
,
arena
:
&
'tcx
rustc_ast_lowering
::
Arena
<
'tcx
>
,
)
->
&
'tcx
Crate
<
'tcx
>
{
// Lower AST to HIR.
...
...
@@ -485,6 +484,9 @@ pub fn lower_to_hir<'res, 'tcx>(
)
});
// Drop AST to free memory
sess
.time
(
"drop_ast"
,
||
std
::
mem
::
drop
(
krate
));
// Discard hygiene data, which isn't required after lowering to HIR.
if
!
sess
.opts.debugging_opts.keep_hygiene_data
{
rustc_span
::
hygiene
::
clear_syntax_context_map
();
...
...
@@ -577,7 +579,7 @@ fn escape_dep_env(symbol: Symbol) -> String {
fn
write_out_deps
(
sess
:
&
Session
,
boxed_resolver
:
&
Steal
<
Rc
<
RefCell
<
BoxedResolver
>>
>
,
boxed_resolver
:
&
RefCell
<
BoxedResolver
>
,
outputs
:
&
OutputFilenames
,
out_filenames
:
&
[
PathBuf
],
)
{
...
...
@@ -604,7 +606,7 @@ fn write_out_deps(
}
if
sess
.binary_dep_depinfo
()
{
boxed_resolver
.borrow
()
.borrow
_mut
()
.access
(|
resolver
|
{
boxed_resolver
.borrow_mut
()
.access
(|
resolver
|
{
for
cnum
in
resolver
.cstore
()
.crates_untracked
()
{
let
source
=
resolver
.cstore
()
.crate_source_untracked
(
cnum
);
if
let
Some
((
path
,
_
))
=
source
.dylib
{
...
...
@@ -673,7 +675,7 @@ pub fn prepare_outputs(
sess
:
&
Session
,
compiler
:
&
Compiler
,
krate
:
&
ast
::
Crate
,
boxed_resolver
:
&
Steal
<
Rc
<
RefCell
<
BoxedResolver
>>
>
,
boxed_resolver
:
&
RefCell
<
BoxedResolver
>
,
crate_name
:
&
str
,
)
->
Result
<
OutputFilenames
>
{
let
_
timer
=
sess
.timer
(
"prepare_outputs"
);
...
...
@@ -777,7 +779,7 @@ pub fn enter<F, R>(&mut self, f: F) -> R
pub
fn
create_global_ctxt
<
'tcx
>
(
compiler
:
&
'tcx
Compiler
,
lint_store
:
Lrc
<
LintStore
>
,
krate
:
&
ast
::
Crate
,
krate
:
ast
::
Crate
,
dep_graph
:
DepGraph
,
resolver
:
Rc
<
RefCell
<
BoxedResolver
>>
,
outputs
:
OutputFilenames
,
...
...
compiler/rustc_interface/src/queries.rs
浏览文件 @
2f28737e
...
...
@@ -3,7 +3,6 @@
use
rustc_ast
as
ast
;
use
rustc_codegen_ssa
::
traits
::
CodegenBackend
;
use
rustc_data_structures
::
steal
::
Steal
;
use
rustc_data_structures
::
svh
::
Svh
;
use
rustc_data_structures
::
sync
::{
Lrc
,
OnceCell
,
WorkerLocal
};
use
rustc_errors
::
ErrorReported
;
...
...
@@ -80,7 +79,7 @@ pub struct Queries<'tcx> {
parse
:
Query
<
ast
::
Crate
>
,
crate_name
:
Query
<
String
>
,
register_plugins
:
Query
<
(
ast
::
Crate
,
Lrc
<
LintStore
>
)
>
,
expansion
:
Query
<
(
ast
::
Crate
,
Steal
<
Rc
<
RefCell
<
BoxedResolver
>
>>
,
Lrc
<
LintStore
>
)
>
,
expansion
:
Query
<
(
ast
::
Crate
,
Rc
<
RefCell
<
BoxedResolver
>>
,
Lrc
<
LintStore
>
)
>
,
dep_graph
:
Query
<
DepGraph
>
,
prepare_outputs
:
Query
<
OutputFilenames
>
,
global_ctxt
:
Query
<
QueryContext
<
'tcx
>>
,
...
...
@@ -168,7 +167,7 @@ pub fn crate_name(&self) -> Result<&Query<String>> {
pub
fn
expansion
(
&
self
,
)
->
Result
<&
Query
<
(
ast
::
Crate
,
Steal
<
Rc
<
RefCell
<
BoxedResolver
>
>>
,
Lrc
<
LintStore
>
)
>>
{
)
->
Result
<&
Query
<
(
ast
::
Crate
,
Rc
<
RefCell
<
BoxedResolver
>>
,
Lrc
<
LintStore
>
)
>>
{
tracing
::
trace!
(
"expansion"
);
self
.expansion
.compute
(||
{
let
crate_name
=
self
.crate_name
()
?
.peek
()
.clone
();
...
...
@@ -184,7 +183,7 @@ pub fn expansion(
let
krate
=
resolver
.access
(|
resolver
|
{
passes
::
configure_and_expand
(
&
sess
,
&
lint_store
,
krate
,
&
crate_name
,
resolver
)
})
?
;
Ok
((
krate
,
Steal
::
new
(
Rc
::
new
(
RefCell
::
new
(
resolver
)
)),
lint_store
))
Ok
((
krate
,
Rc
::
new
(
RefCell
::
new
(
resolver
)),
lint_store
))
})
}
...
...
@@ -206,14 +205,13 @@ fn dep_graph(&self) -> Result<&Query<DepGraph>> {
pub
fn
prepare_outputs
(
&
self
)
->
Result
<&
Query
<
OutputFilenames
>>
{
self
.prepare_outputs
.compute
(||
{
let
expansion_result
=
self
.expansion
()
?
;
let
(
krate
,
boxed_resolver
,
_
)
=
&*
expansion_result
.peek
();
let
(
krate
,
boxed_resolver
,
_
)
=
&*
self
.expansion
()
?
.peek
();
let
crate_name
=
self
.crate_name
()
?
.peek
();
passes
::
prepare_outputs
(
self
.session
(),
self
.compiler
,
&
krate
,
&
boxed_resolver
,
krate
,
&
*
boxed_resolver
,
&
crate_name
,
)
})
...
...
@@ -223,14 +221,14 @@ pub fn global_ctxt(&'tcx self) -> Result<&Query<QueryContext<'tcx>>> {
self
.global_ctxt
.compute
(||
{
let
crate_name
=
self
.crate_name
()
?
.peek
()
.clone
();
let
outputs
=
self
.prepare_outputs
()
?
.peek
()
.clone
();
let
(
ref
krate
,
ref
resolver
,
ref
lint_store
)
=
&*
self
.expansion
()
?
.peek
();
let
dep_graph
=
self
.dep_graph
()
?
.peek
()
.clone
();
let
(
krate
,
resolver
,
lint_store
)
=
self
.expansion
()
?
.take
();
Ok
(
passes
::
create_global_ctxt
(
self
.compiler
,
lint_store
.clone
()
,
lint_store
,
krate
,
dep_graph
,
resolver
.steal
()
,
resolver
,
outputs
,
&
crate_name
,
&
self
.queries
,
...
...
src/librustdoc/core.rs
浏览文件 @
2f28737e
...
...
@@ -303,9 +303,8 @@ impl<'tcx> DocContext<'tcx> {
queries
:
&
Queries
<
'a
>
,
sess
:
&
Session
,
)
->
Rc
<
RefCell
<
interface
::
BoxedResolver
>>
{
let
parts
=
abort_on_err
(
queries
.expansion
(),
sess
)
.peek
();
let
(
krate
,
resolver
,
_
)
=
&*
parts
;
let
resolver
=
resolver
.borrow
()
.clone
();
let
(
krate
,
resolver
,
_
)
=
&*
abort_on_err
(
queries
.expansion
(),
sess
)
.peek
();
let
resolver
=
resolver
.clone
();
let
mut
loader
=
crate
::
passes
::
collect_intra_doc_links
::
IntraLinkCrateLoader
::
new
(
resolver
);
ast
::
visit
::
walk_crate
(
&
mut
loader
,
krate
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录