Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e296ed32
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,发现更多精彩内容 >>
提交
e296ed32
编写于
5月 07, 2019
作者:
J
Jonas Schievink
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move librustc panic handler into the new one
上级
a8926a5e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
44 deletion
+22
-44
src/librustc/Cargo.toml
src/librustc/Cargo.toml
+0
-1
src/librustc/lib.rs
src/librustc/lib.rs
+0
-1
src/librustc/util/common.rs
src/librustc/util/common.rs
+0
-37
src/librustc_driver/lib.rs
src/librustc_driver/lib.rs
+22
-5
未找到文件。
src/librustc/Cargo.toml
浏览文件 @
e296ed32
...
...
@@ -15,7 +15,6 @@ bitflags = "1.0"
fmt_macros
=
{
path
=
"../libfmt_macros"
}
graphviz
=
{
path
=
"../libgraphviz"
}
jobserver
=
"0.1"
lazy_static
=
"1.0.0"
num_cpus
=
"1.0"
scoped-tls
=
"1.0"
log
=
{
version
=
"0.4"
,
features
=
[
"release_max_level_info"
,
"std"
]
}
...
...
src/librustc/lib.rs
浏览文件 @
e296ed32
...
...
@@ -68,7 +68,6 @@
#[macro_use]
extern
crate
bitflags
;
extern
crate
getopts
;
#[macro_use]
extern
crate
lazy_static
;
#[macro_use]
extern
crate
scoped_tls
;
#[cfg(windows)]
extern
crate
libc
;
...
...
src/librustc/util/common.rs
浏览文件 @
e296ed32
...
...
@@ -5,17 +5,13 @@
use
std
::
cell
::{
RefCell
,
Cell
};
use
std
::
fmt
::
Debug
;
use
std
::
hash
::
Hash
;
use
std
::
panic
;
use
std
::
env
;
use
std
::
time
::{
Duration
,
Instant
};
use
std
::
sync
::
mpsc
::{
Sender
};
use
syntax_pos
::{
SpanData
};
use
syntax
::
symbol
::{
Symbol
,
sym
};
use
rustc_macros
::
HashStable
;
use
crate
::
ty
::
TyCtxt
;
use
crate
::
dep_graph
::{
DepNode
};
use
lazy_static
;
use
crate
::
session
::
Session
;
#[cfg(test)]
...
...
@@ -31,39 +27,6 @@
thread_local!
(
static
TIME_DEPTH
:
Cell
<
usize
>
=
Cell
::
new
(
0
));
lazy_static!
{
static
ref
DEFAULT_HOOK
:
Box
<
dyn
Fn
(
&
panic
::
PanicInfo
<
'_
>
)
+
Sync
+
Send
+
'static
>
=
{
let
hook
=
panic
::
take_hook
();
panic
::
set_hook
(
Box
::
new
(
panic_hook
));
hook
};
}
fn
panic_hook
(
info
:
&
panic
::
PanicInfo
<
'_
>
)
{
(
*
DEFAULT_HOOK
)(
info
);
let
backtrace
=
env
::
var_os
(
"RUST_BACKTRACE"
)
.map
(|
x
|
&
x
!=
"0"
)
.unwrap_or
(
false
);
if
backtrace
{
TyCtxt
::
try_print_query_stack
();
}
#[cfg(windows)]
unsafe
{
if
env
::
var
(
"RUSTC_BREAK_ON_ICE"
)
.is_ok
()
{
extern
"system"
{
fn
DebugBreak
();
}
// Trigger a debugger if we crashed during bootstrap.
DebugBreak
();
}
}
}
pub
fn
install_panic_hook
()
{
lazy_static
::
initialize
(
&
DEFAULT_HOOK
);
}
/// Parameters to the `Dump` variant of type `ProfileQueriesMsg`.
#[derive(Clone,Debug)]
pub
struct
ProfQDumpParams
{
...
...
src/librustc_driver/lib.rs
浏览文件 @
e296ed32
...
...
@@ -38,8 +38,8 @@
use
rustc
::
lint
::
Lint
;
use
rustc
::
lint
;
use
rustc
::
hir
::
def_id
::
LOCAL_CRATE
;
use
rustc
::
util
::
common
::{
ErrorReported
,
install_panic_hook
,
print_time_passes_entry
}
;
use
rustc
::
util
::
common
::{
set_time_depth
,
time
};
use
rustc
::
ty
::
TyCtxt
;
use
rustc
::
util
::
common
::{
set_time_depth
,
time
,
print_time_passes_entry
,
ErrorReported
};
use
rustc_metadata
::
locator
;
use
rustc_metadata
::
cstore
::
CStore
;
use
rustc_codegen_utils
::
codegen_backend
::
CodegenBackend
;
...
...
@@ -164,8 +164,6 @@ pub fn run_compiler(
None
=>
return
Ok
(()),
};
install_panic_hook
();
let
(
sopts
,
cfg
)
=
config
::
build_session_options_and_crate_config
(
&
matches
);
let
mut
dummy_config
=
|
sopts
,
cfg
,
diagnostic_output
|
{
...
...
@@ -1169,9 +1167,10 @@ pub fn catch_fatal_errors<F: FnOnce() -> R, R>(f: F) -> Result<R, ErrorReported>
}
pub
fn
report_ice
(
info
:
&
panic
::
PanicInfo
<
'_
>
)
{
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
(
*
DEFAULT_HOOK
)(
info
);
//
Thread panicked without emitting a fatal diagnostic
//
Print the infamous ICE message
eprintln!
();
let
emitter
=
Box
::
new
(
errors
::
emitter
::
EmitterWriter
::
stderr
(
...
...
@@ -1212,6 +1211,24 @@ pub fn report_ice(info: &panic::PanicInfo<'_>) {
note
,
errors
::
Level
::
Note
);
}
// If backtraces are enabled, also print the query stack
let
backtrace
=
env
::
var_os
(
"RUST_BACKTRACE"
)
.map
(|
x
|
&
x
!=
"0"
)
.unwrap_or
(
false
);
if
backtrace
{
TyCtxt
::
try_print_query_stack
();
}
#[cfg(windows)]
unsafe
{
if
env
::
var
(
"RUSTC_BREAK_ON_ICE"
)
.is_ok
()
{
extern
"system"
{
fn
DebugBreak
();
}
// Trigger a debugger if we crashed during bootstrap
DebugBreak
();
}
}
}
pub
fn
install_ice_hook
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录