Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1965d729
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,发现更多精彩内容 >>
提交
1965d729
编写于
5月 22, 2013
作者:
E
Erick Tryzelaar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: remove iter_bytes helper functions
上级
d49d0f82
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
137 addition
and
129 deletion
+137
-129
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/common.rs
+13
-5
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+84
-71
src/librustc/middle/typeck/infer/region_inference.rs
src/librustc/middle/typeck/infer/region_inference.rs
+15
-6
src/libstd/to_bytes.rs
src/libstd/to_bytes.rs
+0
-36
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+16
-6
src/libsyntax/ast_util.rs
src/libsyntax/ast_util.rs
+1
-1
src/libsyntax/codemap.rs
src/libsyntax/codemap.rs
+8
-4
未找到文件。
src/librustc/middle/trans/common.rs
浏览文件 @
1965d729
...
...
@@ -1367,13 +1367,21 @@ pub struct mono_id_ {
impl
to_bytes
::
IterBytes
for
mono_param_id
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
match
*
self
{
mono_precise
(
t
,
ref
mids
)
=>
to_bytes
::
iter_bytes_3
(
&
0u8
,
&
ty
::
type_id
(
t
),
mids
,
lsb0
,
f
),
mono_precise
(
t
,
ref
mids
)
=>
{
0u8
.iter_bytes
(
lsb0
,
f
)
&&
ty
::
type_id
(
t
)
.iter_bytes
(
lsb0
,
f
)
&&
mids
.iter_bytes
(
lsb0
,
f
)
}
mono_any
=>
1u8
.iter_bytes
(
lsb0
,
f
),
mono_repr
(
ref
a
,
ref
b
,
ref
c
,
ref
d
)
=>
to_bytes
::
iter_bytes_5
(
&
2u8
,
a
,
b
,
c
,
d
,
lsb0
,
f
)
mono_repr
(
ref
a
,
ref
b
,
ref
c
,
ref
d
)
=>
{
2u8
.iter_bytes
(
lsb0
,
f
)
&&
a
.iter_bytes
(
lsb0
,
f
)
&&
b
.iter_bytes
(
lsb0
,
f
)
&&
c
.iter_bytes
(
lsb0
,
f
)
&&
d
.iter_bytes
(
lsb0
,
f
)
}
}
}
}
...
...
@@ -1386,7 +1394,7 @@ fn iter_bytes(&self, lsb0: bool, f:to_bytes::Cb) -> bool {
impl
to_bytes
::
IterBytes
for
mono_id_
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_2
(
&
self
.def
,
&
self
.params
,
lsb0
,
f
)
self
.def
.iter_bytes
(
lsb0
,
f
)
&&
self
.params
.iter_bytes
(
lsb0
,
f
)
}
}
...
...
src/librustc/middle/ty.rs
浏览文件 @
1965d729
...
...
@@ -137,7 +137,9 @@ pub struct creader_cache_key {
impl
to_bytes
::
IterBytes
for
creader_cache_key
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_3
(
&
self
.cnum
,
&
self
.pos
,
&
self
.len
,
lsb0
,
f
)
self
.cnum
.iter_bytes
(
lsb0
,
f
)
&&
self
.pos
.iter_bytes
(
lsb0
,
f
)
&&
self
.len
.iter_bytes
(
lsb0
,
f
)
}
}
...
...
@@ -392,14 +394,19 @@ pub struct FnSig {
impl
to_bytes
::
IterBytes
for
BareFnTy
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_3
(
&
self
.purity
,
&
self
.abis
,
&
self
.sig
,
lsb0
,
f
)
self
.purity
.iter_bytes
(
lsb0
,
f
)
&&
self
.abis
.iter_bytes
(
lsb0
,
f
)
&&
self
.sig
.iter_bytes
(
lsb0
,
f
)
}
}
impl
to_bytes
::
IterBytes
for
ClosureTy
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_5
(
&
self
.purity
,
&
self
.sigil
,
&
self
.onceness
,
&
self
.region
,
&
self
.sig
,
lsb0
,
f
)
self
.purity
.iter_bytes
(
lsb0
,
f
)
&&
self
.sigil
.iter_bytes
(
lsb0
,
f
)
&&
self
.onceness
.iter_bytes
(
lsb0
,
f
)
&&
self
.region
.iter_bytes
(
lsb0
,
f
)
&&
self
.sig
.iter_bytes
(
lsb0
,
f
)
}
}
...
...
@@ -717,9 +724,15 @@ pub enum InferTy {
impl
to_bytes
::
IterBytes
for
InferTy
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
match
*
self
{
TyVar
(
ref
tv
)
=>
to_bytes
::
iter_bytes_2
(
&
0u8
,
tv
,
lsb0
,
f
),
IntVar
(
ref
iv
)
=>
to_bytes
::
iter_bytes_2
(
&
1u8
,
iv
,
lsb0
,
f
),
FloatVar
(
ref
fv
)
=>
to_bytes
::
iter_bytes_2
(
&
2u8
,
fv
,
lsb0
,
f
),
TyVar
(
ref
tv
)
=>
{
0u8
.iter_bytes
(
lsb0
,
f
)
&&
tv
.iter_bytes
(
lsb0
,
f
)
}
IntVar
(
ref
iv
)
=>
{
1u8
.iter_bytes
(
lsb0
,
f
)
&&
iv
.iter_bytes
(
lsb0
,
f
)
}
FloatVar
(
ref
fv
)
=>
{
2u8
.iter_bytes
(
lsb0
,
f
)
&&
fv
.iter_bytes
(
lsb0
,
f
)
}
}
}
}
...
...
@@ -733,8 +746,12 @@ pub enum InferRegion {
impl
to_bytes
::
IterBytes
for
InferRegion
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
match
*
self
{
ReVar
(
ref
rv
)
=>
to_bytes
::
iter_bytes_2
(
&
0u8
,
rv
,
lsb0
,
f
),
ReSkolemized
(
ref
v
,
_
)
=>
to_bytes
::
iter_bytes_2
(
&
1u8
,
v
,
lsb0
,
f
)
ReVar
(
ref
rv
)
=>
{
0u8
.iter_bytes
(
lsb0
,
f
)
&&
rv
.iter_bytes
(
lsb0
,
f
)
}
ReSkolemized
(
ref
v
,
_
)
=>
{
1u8
.iter_bytes
(
lsb0
,
f
)
&&
v
.iter_bytes
(
lsb0
,
f
)
}
}
}
}
...
...
@@ -2626,119 +2643,115 @@ fn equals(&self, other: &bound_region) -> bool {
impl
to_bytes
::
IterBytes
for
vstore
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
match
*
self
{
vstore_fixed
(
ref
u
)
=>
to_bytes
::
iter_bytes_2
(
&
0u8
,
u
,
lsb0
,
f
),
vstore_uniq
=>
1u8
.iter_bytes
(
lsb0
,
f
),
vstore_box
=>
2u8
.iter_bytes
(
lsb0
,
f
),
vstore_fixed
(
ref
u
)
=>
{
0u8
.iter_bytes
(
lsb0
,
f
)
&&
u
.iter_bytes
(
lsb0
,
f
)
}
vstore_uniq
=>
1u8
.iter_bytes
(
lsb0
,
f
),
vstore_box
=>
2u8
.iter_bytes
(
lsb0
,
f
),
vstore_slice
(
ref
r
)
=>
to_bytes
::
iter_bytes_2
(
&
3u8
,
r
,
lsb0
,
f
),
vstore_slice
(
ref
r
)
=>
{
3u8
.iter_bytes
(
lsb0
,
f
)
&&
r
.iter_bytes
(
lsb0
,
f
)
}
}
}
}
impl
to_bytes
::
IterBytes
for
substs
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_3
(
&
self
.self_r
,
&
self
.self_ty
,
&
self
.tps
,
lsb0
,
f
)
self
.self_r
.iter_bytes
(
lsb0
,
f
)
&&
self
.self_ty
.iter_bytes
(
lsb0
,
f
)
&&
self
.tps
.iter_bytes
(
lsb0
,
f
)
}
}
impl
to_bytes
::
IterBytes
for
mt
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_2
(
&
self
.ty
,
&
self
.mutbl
,
lsb0
,
f
)
self
.ty
.iter_bytes
(
lsb0
,
f
)
&&
self
.mutbl
.iter_bytes
(
lsb0
,
f
)
}
}
impl
to_bytes
::
IterBytes
for
field
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_2
(
&
self
.ident
,
&
self
.mt
,
lsb0
,
f
)
self
.ident
.iter_bytes
(
lsb0
,
f
)
&&
self
.mt
.iter_bytes
(
lsb0
,
f
)
}
}
impl
to_bytes
::
IterBytes
for
FnSig
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_2
(
&
self
.inputs
,
&
self
.output
,
lsb0
,
f
)
self
.inputs
.iter_bytes
(
lsb0
,
f
)
&&
self
.output
.iter_bytes
(
lsb0
,
f
)
}
}
impl
to_bytes
::
IterBytes
for
sty
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
match
*
self
{
ty_nil
=>
0u8
.iter_bytes
(
lsb0
,
f
),
ty_bool
=>
1u8
.iter_bytes
(
lsb0
,
f
),
ty_nil
=>
0u8
.iter_bytes
(
lsb0
,
f
),
ty_bool
=>
1u8
.iter_bytes
(
lsb0
,
f
),
ty_int
(
ref
t
)
=>
to_bytes
::
iter_bytes_2
(
&
2u8
,
t
,
lsb0
,
f
),
ty_int
(
ref
t
)
=>
2u8
.iter_bytes
(
lsb0
,
f
)
&&
t
.iter_bytes
(
lsb0
,
f
),
ty_uint
(
ref
t
)
=>
to_bytes
::
iter_bytes_2
(
&
3u8
,
t
,
lsb0
,
f
),
ty_uint
(
ref
t
)
=>
3u8
.iter_bytes
(
lsb0
,
f
)
&&
t
.iter_bytes
(
lsb0
,
f
),
ty_float
(
ref
t
)
=>
to_bytes
::
iter_bytes_2
(
&
4u8
,
t
,
lsb0
,
f
),
ty_float
(
ref
t
)
=>
4u8
.iter_bytes
(
lsb0
,
f
)
&&
t
.iter_bytes
(
lsb0
,
f
),
ty_estr
(
ref
v
)
=>
to_bytes
::
iter_bytes_2
(
&
5u8
,
v
,
lsb0
,
f
),
ty_estr
(
ref
v
)
=>
5u8
.iter_bytes
(
lsb0
,
f
)
&&
v
.iter_bytes
(
lsb0
,
f
),
ty_enum
(
ref
did
,
ref
substs
)
=>
to_bytes
::
iter_bytes_3
(
&
6u8
,
did
,
substs
,
lsb0
,
f
),
ty_enum
(
ref
did
,
ref
substs
)
=>
{
6u8
.iter_bytes
(
lsb0
,
f
)
&&
did
.iter_bytes
(
lsb0
,
f
)
&&
substs
.iter_bytes
(
lsb0
,
f
)
}
ty_box
(
ref
mt
)
=>
to_bytes
::
iter_bytes_2
(
&
7u8
,
mt
,
lsb0
,
f
),
ty_box
(
ref
mt
)
=>
7u8
.iter_bytes
(
lsb0
,
f
)
&&
mt
.iter_bytes
(
lsb0
,
f
),
ty_evec
(
ref
mt
,
ref
v
)
=>
to_bytes
::
iter_bytes_3
(
&
8u8
,
mt
,
v
,
lsb0
,
f
),
ty_evec
(
ref
mt
,
ref
v
)
=>
{
8u8
.iter_bytes
(
lsb0
,
f
)
&&
mt
.iter_bytes
(
lsb0
,
f
)
&&
v
.iter_bytes
(
lsb0
,
f
)
}
ty_unboxed_vec
(
ref
mt
)
=>
to_bytes
::
iter_bytes_2
(
&
9u8
,
mt
,
lsb0
,
f
),
ty_unboxed_vec
(
ref
mt
)
=>
9u8
.iter_bytes
(
lsb0
,
f
)
&&
mt
.iter_bytes
(
lsb0
,
f
),
ty_tup
(
ref
ts
)
=>
to_bytes
::
iter_bytes_2
(
&
10u8
,
ts
,
lsb0
,
f
),
ty_tup
(
ref
ts
)
=>
10u8
.iter_bytes
(
lsb0
,
f
)
&&
ts
.iter_bytes
(
lsb0
,
f
),
ty_bare_fn
(
ref
ft
)
=>
to_bytes
::
iter_bytes_2
(
&
12u8
,
ft
,
lsb0
,
f
),
ty_bare_fn
(
ref
ft
)
=>
12u8
.iter_bytes
(
lsb0
,
f
)
&&
ft
.iter_bytes
(
lsb0
,
f
),
ty_self
(
ref
did
)
=>
to_bytes
::
iter_bytes_2
(
&
13u8
,
did
,
lsb0
,
f
),
ty_self
(
ref
did
)
=>
13u8
.iter_bytes
(
lsb0
,
f
)
&&
did
.iter_bytes
(
lsb0
,
f
),
ty_infer
(
ref
v
)
=>
to_bytes
::
iter_bytes_2
(
&
14u8
,
v
,
lsb0
,
f
),
ty_infer
(
ref
v
)
=>
14u8
.iter_bytes
(
lsb0
,
f
)
&&
v
.iter_bytes
(
lsb0
,
f
),
ty_param
(
ref
p
)
=>
to_bytes
::
iter_bytes_2
(
&
15u8
,
p
,
lsb0
,
f
),
ty_param
(
ref
p
)
=>
15u8
.iter_bytes
(
lsb0
,
f
)
&&
p
.iter_bytes
(
lsb0
,
f
),
ty_type
=>
16u8
.iter_bytes
(
lsb0
,
f
),
ty_bot
=>
17u8
.iter_bytes
(
lsb0
,
f
),
ty_type
=>
16u8
.iter_bytes
(
lsb0
,
f
),
ty_bot
=>
17u8
.iter_bytes
(
lsb0
,
f
),
ty_ptr
(
ref
mt
)
=>
to_bytes
::
iter_bytes_2
(
&
18u8
,
mt
,
lsb0
,
f
),
ty_ptr
(
ref
mt
)
=>
18u8
.iter_bytes
(
lsb0
,
f
)
&&
mt
.iter_bytes
(
lsb0
,
f
),
ty_uniq
(
ref
mt
)
=>
to_bytes
::
iter_bytes_2
(
&
19u8
,
mt
,
lsb0
,
f
),
ty_uniq
(
ref
mt
)
=>
19u8
.iter_bytes
(
lsb0
,
f
)
&&
mt
.iter_bytes
(
lsb0
,
f
),
ty_trait
(
ref
did
,
ref
substs
,
ref
v
,
ref
mutbl
)
=>
to_bytes
::
iter_bytes_5
(
&
20u8
,
did
,
substs
,
v
,
mutbl
,
lsb0
,
f
),
ty_trait
(
ref
did
,
ref
substs
,
ref
v
,
ref
mutbl
)
=>
{
20u8
.iter_bytes
(
lsb0
,
f
)
&&
did
.iter_bytes
(
lsb0
,
f
)
&&
substs
.iter_bytes
(
lsb0
,
f
)
&&
v
.iter_bytes
(
lsb0
,
f
)
&&
mutbl
.iter_bytes
(
lsb0
,
f
)
}
ty_opaque_closure_ptr
(
ref
ck
)
=>
to_bytes
::
iter_bytes_2
(
&
21u8
,
ck
,
lsb0
,
f
),
ty_opaque_closure_ptr
(
ref
ck
)
=>
21u8
.iter_bytes
(
lsb0
,
f
)
&&
ck
.iter_bytes
(
lsb0
,
f
),
ty_opaque_box
=>
22u8
.iter_bytes
(
lsb0
,
f
),
ty_opaque_box
=>
22u8
.iter_bytes
(
lsb0
,
f
),
ty_struct
(
ref
did
,
ref
substs
)
=>
to_bytes
::
iter_bytes_3
(
&
23u8
,
did
,
substs
,
lsb0
,
f
),
ty_struct
(
ref
did
,
ref
substs
)
=>
{
23u8
.iter_bytes
(
lsb0
,
f
)
&&
did
.iter_bytes
(
lsb0
,
f
)
&&
substs
.iter_bytes
(
lsb0
,
f
)
}
ty_rptr
(
ref
r
,
ref
mt
)
=>
to_bytes
::
iter_bytes_3
(
&
24u8
,
r
,
mt
,
lsb0
,
f
),
ty_rptr
(
ref
r
,
ref
mt
)
=>
{
24u8
.iter_bytes
(
lsb0
,
f
)
&&
r
.iter_bytes
(
lsb0
,
f
)
&&
mt
.iter_bytes
(
lsb0
,
f
)
}
ty_err
=>
25u8
.iter_bytes
(
lsb0
,
f
),
ty_err
=>
25u8
.iter_bytes
(
lsb0
,
f
),
ty_closure
(
ref
ct
)
=>
to_bytes
::
iter_bytes_2
(
&
26u8
,
ct
,
lsb0
,
f
),
ty_closure
(
ref
ct
)
=>
26u8
.iter_bytes
(
lsb0
,
f
)
&&
ct
.iter_bytes
(
lsb0
,
f
),
}
}
}
...
...
src/librustc/middle/typeck/infer/region_inference.rs
浏览文件 @
1965d729
...
...
@@ -564,14 +564,23 @@ enum Constraint {
impl
to_bytes
::
IterBytes
for
Constraint
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
match
*
self
{
ConstrainVarSubVar
(
ref
v0
,
ref
v1
)
=>
to_bytes
::
iter_bytes_3
(
&
0u8
,
v0
,
v1
,
lsb0
,
f
),
ConstrainVarSubVar
(
ref
v0
,
ref
v1
)
=>
{
0u8
.iter_bytes
(
lsb0
,
f
)
&&
v0
.iter_bytes
(
lsb0
,
f
)
&&
v1
.iter_bytes
(
lsb0
,
f
)
}
ConstrainRegSubVar
(
ref
ra
,
ref
va
)
=>
to_bytes
::
iter_bytes_3
(
&
1u8
,
ra
,
va
,
lsb0
,
f
),
ConstrainRegSubVar
(
ref
ra
,
ref
va
)
=>
{
1u8
.iter_bytes
(
lsb0
,
f
)
&&
ra
.iter_bytes
(
lsb0
,
f
)
&&
va
.iter_bytes
(
lsb0
,
f
)
}
ConstrainVarSubReg
(
ref
va
,
ref
ra
)
=>
to_bytes
::
iter_bytes_3
(
&
2u8
,
va
,
ra
,
lsb0
,
f
)
ConstrainVarSubReg
(
ref
va
,
ref
ra
)
=>
{
2u8
.iter_bytes
(
lsb0
,
f
)
&&
va
.iter_bytes
(
lsb0
,
f
)
&&
ra
.iter_bytes
(
lsb0
,
f
)
}
}
}
}
...
...
src/libstd/to_bytes.rs
浏览文件 @
1965d729
...
...
@@ -236,42 +236,6 @@ fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
}
}
// NOTE: remove all of these after a snapshot, the new for-loop iteration
// protocol makes these unnecessary.
#[inline(always)]
pub
fn
iter_bytes_2
<
A
:
IterBytes
,
B
:
IterBytes
>
(
a
:
&
A
,
b
:
&
B
,
lsb0
:
bool
,
z
:
Cb
)
->
bool
{
a
.iter_bytes
(
lsb0
,
z
)
&&
b
.iter_bytes
(
lsb0
,
z
)
}
pub
fn
iter_bytes_3
<
A
:
IterBytes
,
B
:
IterBytes
,
C
:
IterBytes
>
(
a
:
&
A
,
b
:
&
B
,
c
:
&
C
,
lsb0
:
bool
,
z
:
Cb
)
->
bool
{
a
.iter_bytes
(
lsb0
,
z
)
&&
b
.iter_bytes
(
lsb0
,
z
)
&&
c
.iter_bytes
(
lsb0
,
z
)
}
pub
fn
iter_bytes_4
<
A
:
IterBytes
,
B
:
IterBytes
,
C
:
IterBytes
,
D
:
IterBytes
>
(
a
:
&
A
,
b
:
&
B
,
c
:
&
C
,
d
:
&
D
,
lsb0
:
bool
,
z
:
Cb
)
->
bool
{
a
.iter_bytes
(
lsb0
,
z
)
&&
b
.iter_bytes
(
lsb0
,
z
)
&&
c
.iter_bytes
(
lsb0
,
z
)
&&
d
.iter_bytes
(
lsb0
,
z
)
}
pub
fn
iter_bytes_5
<
A
:
IterBytes
,
B
:
IterBytes
,
C
:
IterBytes
,
D
:
IterBytes
,
E
:
IterBytes
>
(
a
:
&
A
,
b
:
&
B
,
c
:
&
C
,
d
:
&
D
,
e
:
&
E
,
lsb0
:
bool
,
z
:
Cb
)
->
bool
{
a
.iter_bytes
(
lsb0
,
z
)
&&
b
.iter_bytes
(
lsb0
,
z
)
&&
c
.iter_bytes
(
lsb0
,
z
)
&&
d
.iter_bytes
(
lsb0
,
z
)
&&
e
.iter_bytes
(
lsb0
,
z
)
}
impl
<
'self
>
IterBytes
for
&
'self
str
{
#[inline(always)]
fn
iter_bytes
(
&
self
,
_
lsb0
:
bool
,
f
:
Cb
)
->
bool
{
...
...
src/libsyntax/ast.rs
浏览文件 @
1965d729
...
...
@@ -112,7 +112,9 @@ pub struct Lifetime {
impl
to_bytes
::
IterBytes
for
Lifetime
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_3
(
&
self
.id
,
&
self
.span
,
&
self
.ident
,
lsb0
,
f
)
self
.id
.iter_bytes
(
lsb0
,
f
)
&&
self
.span
.iter_bytes
(
lsb0
,
f
)
&&
self
.ident
.iter_bytes
(
lsb0
,
f
)
}
}
...
...
@@ -266,7 +268,9 @@ fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
match
*
self
{
bind_by_copy
=>
0u8
.iter_bytes
(
lsb0
,
f
),
bind_by_ref
(
ref
m
)
=>
to_bytes
::
iter_bytes_2
(
&
1u8
,
m
,
lsb0
,
f
),
bind_by_ref
(
ref
m
)
=>
{
1u8
.iter_bytes
(
lsb0
,
f
)
&&
m
.iter_bytes
(
lsb0
,
f
)
}
bind_infer
=>
2u8
.iter_bytes
(
lsb0
,
f
),
}
...
...
@@ -788,7 +792,7 @@ pub enum ty_ {
impl
to_bytes
::
IterBytes
for
Ty
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_2
(
&
self
.span.lo
,
&
self
.span.hi
,
lsb0
,
f
)
self
.span.lo
.iter_bytes
(
lsb0
,
f
)
&&
self
.span.hi
.iter_bytes
(
lsb0
,
f
)
}
}
...
...
@@ -876,9 +880,15 @@ fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
match
*
self
{
sty_static
=>
0u8
.iter_bytes
(
lsb0
,
f
),
sty_value
=>
1u8
.iter_bytes
(
lsb0
,
f
),
sty_region
(
ref
lft
,
ref
mutbl
)
=>
to_bytes
::
iter_bytes_3
(
&
2u8
,
&
lft
,
mutbl
,
lsb0
,
f
),
sty_box
(
ref
mutbl
)
=>
to_bytes
::
iter_bytes_2
(
&
3u8
,
mutbl
,
lsb0
,
f
),
sty_uniq
(
ref
mutbl
)
=>
to_bytes
::
iter_bytes_2
(
&
4u8
,
mutbl
,
lsb0
,
f
),
sty_region
(
ref
lft
,
ref
mutbl
)
=>
{
2u8
.iter_bytes
(
lsb0
,
f
)
&&
lft
.iter_bytes
(
lsb0
,
f
)
&&
mutbl
.iter_bytes
(
lsb0
,
f
)
}
sty_box
(
ref
mutbl
)
=>
{
3u8
.iter_bytes
(
lsb0
,
f
)
&&
mutbl
.iter_bytes
(
lsb0
,
f
)
}
sty_uniq
(
ref
mutbl
)
=>
{
4u8
.iter_bytes
(
lsb0
,
f
)
&&
mutbl
.iter_bytes
(
lsb0
,
f
)
}
}
}
}
...
...
src/libsyntax/ast_util.rs
浏览文件 @
1965d729
...
...
@@ -197,7 +197,7 @@ pub fn is_call_expr(e: @expr) -> bool {
impl
to_bytes
::
IterBytes
for
def_id
{
#[inline(always)]
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_2
(
&
self
.crate
,
&
self
.node
,
lsb0
,
f
)
self
.crate
.iter_bytes
(
lsb0
,
f
)
&&
self
.node
.iter_bytes
(
lsb0
,
f
)
}
}
...
...
src/libsyntax/codemap.rs
浏览文件 @
1965d729
...
...
@@ -140,7 +140,9 @@ fn decode(_d: &mut D) -> span {
impl
to_bytes
::
IterBytes
for
span
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_3
(
&
self
.lo
,
&
self
.hi
,
&
self
.expn_info
,
lsb0
,
f
)
self
.lo
.iter_bytes
(
lsb0
,
f
)
&&
self
.hi
.iter_bytes
(
lsb0
,
f
)
&&
self
.expn_info
.iter_bytes
(
lsb0
,
f
)
}
}
...
...
@@ -193,7 +195,7 @@ pub struct NameAndSpan {name: ~str, span: Option<span>}
impl
to_bytes
::
IterBytes
for
NameAndSpan
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_2
(
&
self
.name
,
&
self
.span
,
lsb0
,
f
)
self
.name
.iter_bytes
(
lsb0
,
f
)
&&
self
.span
.iter_bytes
(
lsb0
,
f
)
}
}
...
...
@@ -204,7 +206,7 @@ pub struct CallInfo {
impl
to_bytes
::
IterBytes
for
CallInfo
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
to_bytes
::
iter_bytes_2
(
&
self
.call_site
,
&
self
.callee
,
lsb0
,
f
)
self
.call_site
.iter_bytes
(
lsb0
,
f
)
&&
self
.callee
.iter_bytes
(
lsb0
,
f
)
}
}
...
...
@@ -216,7 +218,9 @@ pub enum ExpnInfo {
impl
to_bytes
::
IterBytes
for
ExpnInfo
{
fn
iter_bytes
(
&
self
,
lsb0
:
bool
,
f
:
to_bytes
::
Cb
)
->
bool
{
match
*
self
{
ExpandedFrom
(
ref
call_info
)
=>
to_bytes
::
iter_bytes_2
(
&
0u8
,
call_info
,
lsb0
,
f
)
ExpandedFrom
(
ref
call_info
)
=>
{
0u8
.iter_bytes
(
lsb0
,
f
)
&&
call_info
.iter_bytes
(
lsb0
,
f
)
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录