Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
99c96c5b
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,发现更多精彩内容 >>
提交
99c96c5b
编写于
9月 01, 2020
作者:
M
marmeladema
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
driver: replace `lazy_static` by `SyncLazy` from std
上级
73a72049
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
17 deletion
+14
-17
Cargo.lock
Cargo.lock
+0
-1
compiler/rustc_driver/Cargo.toml
compiler/rustc_driver/Cargo.toml
+0
-1
compiler/rustc_driver/src/lib.rs
compiler/rustc_driver/src/lib.rs
+5
-7
compiler/rustc_feature/src/builtin_attrs.rs
compiler/rustc_feature/src/builtin_attrs.rs
+9
-8
未找到文件。
Cargo.lock
浏览文件 @
99c96c5b
...
...
@@ -3439,7 +3439,6 @@ dependencies = [
name = "rustc_driver"
version = "0.0.0"
dependencies = [
"lazy_static",
"libc",
"rustc_ast",
"rustc_ast_pretty",
...
...
compiler/rustc_driver/Cargo.toml
浏览文件 @
99c96c5b
...
...
@@ -8,7 +8,6 @@ edition = "2018"
crate-type
=
["dylib"]
[dependencies]
lazy_static
=
"1.0"
libc
=
"0.2"
tracing
=
{
version
=
"0.1.18"
,
features
=
["release_max_level_info"]
}
tracing-subscriber
=
{
version
=
"0.2.10"
,
default-features
=
false
,
features
=
[
"fmt"
,
"env-filter"
,
"smallvec"
,
"parking_lot"
,
"ansi"
]
}
...
...
compiler/rustc_driver/src/lib.rs
浏览文件 @
99c96c5b
...
...
@@ -11,8 +11,6 @@
#[macro_use]
extern
crate
tracing
;
#[macro_use]
extern
crate
lazy_static
;
pub
extern
crate
rustc_plugin_impl
as
plugin
;
...
...
@@ -49,6 +47,7 @@
use
std
::
ffi
::
OsString
;
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
;
...
...
@@ -1142,13 +1141,12 @@ pub fn catch_with_exit_code(f: impl FnOnce() -> interface::Result<()>) -> i32 {
}
}
lazy_static!
{
static
ref
DEFAULT_HOOK
:
Box
<
dyn
Fn
(
&
panic
::
PanicInfo
<
'_
>
)
+
Sync
+
Send
+
'static
>
=
{
static
DEFAULT_HOOK
:
SyncLazy
<
Box
<
dyn
Fn
(
&
panic
::
PanicInfo
<
'_
>
)
+
Sync
+
Send
+
'static
>>
=
SyncLazy
::
new
(||
{
let
hook
=
panic
::
take_hook
();
panic
::
set_hook
(
Box
::
new
(|
info
|
report_ice
(
info
,
BUG_REPORT_URL
)));
hook
};
}
});
/// Prints the ICE message, including backtrace and query stack.
///
...
...
@@ -1223,7 +1221,7 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
///
/// A custom rustc driver can skip calling this to set up a custom ICE hook.
pub
fn
install_ice_hook
()
{
lazy_static
::
initializ
e
(
&
DEFAULT_HOOK
);
SyncLazy
::
forc
e
(
&
DEFAULT_HOOK
);
}
/// This allows tools to enable rust logging without having to magically match rustc's
...
...
compiler/rustc_feature/src/builtin_attrs.rs
浏览文件 @
99c96c5b
...
...
@@ -590,12 +590,13 @@ pub fn is_builtin_attr_name(name: Symbol) -> bool {
BUILTIN_ATTRIBUTE_MAP
.get
(
&
name
)
.is_some
()
}
pub
static
BUILTIN_ATTRIBUTE_MAP
:
SyncLazy
<
FxHashMap
<
Symbol
,
&
'static
BuiltinAttribute
>>
=
SyncLazy
::
new
(||
{
let
mut
map
=
FxHashMap
::
default
();
for
attr
in
BUILTIN_ATTRIBUTES
.iter
()
{
if
map
.insert
(
attr
.0
,
attr
)
.is_some
()
{
panic!
(
"duplicate builtin attribute `{}`"
,
attr
.0
);
pub
static
BUILTIN_ATTRIBUTE_MAP
:
SyncLazy
<
FxHashMap
<
Symbol
,
&
'static
BuiltinAttribute
>>
=
SyncLazy
::
new
(||
{
let
mut
map
=
FxHashMap
::
default
();
for
attr
in
BUILTIN_ATTRIBUTES
.iter
()
{
if
map
.insert
(
attr
.0
,
attr
)
.is_some
()
{
panic!
(
"duplicate builtin attribute `{}`"
,
attr
.0
);
}
}
}
map
});
map
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录