Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
67b8f949
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,发现更多精彩内容 >>
提交
67b8f949
编写于
9月 01, 2020
作者:
M
marmeladema
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hir: replace `lazy_static` by `SyncLazy` from std
上级
1b650d0f
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
14 addition
and
19 deletion
+14
-19
Cargo.lock
Cargo.lock
+0
-1
compiler/rustc_hir/Cargo.toml
compiler/rustc_hir/Cargo.toml
+0
-1
compiler/rustc_hir/src/lang_items.rs
compiler/rustc_hir/src/lang_items.rs
+7
-9
compiler/rustc_hir/src/lib.rs
compiler/rustc_hir/src/lib.rs
+1
-0
compiler/rustc_hir/src/weak_lang_items.rs
compiler/rustc_hir/src/weak_lang_items.rs
+6
-8
未找到文件。
Cargo.lock
浏览文件 @
67b8f949
...
@@ -3530,7 +3530,6 @@ version = "0.0.0"
...
@@ -3530,7 +3530,6 @@ version = "0.0.0"
name = "rustc_hir"
name = "rustc_hir"
version = "0.0.0"
version = "0.0.0"
dependencies = [
dependencies = [
"lazy_static",
"rustc_ast",
"rustc_ast",
"rustc_data_structures",
"rustc_data_structures",
"rustc_index",
"rustc_index",
...
...
compiler/rustc_hir/Cargo.toml
浏览文件 @
67b8f949
...
@@ -15,6 +15,5 @@ rustc_index = { path = "../rustc_index" }
...
@@ -15,6 +15,5 @@ rustc_index = { path = "../rustc_index" }
rustc_span
=
{
path
=
"../rustc_span"
}
rustc_span
=
{
path
=
"../rustc_span"
}
rustc_serialize
=
{
path
=
"../rustc_serialize"
}
rustc_serialize
=
{
path
=
"../rustc_serialize"
}
rustc_ast
=
{
path
=
"../rustc_ast"
}
rustc_ast
=
{
path
=
"../rustc_ast"
}
lazy_static
=
"1"
tracing
=
"0.1"
tracing
=
"0.1"
smallvec
=
{
version
=
"1.0"
,
features
=
[
"union"
,
"may_dangle"
]
}
smallvec
=
{
version
=
"1.0"
,
features
=
[
"union"
,
"may_dangle"
]
}
compiler/rustc_hir/src/lang_items.rs
浏览文件 @
67b8f949
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
use
rustc_span
::
symbol
::{
kw
,
sym
,
Symbol
};
use
rustc_span
::
symbol
::{
kw
,
sym
,
Symbol
};
use
rustc_span
::
Span
;
use
rustc_span
::
Span
;
use
lazy_static
::
lazy_static
;
use
std
::
lazy
::
SyncLazy
;
pub
enum
LangItemGroup
{
pub
enum
LangItemGroup
{
Op
,
Op
,
...
@@ -117,14 +117,12 @@ pub fn $method(&self) -> Option<DefId> {
...
@@ -117,14 +117,12 @@ pub fn $method(&self) -> Option<DefId> {
)
*
)
*
}
}
lazy_static!
{
/// A mapping from the name of the lang item to its order and the form it must be of.
/// A mapping from the name of the lang item to its order and the form it must be of.
pub
static
ref
ITEM_REFS
:
FxHashMap
<
Symbol
,
(
usize
,
Target
)
>
=
{
pub
static
ITEM_REFS
:
SyncLazy
<
FxHashMap
<
Symbol
,
(
usize
,
Target
)
>>
=
SyncLazy
::
new
(||
{
let
mut
item_refs
=
FxHashMap
::
default
();
let
mut
item_refs
=
FxHashMap
::
default
();
$
(
item_refs
.insert
(
$name
,
(
LangItem
::
$variant
as
usize
,
$target
));
)
*
$
(
item_refs
.insert
(
$name
,
(
LangItem
::
$variant
as
usize
,
$target
));
)
*
item_refs
item_refs
};
});
}
// End of the macro
// End of the macro
}
}
...
...
compiler/rustc_hir/src/lib.rs
浏览文件 @
67b8f949
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#![feature(const_fn)]
// For the unsizing cast on `&[]`
#![feature(const_fn)]
// For the unsizing cast on `&[]`
#![feature(const_panic)]
#![feature(const_panic)]
#![feature(in_band_lifetimes)]
#![feature(in_band_lifetimes)]
#![feature(once_cell)]
#![feature(or_patterns)]
#![feature(or_patterns)]
#![recursion_limit
=
"256"
]
#![recursion_limit
=
"256"
]
...
...
compiler/rustc_hir/src/weak_lang_items.rs
浏览文件 @
67b8f949
...
@@ -7,18 +7,16 @@
...
@@ -7,18 +7,16 @@
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_span
::
symbol
::{
sym
,
Symbol
};
use
rustc_span
::
symbol
::{
sym
,
Symbol
};
use
lazy_static
::
lazy_static
;
use
std
::
lazy
::
SyncLazy
;
macro_rules!
weak_lang_items
{
macro_rules!
weak_lang_items
{
(
$
(
$name:ident
,
$item:ident
,
$sym:ident
;)
*
)
=>
(
(
$
(
$name:ident
,
$item:ident
,
$sym:ident
;)
*
)
=>
(
lazy_static!
{
pub
static
WEAK_ITEMS_REFS
:
SyncLazy
<
FxHashMap
<
Symbol
,
LangItem
>>
=
SyncLazy
::
new
(||
{
pub
static
ref
WEAK_ITEMS_REFS
:
FxHashMap
<
Symbol
,
LangItem
>
=
{
let
mut
map
=
FxHashMap
::
default
();
let
mut
map
=
FxHashMap
::
default
();
$
(
map
.insert
(
sym
::
$name
,
LangItem
::
$item
);)
*
$
(
map
.insert
(
sym
::
$name
,
LangItem
::
$item
);)
*
map
map
};
});
}
/// The `check_name` argument avoids the need for `librustc_hir` to depend on
/// The `check_name` argument avoids the need for `librustc_hir` to depend on
/// `librustc_session`.
/// `librustc_session`.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录