Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6dcaa0af
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,发现更多精彩内容 >>
未验证
提交
6dcaa0af
编写于
1月 23, 2018
作者:
K
kennytm
浏览文件
操作
浏览文件
下载
差异文件
Rollup merge of #47661 - bjorn3:refactor_driver, r=michaelwoerister
Inline some rustc_driver function
上级
117eb681
c3fabcea
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
39 deletion
+22
-39
src/librustc_driver/driver.rs
src/librustc_driver/driver.rs
+9
-21
src/librustc_driver/lib.rs
src/librustc_driver/lib.rs
+13
-18
未找到文件。
src/librustc_driver/driver.rs
浏览文件 @
6dcaa0af
...
...
@@ -51,14 +51,12 @@
use
std
::
path
::{
Path
,
PathBuf
};
use
std
::
rc
::
Rc
;
use
std
::
sync
::
mpsc
;
use
syntax
::{
ast
,
diagnostics
,
visit
};
use
syntax
::
attr
;
use
syntax
::{
self
,
ast
,
attr
,
diagnostics
,
visit
};
use
syntax
::
ext
::
base
::
ExtCtxt
;
use
syntax
::
fold
::
Folder
;
use
syntax
::
parse
::{
self
,
PResult
};
use
syntax
::
util
::
node_count
::
NodeCounter
;
use
syntax_pos
::
FileName
;
use
syntax
;
use
syntax_ext
;
use
derive_registrar
;
...
...
@@ -274,10 +272,6 @@ pub fn compile_input(trans: Box<TransCrate>,
Ok
(())
}
fn
keep_hygiene_data
(
sess
:
&
Session
)
->
bool
{
sess
.opts.debugging_opts.keep_hygiene_data
}
pub
fn
source_name
(
input
:
&
Input
)
->
FileName
{
match
*
input
{
Input
::
File
(
ref
ifile
)
=>
ifile
.clone
()
.into
(),
...
...
@@ -851,7 +845,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
||
lint
::
check_ast_crate
(
sess
,
&
krate
));
// Discard hygiene data, which isn't required after lowering to HIR.
if
!
keep_hygiene_data
(
sess
)
{
if
!
sess
.opts.debugging_opts.keep_hygiene_data
{
syntax
::
ext
::
hygiene
::
clear_markings
();
}
...
...
@@ -915,18 +909,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(trans: &TransCrate,
mpsc
::
Receiver
<
Box
<
Any
+
Send
>>
,
CompileResult
)
->
R
{
macro_rules!
try_with_f
{
(
$e
:
expr
,
(
$
(
$t:tt
)
*
))
=>
{
match
$e
{
Ok
(
x
)
=>
x
,
Err
(
x
)
=>
{
f
(
$
(
$t
)
*
,
Err
(
x
));
return
Err
(
x
);
}
}
}
}
let
time_passes
=
sess
.time_passes
();
let
query_result_on_disk_cache
=
time
(
time_passes
,
...
...
@@ -987,7 +969,13 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(trans: &TransCrate,
||
stability
::
check_unstable_api_usage
(
tcx
));
// passes are timed inside typeck
try_with_f!
(
typeck
::
check_crate
(
tcx
),
(
tcx
,
analysis
,
rx
));
match
typeck
::
check_crate
(
tcx
)
{
Ok
(
x
)
=>
x
,
Err
(
x
)
=>
{
f
(
tcx
,
analysis
,
rx
,
Err
(
x
));
return
Err
(
x
);
}
}
time
(
time_passes
,
"const checking"
,
...
...
src/librustc_driver/lib.rs
浏览文件 @
6dcaa0af
...
...
@@ -670,7 +670,7 @@ fn build_controller(&mut self,
control
.after_hir_lowering.stop
=
Compilation
::
Stop
;
}
if
s
ave_analysis
(
sess
)
{
if
s
ess
.opts.debugging_opts.save_analysis
{
enable_save_analysis
(
&
mut
control
);
}
...
...
@@ -705,10 +705,6 @@ pub fn enable_save_analysis(control: &mut CompileController) {
control
.make_glob_map
=
resolve
::
MakeGlobMap
::
Yes
;
}
fn
save_analysis
(
sess
:
&
Session
)
->
bool
{
sess
.opts.debugging_opts.save_analysis
}
impl
RustcDefaultCalls
{
pub
fn
list_metadata
(
sess
:
&
Session
,
cstore
:
&
CrateStore
,
...
...
@@ -1330,20 +1326,19 @@ pub fn diagnostics_registry() -> errors::registry::Registry {
Registry
::
new
(
&
all_errors
)
}
pub
fn
get_args
()
->
Vec
<
String
>
{
env
::
args_os
()
.enumerate
()
.map
(|(
i
,
arg
)|
arg
.into_string
()
.unwrap_or_else
(|
arg
|
{
early_error
(
ErrorOutputType
::
default
(),
&
format!
(
"Argument {} is not valid Unicode: {:?}"
,
i
,
arg
))
}))
.collect
()
}
pub
fn
main
()
{
env_logger
::
init
()
.unwrap
();
let
result
=
run
(||
run_compiler
(
&
get_args
(),
&
mut
RustcDefaultCalls
,
None
,
None
));
let
result
=
run
(||
{
let
args
=
env
::
args_os
()
.enumerate
()
.map
(|(
i
,
arg
)|
arg
.into_string
()
.unwrap_or_else
(|
arg
|
{
early_error
(
ErrorOutputType
::
default
(),
&
format!
(
"Argument {} is not valid Unicode: {:?}"
,
i
,
arg
))
}))
.collect
::
<
Vec
<
_
>>
();
run_compiler
(
&
args
,
&
mut
RustcDefaultCalls
,
None
,
None
)
});
process
::
exit
(
result
as
i32
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录