Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6ccf9b81
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,发现更多精彩内容 >>
提交
6ccf9b81
编写于
8月 28, 2018
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change from tuple struct to brace struct
上级
5aee959e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
23 addition
and
21 deletion
+23
-21
src/librustc/dep_graph/graph.rs
src/librustc/dep_graph/graph.rs
+3
-3
src/librustc/hir/def_id.rs
src/librustc/hir/def_id.rs
+4
-4
src/librustc/middle/region.rs
src/librustc/middle/region.rs
+1
-1
src/librustc/mir/mod.rs
src/librustc/mir/mod.rs
+2
-2
src/librustc/ty/sty.rs
src/librustc/ty/sty.rs
+4
-4
src/librustc_data_structures/indexed_vec.rs
src/librustc_data_structures/indexed_vec.rs
+9
-7
未找到文件。
src/librustc/dep_graph/graph.rs
浏览文件 @
6ccf9b81
...
...
@@ -44,7 +44,7 @@ pub struct DepNodeIndex { .. }
}
impl
DepNodeIndex
{
const
INVALID
:
DepNodeIndex
=
DepNodeIndex
(::
std
::
u32
::
MAX
)
;
const
INVALID
:
DepNodeIndex
=
DepNodeIndex
{
private
:
::
std
::
u32
::
MAX
}
;
}
#[derive(Copy,
Clone,
Debug,
PartialEq,
Eq,
Hash)]
...
...
@@ -1127,14 +1127,14 @@ fn get(&self, index: SerializedDepNodeIndex) -> Option<DepNodeColor> {
match
self
.values
[
index
]
{
COMPRESSED_NONE
=>
None
,
COMPRESSED_RED
=>
Some
(
DepNodeColor
::
Red
),
value
=>
Some
(
DepNodeColor
::
Green
(
DepNodeIndex
(
value
-
COMPRESSED_FIRST_GREEN
)))
value
=>
Some
(
DepNodeColor
::
Green
(
DepNodeIndex
{
private
:
value
-
COMPRESSED_FIRST_GREEN
})),
}
}
fn
insert
(
&
mut
self
,
index
:
SerializedDepNodeIndex
,
color
:
DepNodeColor
)
{
self
.values
[
index
]
=
match
color
{
DepNodeColor
::
Red
=>
COMPRESSED_RED
,
DepNodeColor
::
Green
(
index
)
=>
index
.
0
+
COMPRESSED_FIRST_GREEN
,
DepNodeColor
::
Green
(
index
)
=>
index
.
private
+
COMPRESSED_FIRST_GREEN
,
}
}
}
src/librustc/hir/def_id.rs
浏览文件 @
6ccf9b81
...
...
@@ -41,15 +41,15 @@ pub struct CrateNum {
impl
CrateNum
{
pub
fn
new
(
x
:
usize
)
->
CrateNum
{
assert
!
(
x
<
(
u32
::
MAX
as
usize
));
CrateNum
(
x
as
u32
)
CrateNum
{
private
:
x
as
u32
}
}
pub
fn
from_u32
(
x
:
u32
)
->
CrateNum
{
CrateNum
(
x
)
CrateNum
{
private
:
x
}
}
pub
fn
as_usize
(
&
self
)
->
usize
{
self
.
0
as
usize
self
.
private
as
usize
}
pub
fn
as_u32
(
&
self
)
->
u32
{
...
...
@@ -61,7 +61,7 @@ pub fn as_def_id(&self) -> DefId { DefId { krate: *self, index: CRATE_DEF_INDEX
impl
fmt
::
Display
for
CrateNum
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
fmt
::
Display
::
fmt
(
&
self
.
0
,
f
)
fmt
::
Display
::
fmt
(
&
self
.
private
,
f
)
}
}
...
...
src/librustc/middle/region.rs
浏览文件 @
6ccf9b81
...
...
@@ -165,7 +165,7 @@ pub struct FirstStatementIndex {
}
}
impl_stable_hash_for!
(
tuple_struct
::
middle
::
region
::
FirstStatementIndex
{
idx
});
impl_stable_hash_for!
(
struct
::
middle
::
region
::
FirstStatementIndex
{
private
});
impl
From
<
ScopeData
>
for
Scope
{
#[inline]
...
...
src/librustc/mir/mod.rs
浏览文件 @
6ccf9b81
...
...
@@ -132,7 +132,7 @@ pub struct Mir<'tcx> {
}
/// where execution begins
pub
const
START_BLOCK
:
BasicBlock
=
BasicBlock
(
0
)
;
pub
const
START_BLOCK
:
BasicBlock
=
BasicBlock
{
private
:
0
}
;
impl
<
'tcx
>
Mir
<
'tcx
>
{
pub
fn
new
(
...
...
@@ -239,7 +239,7 @@ pub fn dominators(&self) -> Dominators<BasicBlock> {
#[inline]
pub
fn
local_kind
(
&
self
,
local
:
Local
)
->
LocalKind
{
let
index
=
local
.
0
as
usize
;
let
index
=
local
.
private
as
usize
;
if
index
==
0
{
debug_assert!
(
self
.local_decls
[
local
]
.mutability
==
Mutability
::
Mut
,
...
...
src/librustc/ty/sty.rs
浏览文件 @
6ccf9b81
...
...
@@ -1274,7 +1274,7 @@ impl DebruijnIndex {
/// you would need to shift the index for `'a` into 1 new binder.
#[must_use]
pub
const
fn
shifted_in
(
self
,
amount
:
u32
)
->
DebruijnIndex
{
DebruijnIndex
(
self
.0
+
amount
)
DebruijnIndex
{
private
:
self
.private
+
amount
}
}
/// Update this index in place by shifting it "in" through
...
...
@@ -1287,7 +1287,7 @@ pub fn shift_in(&mut self, amount: u32) {
/// `amount` number of new binders.
#[must_use]
pub
const
fn
shifted_out
(
self
,
amount
:
u32
)
->
DebruijnIndex
{
DebruijnIndex
(
self
.0
-
amount
)
DebruijnIndex
{
private
:
self
.private
-
amount
}
}
/// Update in place by shifting out from `amount` binders.
...
...
@@ -1316,11 +1316,11 @@ pub fn shift_out(&mut self, amount: u32) {
/// bound by one of the binders we are shifting out of, that is an
/// error (and should fail an assertion failure).
pub
fn
shifted_out_to_binder
(
self
,
to_binder
:
DebruijnIndex
)
->
Self
{
self
.shifted_out
((
to_binder
.
0
-
INNERMOST
.0
)
as
u32
)
self
.shifted_out
((
to_binder
.
private
-
INNERMOST
.private
)
as
u32
)
}
}
impl_stable_hash_for!
(
tuple_struct
DebruijnIndex
{
index
});
impl_stable_hash_for!
(
struct
DebruijnIndex
{
private
});
/// Region utilities
impl
RegionKind
{
...
...
src/librustc_data_structures/indexed_vec.rs
浏览文件 @
6ccf9b81
...
...
@@ -97,7 +97,9 @@ fn index(self) -> usize { self as usize }
@
vis
[
$v:vis
]
@
debug_format
[
$debug_format:tt
])
=>
(
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
$
(
$
derives),
*
)]
$v
struct
$type
(
u32
);
$v
struct
$type
{
private
:
u32
}
impl
$type
{
/// Extract value of this index as an integer.
...
...
@@ -111,12 +113,12 @@ impl Idx for $type {
#[inline]
fn
new
(
value
:
usize
)
->
Self
{
assert!
(
value
<
(
$max
)
as
usize
);
$type
(
value
as
u32
)
$type
{
private
:
value
as
u32
}
}
#[inline]
fn
index
(
self
)
->
usize
{
self
.
0
as
usize
self
.
private
as
usize
}
}
...
...
@@ -151,13 +153,13 @@ fn add_usize(&self, u: usize) -> Option<Self> {
impl
From
<
$type
>
for
u32
{
fn
from
(
v
:
$type
)
->
u32
{
v
.
0
v
.
private
}
}
impl
From
<
$type
>
for
usize
{
fn
from
(
v
:
$type
)
->
usize
{
v
.
0
as
usize
v
.
private
as
usize
}
}
...
...
@@ -193,7 +195,7 @@ fn from(v: u32) -> Self {
@
debug_format
[
$debug_format:tt
])
=>
(
impl
::
std
::
fmt
::
Debug
for
$type
{
fn
fmt
(
&
self
,
fmt
:
&
mut
::
std
::
fmt
::
Formatter
)
->
::
std
::
fmt
::
Result
{
write!
(
fmt
,
$debug_format
,
self
.
0
)
write!
(
fmt
,
$debug_format
,
self
.
private
)
}
}
);
...
...
@@ -376,7 +378,7 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
const
$name:ident
=
$constant:expr
,
$
(
$tokens:tt
)
*
)
=>
(
$
(
#[doc
=
$
doc]
)
*
pub
const
$name
:
$type
=
$type
(
$constant
)
;
pub
const
$name
:
$type
=
$type
{
private
:
$constant
}
;
newtype_index!
(
@
derives
[
$
(
$derives
,)
*
]
@
type
[
$type
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录