Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
910bf840
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,发现更多精彩内容 >>
提交
910bf840
编写于
3月 15, 2018
作者:
J
John Kåre Alsaker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Always print `aborting due to n previous error(s)` and only print it once for multi-threaded code
上级
3b43dcbb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
41 deletion
+50
-41
src/librustc_driver/lib.rs
src/librustc_driver/lib.rs
+30
-24
src/librustc_errors/lib.rs
src/librustc_errors/lib.rs
+18
-16
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+2
-1
未找到文件。
src/librustc_driver/lib.rs
浏览文件 @
910bf840
...
...
@@ -63,6 +63,7 @@
use
rustc_save_analysis
as
save
;
use
rustc_save_analysis
::
DumpHandler
;
use
rustc_data_structures
::
sync
::
Lrc
;
use
rustc_data_structures
::
OnDrop
;
use
rustc
::
session
::{
self
,
config
,
Session
,
build_session
,
CompileResult
};
use
rustc
::
session
::
CompileIncomplete
;
use
rustc
::
session
::
config
::{
Input
,
PrintRequest
,
ErrorOutputType
};
...
...
@@ -515,30 +516,35 @@ fn run_compiler_impl<'a>(args: &[String],
target_features
::
add_configuration
(
&
mut
cfg
,
&
sess
,
&*
trans
);
sess
.parse_sess.config
=
cfg
;
let
plugins
=
sess
.opts.debugging_opts.extra_plugins
.clone
();
let
cstore
=
CStore
::
new
(
trans
.metadata_loader
());
do_or_return!
(
callbacks
.late_callback
(
&*
trans
,
&
matches
,
&
sess
,
&
cstore
,
&
input
,
&
odir
,
&
ofile
),
Some
(
sess
));
let
control
=
callbacks
.build_controller
(
&
sess
,
&
matches
);
(
driver
::
compile_input
(
trans
,
&
sess
,
&
cstore
,
&
input_file_path
,
&
input
,
&
odir
,
&
ofile
,
Some
(
plugins
),
&
control
),
Some
(
sess
))
let
result
=
{
let
plugins
=
sess
.opts.debugging_opts.extra_plugins
.clone
();
let
cstore
=
CStore
::
new
(
trans
.metadata_loader
());
do_or_return!
(
callbacks
.late_callback
(
&*
trans
,
&
matches
,
&
sess
,
&
cstore
,
&
input
,
&
odir
,
&
ofile
),
Some
(
sess
));
let
_
sess_abort_error
=
OnDrop
(||
sess
.diagnostic
()
.print_error_count
());
let
control
=
callbacks
.build_controller
(
&
sess
,
&
matches
);
driver
::
compile_input
(
trans
,
&
sess
,
&
cstore
,
&
input_file_path
,
&
input
,
&
odir
,
&
ofile
,
Some
(
plugins
),
&
control
)
};
(
result
,
Some
(
sess
))
}
// Extract output directory and file from matches.
...
...
src/librustc_errors/lib.rs
浏览文件 @
910bf840
...
...
@@ -555,21 +555,15 @@ pub fn err_count(&self) -> usize {
pub
fn
has_errors
(
&
self
)
->
bool
{
self
.err_count
()
>
0
}
pub
fn
abort_if_errors
(
&
self
)
{
let
s
;
match
self
.err_count
()
{
0
=>
{
if
let
Some
(
bug
)
=
self
.delayed_span_bug
.borrow_mut
()
.take
()
{
DiagnosticBuilder
::
new_diagnostic
(
self
,
bug
)
.emit
();
}
return
;
}
1
=>
s
=
"aborting due to previous error"
.to_string
(),
_
=>
{
s
=
format!
(
"aborting due to {} previous errors"
,
self
.err_count
());
}
}
let
err
=
self
.fatal
(
&
s
);
pub
fn
print_error_count
(
&
self
)
{
let
s
=
match
self
.err_count
()
{
0
=>
return
,
1
=>
"aborting due to previous error"
.to_string
(),
_
=>
format!
(
"aborting due to {} previous errors"
,
self
.err_count
())
};
let
_
=
self
.fatal
(
&
s
);
let
can_show_explain
=
self
.emitter
.borrow
()
.should_show_explain
();
let
are_there_diagnostics
=
!
self
.tracked_diagnostic_codes
.borrow
()
.is_empty
();
...
...
@@ -600,8 +594,16 @@ pub fn abort_if_errors(&self) {
}
}
}
}
err
.raise
();
pub
fn
abort_if_errors
(
&
self
)
{
if
self
.err_count
()
==
0
{
if
let
Some
(
bug
)
=
self
.delayed_span_bug
.borrow_mut
()
.take
()
{
DiagnosticBuilder
::
new_diagnostic
(
self
,
bug
)
.emit
();
}
return
;
}
FatalError
.raise
();
}
pub
fn
emit
(
&
self
,
msp
:
&
MultiSpan
,
msg
:
&
str
,
lvl
:
Level
)
{
if
lvl
==
Warning
&&
!
self
.flags.can_emit_warnings
{
...
...
src/librustc_typeck/astconv.rs
浏览文件 @
910bf840
...
...
@@ -27,6 +27,7 @@
use
require_c_abi_if_variadic
;
use
util
::
common
::
ErrorReported
;
use
util
::
nodemap
::
FxHashSet
;
use
errors
::
FatalError
;
use
std
::
iter
;
use
syntax
::{
abi
,
ast
};
...
...
@@ -337,7 +338,7 @@ fn trait_def_id(&self, trait_ref: &hir::TraitRef) -> DefId {
Def
::
Trait
(
trait_def_id
)
=>
trait_def_id
,
Def
::
TraitAlias
(
alias_def_id
)
=>
alias_def_id
,
Def
::
Err
=>
{
self
.tcx
()
.sess
.fatal
(
"cannot continue compilation due to previous error"
);
FatalError
.raise
(
);
}
_
=>
unreachable!
(),
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录