Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ac6aba01
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
ac6aba01
编写于
12月 16, 2011
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename iter2 to iteri to match typical convention
上级
2833ca47
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
13 deletion
+13
-13
src/comp/middle/trans_closure.rs
src/comp/middle/trans_closure.rs
+3
-3
src/libcore/vec.rs
src/libcore/vec.rs
+6
-6
src/test/stdtest/vec.rs
src/test/stdtest/vec.rs
+4
-4
未找到文件。
src/comp/middle/trans_closure.rs
浏览文件 @
ac6aba01
...
...
@@ -218,7 +218,7 @@ fn maybe_clone_tydesc(bcx: @block_ctxt,
let
{
bcx
:
bcx
,
val
:
ty_params_slot
}
=
GEP_tup_like_1
(
bcx
,
closure_ty
,
closure
,
[
0
,
abi
::
closure_elt_ty_params
]);
vec
::
iter
2
(
lltydescs
)
{
|
i
,
td
|
vec
::
iter
i
(
lltydescs
)
{
|
i
,
td
|
let
ty_param_slot
=
GEPi
(
bcx
,
ty_params_slot
,
[
0
,
i
as
int
]);
let
cloned_td
=
maybe_clone_tydesc
(
bcx
,
ck
,
td
);
Store
(
bcx
,
cloned_td
,
ty_param_slot
);
...
...
@@ -226,7 +226,7 @@ fn maybe_clone_tydesc(bcx: @block_ctxt,
// Copy expr values into boxed bindings.
// Silly check
vec
::
iter
2
(
bound_values
)
{
|
i
,
bv
|
vec
::
iter
i
(
bound_values
)
{
|
i
,
bv
|
let
bound
=
trans
::
GEP_tup_like_1
(
bcx
,
box_ty
,
box
,
[
0
,
abi
::
box_rc_field_body
,
abi
::
closure_elt_bindings
,
...
...
@@ -310,7 +310,7 @@ fn load_environment(enclosing_cx: @block_ctxt,
// Populate the upvars from the environment.
let
path
=
[
0
,
abi
::
box_rc_field_body
,
abi
::
closure_elt_bindings
];
vec
::
iter
2
(
*
upvars
)
{
|
i
,
upvar_def
|
vec
::
iter
i
(
*
upvars
)
{
|
i
,
upvar_def
|
check
type_is_tup_like
(
bcx
,
boxed_closure_ty
);
let
upvarptr
=
GEP_tup_like
(
bcx
,
boxed_closure_ty
,
llclosure
,
path
+
[
i
as
int
]);
...
...
src/libcore/vec.rs
浏览文件 @
ac6aba01
...
...
@@ -697,18 +697,18 @@ fn enum_uints(start: uint, end: uint) : uint::le(start, end) -> [uint] {
*/
fn
iter
<
T
>
(
v
:
[
const
T
],
f
:
block
(
T
))
{
iter
2
(
v
)
{
|
_
i
,
v
|
f
(
v
)
}
iter
i
(
v
)
{
|
_
i
,
v
|
f
(
v
)
}
}
/*
Function: iter
2
Function: iter
i
Iterates over a vector's elements and indexes
Iterates over vector `v` and, for each element, calls function `f` with the
element's value and index.
*/
fn
iter
2
<
T
>
(
v
:
[
const
T
],
f
:
block
(
uint
,
T
))
{
fn
iter
i
<
T
>
(
v
:
[
const
T
],
f
:
block
(
uint
,
T
))
{
let
i
=
0u
,
l
=
len
(
v
);
while
i
<
l
{
f
(
i
,
v
[
i
]);
i
+=
1u
;
}
}
...
...
@@ -723,18 +723,18 @@ fn iter2<T>(v: [const T], f: block(uint, T)) {
*/
fn
riter
<
T
>
(
v
:
[
const
T
],
f
:
block
(
T
))
{
riter
2
(
v
)
{
|
_
i
,
v
|
f
(
v
)
}
riter
i
(
v
)
{
|
_
i
,
v
|
f
(
v
)
}
}
/*
Function: riter
2
Function: riter
i
Iterates over a vector's elements and indexes in reverse
Iterates over vector `v` and, for each element, calls function `f` with the
element's value and index.
*/
fn
riter
2
<
T
>
(
v
:
[
const
T
],
f
:
block
(
uint
,
T
))
{
fn
riter
i
<
T
>
(
v
:
[
const
T
],
f
:
block
(
uint
,
T
))
{
let
i
=
len
(
v
);
while
0u
<
i
{
i
-=
1u
;
...
...
src/test/stdtest/vec.rs
浏览文件 @
ac6aba01
...
...
@@ -329,9 +329,9 @@ fn iter_nonempty() {
}
#[test]
fn
iter
2
()
{
fn
iter
i
()
{
let
i
=
0
;
vec
::
iter
2
([
1
,
2
,
3
],
{
|
j
,
v
|
vec
::
iter
i
([
1
,
2
,
3
],
{
|
j
,
v
|
if
i
==
0
{
assert
v
==
1
;
}
assert
j
+
1u
==
v
as
uint
;
i
+=
v
;
...
...
@@ -357,9 +357,9 @@ fn riter_nonempty() {
}
#[test]
fn
riter
2
()
{
fn
riter
i
()
{
let
i
=
0
;
vec
::
riter
2
([
0
,
1
,
2
],
{
|
j
,
v
|
vec
::
riter
i
([
0
,
1
,
2
],
{
|
j
,
v
|
if
i
==
0
{
assert
v
==
2
;
}
assert
j
==
v
as
uint
;
i
+=
v
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录