Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
40681395
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
40681395
编写于
11月 19, 2013
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: Remove most uses of `&fn()` from the tests.
上级
ef70b766
变更
145
展开全部
隐藏空白更改
内联
并排
Showing
145 changed file
with
249 addition
and
256 deletion
+249
-256
src/test/auxiliary/cci_impl_lib.rs
src/test/auxiliary/cci_impl_lib.rs
+2
-2
src/test/auxiliary/cci_iter_lib.rs
src/test/auxiliary/cci_iter_lib.rs
+1
-1
src/test/auxiliary/cci_no_inline_lib.rs
src/test/auxiliary/cci_no_inline_lib.rs
+1
-1
src/test/bench/core-map.rs
src/test/bench/core-map.rs
+1
-1
src/test/bench/core-set.rs
src/test/bench/core-set.rs
+12
-13
src/test/bench/core-std.rs
src/test/bench/core-std.rs
+1
-1
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
+1
-2
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-k-nucleotide.rs
+1
-1
src/test/compile-fail/access-mode-in-closures.rs
src/test/compile-fail/access-mode-in-closures.rs
+1
-1
src/test/compile-fail/block-coerce-no-2.rs
src/test/compile-fail/block-coerce-no-2.rs
+1
-1
src/test/compile-fail/block-coerce-no.rs
src/test/compile-fail/block-coerce-no.rs
+3
-3
src/test/compile-fail/borrowck-assign-comp-idx.rs
src/test/compile-fail/borrowck-assign-comp-idx.rs
+1
-1
src/test/compile-fail/borrowck-autoref-3261.rs
src/test/compile-fail/borrowck-autoref-3261.rs
+1
-1
src/test/compile-fail/borrowck-insert-during-each.rs
src/test/compile-fail/borrowck-insert-during-each.rs
+1
-1
src/test/compile-fail/borrowck-lend-flow-if.rs
src/test/compile-fail/borrowck-lend-flow-if.rs
+1
-1
src/test/compile-fail/borrowck-lend-flow-loop.rs
src/test/compile-fail/borrowck-lend-flow-loop.rs
+2
-2
src/test/compile-fail/borrowck-lend-flow.rs
src/test/compile-fail/borrowck-lend-flow.rs
+1
-1
src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
+1
-1
src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
+1
-1
src/test/compile-fail/borrowck-loan-rcvr.rs
src/test/compile-fail/borrowck-loan-rcvr.rs
+2
-2
src/test/compile-fail/borrowck-loan-vec-content.rs
src/test/compile-fail/borrowck-loan-vec-content.rs
+1
-1
src/test/compile-fail/borrowck-move-in-irrefut-pat.rs
src/test/compile-fail/borrowck-move-in-irrefut-pat.rs
+1
-1
src/test/compile-fail/closure-bounds-not-builtin.rs
src/test/compile-fail/closure-bounds-not-builtin.rs
+1
-1
src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs
...mpile-fail/closure-bounds-static-cant-capture-borrowed.rs
+1
-1
src/test/compile-fail/closure-bounds-subtype.rs
src/test/compile-fail/closure-bounds-subtype.rs
+4
-4
src/test/compile-fail/closure-that-fails.rs
src/test/compile-fail/closure-that-fails.rs
+1
-1
src/test/compile-fail/do2.rs
src/test/compile-fail/do2.rs
+1
-1
src/test/compile-fail/extern-wrong-value-type.rs
src/test/compile-fail/extern-wrong-value-type.rs
+1
-1
src/test/compile-fail/fn-variance-1.rs
src/test/compile-fail/fn-variance-1.rs
+1
-1
src/test/compile-fail/immut-function-arguments.rs
src/test/compile-fail/immut-function-arguments.rs
+1
-1
src/test/compile-fail/issue-2074.rs
src/test/compile-fail/issue-2074.rs
+2
-2
src/test/compile-fail/issue-2149.rs
src/test/compile-fail/issue-2149.rs
+2
-2
src/test/compile-fail/issue-5216.rs
src/test/compile-fail/issue-5216.rs
+2
-2
src/test/compile-fail/issue-5239-1.rs
src/test/compile-fail/issue-5239-1.rs
+1
-1
src/test/compile-fail/issue-6762.rs
src/test/compile-fail/issue-6762.rs
+4
-7
src/test/compile-fail/issue-7573.rs
src/test/compile-fail/issue-7573.rs
+1
-1
src/test/compile-fail/kindck-freeze.rs
src/test/compile-fail/kindck-freeze.rs
+1
-1
src/test/compile-fail/lint-unused-mut-variables.rs
src/test/compile-fail/lint-unused-mut-variables.rs
+1
-1
src/test/compile-fail/lint-unused-unsafe.rs
src/test/compile-fail/lint-unused-unsafe.rs
+1
-1
src/test/compile-fail/liveness-block-unint.rs
src/test/compile-fail/liveness-block-unint.rs
+1
-1
src/test/compile-fail/liveness-closure-require-ret.rs
src/test/compile-fail/liveness-closure-require-ret.rs
+1
-1
src/test/compile-fail/liveness-init-in-called-fn-expr.rs
src/test/compile-fail/liveness-init-in-called-fn-expr.rs
+1
-1
src/test/compile-fail/liveness-init-in-fn-expr.rs
src/test/compile-fail/liveness-init-in-fn-expr.rs
+1
-1
src/test/compile-fail/missing-do.rs
src/test/compile-fail/missing-do.rs
+1
-1
src/test/compile-fail/moves-based-on-type-block-bad.rs
src/test/compile-fail/moves-based-on-type-block-bad.rs
+1
-1
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
...le-fail/moves-based-on-type-no-recursive-stack-closure.rs
+1
-1
src/test/compile-fail/omitted-arg-wrong-types.rs
src/test/compile-fail/omitted-arg-wrong-types.rs
+1
-1
src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs
...t/compile-fail/once-cant-move-out-of-non-once-on-stack.rs
+1
-1
src/test/compile-fail/once-fn-subtyping.rs
src/test/compile-fail/once-fn-subtyping.rs
+2
-2
src/test/compile-fail/qquote-1.rs
src/test/compile-fail/qquote-1.rs
+1
-1
src/test/compile-fail/qquote-2.rs
src/test/compile-fail/qquote-2.rs
+1
-1
src/test/compile-fail/regionck-closure-lifetimes.rs
src/test/compile-fail/regionck-closure-lifetimes.rs
+2
-2
src/test/compile-fail/regions-creating-enums.rs
src/test/compile-fail/regions-creating-enums.rs
+1
-1
src/test/compile-fail/regions-escape-bound-fn-2.rs
src/test/compile-fail/regions-escape-bound-fn-2.rs
+1
-1
src/test/compile-fail/regions-escape-bound-fn.rs
src/test/compile-fail/regions-escape-bound-fn.rs
+1
-1
src/test/compile-fail/regions-escape-via-trait-or-not.rs
src/test/compile-fail/regions-escape-via-trait-or-not.rs
+1
-1
src/test/compile-fail/regions-fn-bound.rs
src/test/compile-fail/regions-fn-bound.rs
+8
-8
src/test/compile-fail/regions-fn-subtyping.rs
src/test/compile-fail/regions-fn-subtyping.rs
+18
-18
src/test/compile-fail/regions-fns.rs
src/test/compile-fail/regions-fns.rs
+1
-1
src/test/compile-fail/regions-free-region-ordering-callee.rs
src/test/compile-fail/regions-free-region-ordering-callee.rs
+1
-1
src/test/compile-fail/regions-free-region-ordering-caller.rs
src/test/compile-fail/regions-free-region-ordering-caller.rs
+1
-1
src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
...st/compile-fail/regions-infer-borrow-scope-within-loop.rs
+1
-1
src/test/compile-fail/regions-infer-call-3.rs
src/test/compile-fail/regions-infer-call-3.rs
+1
-1
src/test/compile-fail/regions-name-undeclared.rs
src/test/compile-fail/regions-name-undeclared.rs
+6
-6
src/test/compile-fail/regions-nested-fns-2.rs
src/test/compile-fail/regions-nested-fns-2.rs
+1
-1
src/test/compile-fail/regions-nested-fns.rs
src/test/compile-fail/regions-nested-fns.rs
+2
-2
src/test/compile-fail/regions-ref-in-fn-arg.rs
src/test/compile-fail/regions-ref-in-fn-arg.rs
+1
-1
src/test/compile-fail/regions-ret-borrowed-1.rs
src/test/compile-fail/regions-ret-borrowed-1.rs
+1
-1
src/test/compile-fail/regions-ret-borrowed.rs
src/test/compile-fail/regions-ret-borrowed.rs
+1
-1
src/test/compile-fail/type-arg-out-of-scope.rs
src/test/compile-fail/type-arg-out-of-scope.rs
+1
-1
src/test/debug-info/lexical-scope-in-stack-closure.rs
src/test/debug-info/lexical-scope-in-stack-closure.rs
+1
-1
src/test/run-fail/unwind-iter.rs
src/test/run-fail/unwind-iter.rs
+1
-1
src/test/run-fail/unwind-iter2.rs
src/test/run-fail/unwind-iter2.rs
+1
-1
src/test/run-fail/unwind-lambda.rs
src/test/run-fail/unwind-lambda.rs
+2
-2
src/test/run-pass-fulldeps/qquote.rs
src/test/run-pass-fulldeps/qquote.rs
+1
-1
src/test/run-pass/argument-passing.rs
src/test/run-pass/argument-passing.rs
+1
-1
src/test/run-pass/assignability-trait.rs
src/test/run-pass/assignability-trait.rs
+3
-3
src/test/run-pass/autobind.rs
src/test/run-pass/autobind.rs
+2
-2
src/test/run-pass/block-arg-call-as.rs
src/test/run-pass/block-arg-call-as.rs
+2
-2
src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs
src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs
+1
-1
src/test/run-pass/block-arg-used-as-any.rs
src/test/run-pass/block-arg-used-as-any.rs
+1
-1
src/test/run-pass/block-explicit-types.rs
src/test/run-pass/block-explicit-types.rs
+1
-1
src/test/run-pass/block-fn-coerce.rs
src/test/run-pass/block-fn-coerce.rs
+1
-1
src/test/run-pass/block-iter-1.rs
src/test/run-pass/block-iter-1.rs
+1
-1
src/test/run-pass/block-iter-2.rs
src/test/run-pass/block-iter-2.rs
+1
-1
src/test/run-pass/borrowck-borrow-from-expr-block.rs
src/test/run-pass/borrowck-borrow-from-expr-block.rs
+1
-1
src/test/run-pass/borrowck-mut-uniq.rs
src/test/run-pass/borrowck-mut-uniq.rs
+1
-1
src/test/run-pass/borrowck-preserve-box-in-field.rs
src/test/run-pass/borrowck-preserve-box-in-field.rs
+1
-1
src/test/run-pass/borrowck-preserve-box-in-uniq.rs
src/test/run-pass/borrowck-preserve-box-in-uniq.rs
+1
-1
src/test/run-pass/borrowck-preserve-box.rs
src/test/run-pass/borrowck-preserve-box.rs
+1
-1
src/test/run-pass/borrowck-preserve-expl-deref.rs
src/test/run-pass/borrowck-preserve-expl-deref.rs
+1
-1
src/test/run-pass/closure-inference.rs
src/test/run-pass/closure-inference.rs
+1
-1
src/test/run-pass/do-empty-args.rs
src/test/run-pass/do-empty-args.rs
+1
-1
src/test/run-pass/do-no-args.rs
src/test/run-pass/do-no-args.rs
+2
-2
src/test/run-pass/do-pure.rs
src/test/run-pass/do-pure.rs
+1
-1
src/test/run-pass/do-stack.rs
src/test/run-pass/do-stack.rs
+1
-1
src/test/run-pass/do1.rs
src/test/run-pass/do1.rs
+1
-1
src/test/run-pass/do2.rs
src/test/run-pass/do2.rs
+1
-1
src/test/run-pass/do3.rs
src/test/run-pass/do3.rs
+1
-1
src/test/run-pass/fn-bare-coerce-to-block.rs
src/test/run-pass/fn-bare-coerce-to-block.rs
+1
-1
src/test/run-pass/fn-pattern-expected-type.rs
src/test/run-pass/fn-pattern-expected-type.rs
+1
-1
src/test/run-pass/fn-type-infer.rs
src/test/run-pass/fn-type-infer.rs
+1
-1
src/test/run-pass/foreach-nested.rs
src/test/run-pass/foreach-nested.rs
+1
-1
src/test/run-pass/foreach-put-structured.rs
src/test/run-pass/foreach-put-structured.rs
+1
-1
src/test/run-pass/foreach-simple-outer-slot.rs
src/test/run-pass/foreach-simple-outer-slot.rs
+1
-1
src/test/run-pass/fun-call-variants.rs
src/test/run-pass/fun-call-variants.rs
+1
-1
src/test/run-pass/generic-static-methods.rs
src/test/run-pass/generic-static-methods.rs
+2
-2
src/test/run-pass/issue-1458.rs
src/test/run-pass/issue-1458.rs
+2
-2
src/test/run-pass/issue-2185.rs
src/test/run-pass/issue-2185.rs
+14
-16
src/test/run-pass/issue-2190-2.rs
src/test/run-pass/issue-2190-2.rs
+3
-3
src/test/run-pass/issue-2487-a.rs
src/test/run-pass/issue-2487-a.rs
+1
-1
src/test/run-pass/issue-3429.rs
src/test/run-pass/issue-3429.rs
+1
-1
src/test/run-pass/issue-3796.rs
src/test/run-pass/issue-3796.rs
+1
-1
src/test/run-pass/issue-3874.rs
src/test/run-pass/issue-3874.rs
+1
-1
src/test/run-pass/issue-3904.rs
src/test/run-pass/issue-3904.rs
+1
-1
src/test/run-pass/issue-5239-2.rs
src/test/run-pass/issue-5239-2.rs
+1
-1
src/test/run-pass/issue-6153.rs
src/test/run-pass/issue-6153.rs
+1
-1
src/test/run-pass/issue-868.rs
src/test/run-pass/issue-868.rs
+1
-1
src/test/run-pass/iter-range.rs
src/test/run-pass/iter-range.rs
+1
-1
src/test/run-pass/lambda-infer-unresolved.rs
src/test/run-pass/lambda-infer-unresolved.rs
+2
-2
src/test/run-pass/last-use-in-block.rs
src/test/run-pass/last-use-in-block.rs
+3
-3
src/test/run-pass/last-use-is-capture.rs
src/test/run-pass/last-use-is-capture.rs
+1
-1
src/test/run-pass/match-phi.rs
src/test/run-pass/match-phi.rs
+1
-1
src/test/run-pass/monad.rs
src/test/run-pass/monad.rs
+4
-4
src/test/run-pass/move-nullary-fn.rs
src/test/run-pass/move-nullary-fn.rs
+2
-2
src/test/run-pass/mut-function-arguments.rs
src/test/run-pass/mut-function-arguments.rs
+1
-1
src/test/run-pass/newlambdas.rs
src/test/run-pass/newlambdas.rs
+2
-2
src/test/run-pass/non-legacy-modes.rs
src/test/run-pass/non-legacy-modes.rs
+1
-1
src/test/run-pass/purity-infer.rs
src/test/run-pass/purity-infer.rs
+1
-1
src/test/run-pass/reflect-visit-data.rs
src/test/run-pass/reflect-visit-data.rs
+3
-3
src/test/run-pass/regions-fn-subtyping-2.rs
src/test/run-pass/regions-fn-subtyping-2.rs
+2
-2
src/test/run-pass/regions-fn-subtyping.rs
src/test/run-pass/regions-fn-subtyping.rs
+4
-4
src/test/run-pass/regions-infer-call-2.rs
src/test/run-pass/regions-infer-call-2.rs
+1
-1
src/test/run-pass/regions-params.rs
src/test/run-pass/regions-params.rs
+1
-1
src/test/run-pass/sendfn-is-a-block.rs
src/test/run-pass/sendfn-is-a-block.rs
+1
-1
src/test/run-pass/static-impl.rs
src/test/run-pass/static-impl.rs
+6
-6
src/test/run-pass/task-killjoin-rsrc.rs
src/test/run-pass/task-killjoin-rsrc.rs
+1
-1
src/test/run-pass/tempfile.rs
src/test/run-pass/tempfile.rs
+1
-1
src/test/run-pass/trait-bounds-in-arc.rs
src/test/run-pass/trait-bounds-in-arc.rs
+4
-4
src/test/run-pass/trait-generic.rs
src/test/run-pass/trait-generic.rs
+2
-2
src/test/run-pass/type-params-in-for-each.rs
src/test/run-pass/type-params-in-for-each.rs
+1
-1
src/test/run-pass/unnamed_argument_mode.rs
src/test/run-pass/unnamed_argument_mode.rs
+1
-1
src/test/run-pass/unused-move-capture.rs
src/test/run-pass/unused-move-capture.rs
+1
-1
src/test/run-pass/variadic-ffi.rs
src/test/run-pass/variadic-ffi.rs
+1
-1
src/test/run-pass/vec-matching-fold.rs
src/test/run-pass/vec-matching-fold.rs
+2
-2
未找到文件。
src/test/auxiliary/cci_impl_lib.rs
浏览文件 @
40681395
...
...
@@ -11,12 +11,12 @@
#[link(name=
"cci_impl_lib"
,
vers=
"0.0"
)]
;
trait
uint_helpers
{
fn
to
(
&
self
,
v
:
uint
,
f
:
&
fn
(
uint
)
);
fn
to
(
&
self
,
v
:
uint
,
f
:
|
uint
|
);
}
impl
uint_helpers
for
uint
{
#[inline]
fn
to
(
&
self
,
v
:
uint
,
f
:
&
fn
(
uint
)
)
{
fn
to
(
&
self
,
v
:
uint
,
f
:
|
uint
|
)
{
let
mut
i
=
*
self
;
while
i
<
v
{
f
(
i
);
...
...
src/test/auxiliary/cci_iter_lib.rs
浏览文件 @
40681395
...
...
@@ -11,7 +11,7 @@
#[link(name=
"cci_iter_lib"
,
vers=
"0.0"
)]
;
#[inline]
pub
fn
iter
<
T
>
(
v
:
&
[
T
],
f
:
&
fn
(
&
T
)
)
{
pub
fn
iter
<
T
>
(
v
:
&
[
T
],
f
:
|
&
T
|
)
{
let
mut
i
=
0u
;
let
n
=
v
.len
();
while
i
<
n
{
...
...
src/test/auxiliary/cci_no_inline_lib.rs
浏览文件 @
40681395
...
...
@@ -11,7 +11,7 @@
#[link(name=
"cci_no_inline_lib"
,
vers=
"0.0"
)]
;
// same as cci_iter_lib, more-or-less, but not marked inline
pub
fn
iter
(
v
:
~
[
uint
],
f
:
&
fn
(
uint
)
)
{
pub
fn
iter
(
v
:
~
[
uint
],
f
:
|
uint
|
)
{
let
mut
i
=
0u
;
let
n
=
v
.len
();
while
i
<
n
{
...
...
src/test/bench/core-map.rs
浏览文件 @
40681395
...
...
@@ -19,7 +19,7 @@
use
std
::
uint
;
use
std
::
vec
;
fn
timed
(
label
:
&
str
,
f
:
&
fn
()
)
{
fn
timed
(
label
:
&
str
,
f
:
||
)
{
let
start
=
time
::
precise_time_s
();
f
();
let
end
=
time
::
precise_time_s
();
...
...
src/test/bench/core-set.rs
浏览文件 @
40681395
...
...
@@ -27,7 +27,7 @@ struct Results {
delete_strings
:
f64
}
fn
timed
(
result
:
&
mut
f64
,
op
:
&
fn
()
)
{
fn
timed
(
result
:
&
mut
f64
,
op
:
||
)
{
let
start
=
extra
::
time
::
precise_time_s
();
op
();
let
end
=
extra
::
time
::
precise_time_s
();
...
...
@@ -36,13 +36,12 @@ fn timed(result: &mut f64, op: &fn()) {
impl
Results
{
pub
fn
bench_int
<
T
:
MutableSet
<
uint
>
,
R
:
rand
::
Rng
>
(
&
mut
self
,
rng
:
&
mut
R
,
num_keys
:
uint
,
rand_cap
:
uint
,
f
:
&
fn
()
->
T
)
{
{
R
:
rand
::
Rng
>
(
&
mut
self
,
rng
:
&
mut
R
,
num_keys
:
uint
,
rand_cap
:
uint
,
f
:
||
->
T
)
{
{
let
mut
set
=
f
();
do
timed
(
&
mut
self
.sequential_ints
)
{
for
i
in
range
(
0u
,
num_keys
)
{
...
...
@@ -79,11 +78,11 @@ pub fn bench_int<T:MutableSet<uint>,
}
pub
fn
bench_str
<
T
:
MutableSet
<~
str
>
,
R
:
rand
::
Rng
>
(
&
mut
self
,
rng
:
&
mut
R
,
num_keys
:
uint
,
f
:
&
fn
()
->
T
)
{
R
:
rand
::
Rng
>
(
&
mut
self
,
rng
:
&
mut
R
,
num_keys
:
uint
,
f
:
||
->
T
)
{
{
let
mut
set
=
f
();
do
timed
(
&
mut
self
.sequential_strings
)
{
...
...
src/test/bench/core-std.rs
浏览文件 @
40681395
...
...
@@ -40,7 +40,7 @@ fn main() {
bench!
(
argv
,
is_utf8_multibyte
);
}
fn
maybe_run_test
(
argv
:
&
[
~
str
],
name
:
~
str
,
test
:
&
fn
()
)
{
fn
maybe_run_test
(
argv
:
&
[
~
str
],
name
:
~
str
,
test
:
||
)
{
let
mut
run_test
=
false
;
if
os
::
getenv
(
"RUST_BENCH"
)
.is_some
()
{
...
...
src/test/bench/shootout-k-nucleotide-pipes.rs
浏览文件 @
40681395
...
...
@@ -104,8 +104,7 @@ fn update_freq(mm: &mut HashMap<~[u8], uint>, key: &[u8]) {
// given a ~[u8], for each window call a function
// i.e., for "hello" and windows of size four,
// run it("hell") and it("ello"), then return "llo"
fn
windows_with_carry
(
bb
:
&
[
u8
],
nn
:
uint
,
it
:
&
fn
(
window
:
&
[
u8
]))
->
~
[
u8
]
{
fn
windows_with_carry
(
bb
:
&
[
u8
],
nn
:
uint
,
it
:
|
window
:
&
[
u8
]|)
->
~
[
u8
]
{
let
mut
ii
=
0u
;
let
len
=
bb
.len
();
...
...
src/test/bench/shootout-k-nucleotide.rs
浏览文件 @
40681395
...
...
@@ -154,7 +154,7 @@ fn lookup<C:TableCallback>(&mut self, key: Code, c: C) {
}
}
fn
each
(
&
self
,
f
:
&
fn
(
entry
:
&
Entry
)
->
bool
)
{
fn
each
(
&
self
,
f
:
|
entry
:
&
Entry
|
->
bool
)
{
for
self
.items.each
|
item
|
{
match
*
item
{
None
=>
{}
...
...
src/test/compile-fail/access-mode-in-closures.rs
浏览文件 @
40681395
...
...
@@ -11,7 +11,7 @@
struct
sty
(
~
[
int
]);
fn
unpack
(
_u
npack
:
&
fn
(
v
:
&
sty
)
->
~
[
int
])
{}
fn
unpack
(
_u
npack
:
|
v
:
&
sty
|
->
~
[
int
])
{}
fn
main
()
{
let
_
foo
=
unpack
(|
s
|
{
...
...
src/test/compile-fail/block-coerce-no-2.rs
浏览文件 @
40681395
...
...
@@ -15,7 +15,7 @@ fn main() {
fn
f
(
f
:
extern
fn
(
extern
fn
(
extern
fn
())))
{
}
fn
g
(
f
:
extern
fn
(
&
fn
()
))
{
fn
g
(
f
:
extern
fn
(
||
))
{
}
f
(
g
);
...
...
src/test/compile-fail/block-coerce-no.rs
浏览文件 @
40681395
...
...
@@ -11,9 +11,9 @@
// Make sure that fn-to-block coercion isn't incorrectly lifted over
// other tycons.
fn
coerce
(
b
:
&
fn
()
)
->
extern
fn
()
{
fn
lol
(
f
:
extern
fn
(
v
:
&
fn
()
)
->
extern
fn
(),
g
:
&
fn
()
)
->
extern
fn
()
{
return
f
(
g
);
}
fn
coerce
(
b
:
||
)
->
extern
fn
()
{
fn
lol
(
f
:
extern
fn
(
v
:
||
)
->
extern
fn
(),
g
:
||
)
->
extern
fn
()
{
return
f
(
g
);
}
fn
fn_id
(
f
:
extern
fn
())
->
extern
fn
()
{
return
f
}
return
lol
(
fn_id
,
b
);
//~^ ERROR mismatched types
...
...
src/test/compile-fail/borrowck-assign-comp-idx.rs
浏览文件 @
40681395
...
...
@@ -24,7 +24,7 @@ fn a() {
info!
(
"{}"
,
*
q
);
}
fn
borrow
(
_
x
:
&
[
int
],
_
f
:
&
fn
()
)
{}
fn
borrow
(
_
x
:
&
[
int
],
_
f
:
||
)
{}
fn
b
()
{
// here we alias the mutable vector into an imm slice and try to
...
...
src/test/compile-fail/borrowck-autoref-3261.rs
浏览文件 @
40681395
...
...
@@ -11,7 +11,7 @@
struct
X
(
Either
<
(
uint
,
uint
),
extern
fn
()
>
);
impl
X
{
pub
fn
with
(
&
self
,
blk
:
&
fn
(
x
:
&
Either
<
(
uint
,
uint
),
extern
fn
()
>
)
)
{
pub
fn
with
(
&
self
,
blk
:
|
x
:
&
Either
<
(
uint
,
uint
),
extern
fn
()
>
|
)
{
blk
(
&**
self
)
}
}
...
...
src/test/compile-fail/borrowck-insert-during-each.rs
浏览文件 @
40681395
...
...
@@ -15,7 +15,7 @@ struct Foo {
}
impl
Foo
{
pub
fn
foo
(
&
mut
self
,
fun
:
&
fn
(
&
int
)
)
{
pub
fn
foo
(
&
mut
self
,
fun
:
|
&
int
|
)
{
for
f
in
self
.n
.iter
()
{
fun
(
f
);
}
...
...
src/test/compile-fail/borrowck-lend-flow-if.rs
浏览文件 @
40681395
...
...
@@ -17,7 +17,7 @@
fn
borrow
(
_
v
:
&
int
)
{}
fn
borrow_mut
(
_
v
:
&
mut
int
)
{}
fn
cond
()
->
bool
{
fail
!
()
}
fn
for_func
(
_
f
:
&
fn
()
->
bool
)
{
fail
!
()
}
fn
for_func
(
_
f
:
||
->
bool
)
{
fail
!
()
}
fn
produce
<
T
>
()
->
T
{
fail
!
();
}
fn
inc
(
v
:
&
mut
~
int
)
{
...
...
src/test/compile-fail/borrowck-lend-flow-loop.rs
浏览文件 @
40681395
...
...
@@ -111,7 +111,7 @@ fn while_aliased_mut_cond(cond: bool, cond2: bool) {
}
}
fn
loop_break_pops_scopes
<
'r
>
(
_
v
:
&
'r
mut
[
uint
],
f
:
&
fn
(
&
'r
mut
uint
)
->
bool
)
{
fn
loop_break_pops_scopes
<
'r
>
(
_
v
:
&
'r
mut
[
uint
],
f
:
|
&
'r
mut
uint
|
->
bool
)
{
// Here we check that when you break out of an inner loop, the
// borrows that go out of scope as you exit the inner loop are
// removed from the bitset.
...
...
@@ -127,7 +127,7 @@ fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool)
}
}
fn
loop_loop_pops_scopes
<
'r
>
(
_
v
:
&
'r
mut
[
uint
],
f
:
&
fn
(
&
'r
mut
uint
)
->
bool
)
{
fn
loop_loop_pops_scopes
<
'r
>
(
_
v
:
&
'r
mut
[
uint
],
f
:
|
&
'r
mut
uint
|
->
bool
)
{
// Similar to `loop_break_pops_scopes` but for the `loop` keyword
while
cond
()
{
...
...
src/test/compile-fail/borrowck-lend-flow.rs
浏览文件 @
40681395
...
...
@@ -17,7 +17,7 @@
fn
borrow
(
_
v
:
&
int
)
{}
fn
borrow_mut
(
_
v
:
&
mut
int
)
{}
fn
cond
()
->
bool
{
fail
!
()
}
fn
for_func
(
_
f
:
&
fn
()
->
bool
)
{
fail
!
()
}
fn
for_func
(
_
f
:
||
->
bool
)
{
fail
!
()
}
fn
produce
<
T
>
()
->
T
{
fail
!
();
}
fn
inc
(
v
:
&
mut
~
int
)
{
...
...
src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
浏览文件 @
40681395
...
...
@@ -10,7 +10,7 @@
use
std
::
task
;
fn
borrow
(
v
:
&
int
,
f
:
&
fn
(
x
:
&
int
)
)
{
fn
borrow
(
v
:
&
int
,
f
:
|
x
:
&
int
|
)
{
f
(
v
);
}
...
...
src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
borrow
(
v
:
&
int
,
f
:
&
fn
(
x
:
&
int
)
)
{
fn
borrow
(
v
:
&
int
,
f
:
|
x
:
&
int
|
)
{
f
(
v
);
}
...
...
src/test/compile-fail/borrowck-loan-rcvr.rs
浏览文件 @
40681395
...
...
@@ -12,14 +12,14 @@ struct point { x: int, y: int }
trait
methods
{
fn
impurem
(
&
self
);
fn
blockm
(
&
self
,
f
:
&
fn
()
);
fn
blockm
(
&
self
,
f
:
||
);
}
impl
methods
for
point
{
fn
impurem
(
&
self
)
{
}
fn
blockm
(
&
self
,
f
:
&
fn
()
)
{
f
()
}
fn
blockm
(
&
self
,
f
:
||
)
{
f
()
}
}
fn
a
()
{
...
...
src/test/compile-fail/borrowck-loan-vec-content.rs
浏览文件 @
40681395
...
...
@@ -12,7 +12,7 @@
// (locally rooted) mutable, unique vector, and that we then prevent
// modifications to the contents.
fn
takes_imm_elt
(
_
v
:
&
int
,
f
:
&
fn
()
)
{
fn
takes_imm_elt
(
_
v
:
&
int
,
f
:
||
)
{
f
();
}
...
...
src/test/compile-fail/borrowck-move-in-irrefut-pat.rs
浏览文件 @
40681395
fn
with
(
f
:
&
fn
(
&~
str
)
)
{}
fn
with
(
f
:
|
&~
str
|
)
{}
fn
arg_item
(
&
_
x
:
&~
str
)
{}
//~^ ERROR cannot move out of dereference of & pointer
...
...
src/test/compile-fail/closure-bounds-not-builtin.rs
浏览文件 @
40681395
trait
Foo
{}
fn
take
(
f
:
&
fn
:
Foo
()
)
{
fn
take
(
f
:
||:
Foo
)
{
//~^ ERROR only the builtin traits can be used as closure or object bounds
}
...
...
src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
bar
(
blk
:
&
fn
:
'static
()
)
{
fn
bar
(
blk
:
||:
'static
)
{
}
fn
foo
(
x
:
&
())
{
...
...
src/test/compile-fail/closure-bounds-subtype.rs
浏览文件 @
40681395
fn
take_any
(
_
:
&
fn
:()
)
{
fn
take_any
(
_
:
||:
)
{
}
fn
take_const_owned
(
_
:
&
fn
:
Freeze
+
Send
()
)
{
fn
take_const_owned
(
_
:
||:
Freeze
+
Send
)
{
}
fn
give_any
(
f
:
&
fn
:()
)
{
fn
give_any
(
f
:
||:
)
{
take_any
(
f
);
}
fn
give_owned
(
f
:
&
fn
:
Send
()
)
{
fn
give_owned
(
f
:
||:
Send
)
{
take_any
(
f
);
take_const_owned
(
f
);
//~ ERROR expected bounds `Send+Freeze` but found bounds `Send`
}
...
...
src/test/compile-fail/closure-that-fails.rs
浏览文件 @
40681395
fn
foo
(
f
:
&
fn
()
->
!
)
{}
fn
foo
(
f
:
||
->
!
)
{}
fn
main
()
{
// Type inference didn't use to be able to handle this:
...
...
src/test/compile-fail/do2.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
f
(
f
:
&
fn
(
int
)
->
bool
)
->
bool
{
f
(
10
i
)
}
fn
f
(
f
:
|
int
|
->
bool
)
->
bool
{
f
(
10
i
)
}
fn
main
()
{
assert
!
(
do
f
()
|
i
|
{
i
==
10
i
}
==
10
i
);
...
...
src/test/compile-fail/extern-wrong-value-type.rs
浏览文件 @
40681395
...
...
@@ -14,5 +14,5 @@
fn
main
()
{
// extern functions are extern "C" fn
let
_
x
:
extern
"C"
fn
()
=
f
;
// OK
let
_
x
:
&
fn
()
=
f
;
//~ ERROR mismatched types
let
_
x
:
||
=
f
;
//~ ERROR mismatched types
}
src/test/compile-fail/fn-variance-1.rs
浏览文件 @
40681395
...
...
@@ -13,7 +13,7 @@
fn
takes_mut
(
x
:
@
mut
int
)
{
}
fn
takes_imm
(
x
:
@
int
)
{
}
fn
apply
<
T
>
(
t
:
T
,
f
:
&
fn
(
T
)
)
{
fn
apply
<
T
>
(
t
:
T
,
f
:
|
T
|
)
{
f
(
t
)
}
...
...
src/test/compile-fail/immut-function-arguments.rs
浏览文件 @
40681395
...
...
@@ -13,7 +13,7 @@ fn f(y: ~int) {
}
fn
g
()
{
let
_
frob
:
&
fn
(
~
int
)
=
|
q
|
{
*
q
=
2
;
};
//~ ERROR cannot assign
let
_
frob
:
|
~
int
|
=
|
q
|
{
*
q
=
2
;
};
//~ ERROR cannot assign
}
...
...
src/test/compile-fail/issue-2074.rs
浏览文件 @
40681395
...
...
@@ -10,11 +10,11 @@
// xfail-test
fn
main
()
{
let
one
:
&
fn
()
->
uint
=
||
{
let
one
:
||
->
uint
=
||
{
enum
r
{
a
};
a
as
uint
};
let
two
=
&
fn
()
->
uint
=
||
{
let
two
=
||
->
uint
=
||
{
enum
r
{
a
};
a
as
uint
};
...
...
src/test/compile-fail/issue-2149.rs
浏览文件 @
40681395
...
...
@@ -9,11 +9,11 @@
// except according to those terms.
trait
vec_monad
<
A
>
{
fn
bind
<
B
>
(
&
self
,
f
:
&
fn
(
A
)
->
~
[
B
]);
fn
bind
<
B
>
(
&
self
,
f
:
|
A
|
->
~
[
B
]);
}
impl
<
A
>
vec_monad
<
A
>
for
~
[
A
]
{
fn
bind
<
B
>
(
&
self
,
f
:
&
fn
(
A
)
->
~
[
B
])
{
fn
bind
<
B
>
(
&
self
,
f
:
|
A
|
->
~
[
B
])
{
let
mut
r
=
fail
!
();
for
elt
in
self
.iter
()
{
r
=
r
+
f
(
*
elt
);
}
//~^ ERROR the type of this value must be known
...
...
src/test/compile-fail/issue-5216.rs
浏览文件 @
40681395
...
...
@@ -9,12 +9,12 @@
// except according to those terms.
fn
f
()
{
}
struct
S
(
&
fn
()
);
//~ ERROR missing lifetime specifier
struct
S
(
||
);
//~ ERROR missing lifetime specifier
pub
static
C
:
S
=
S
(
f
);
fn
g
()
{
}
type
T
=
&
fn
()
;
//~ ERROR missing lifetime specifier
type
T
=
||
;
//~ ERROR missing lifetime specifier
pub
static
D
:
T
=
g
;
fn
main
()
{}
src/test/compile-fail/issue-5239-1.rs
浏览文件 @
40681395
...
...
@@ -11,5 +11,5 @@
// Regression test for issue #5239
fn
main
()
{
let
x
:
&
fn
(
int
)
->
int
=
|
ref
x
|
{
x
+=
1
;
};
//~ ERROR binary operation + cannot be applied to type `&int`
let
x
:
|
int
|
->
int
=
|
ref
x
|
{
x
+=
1
;
};
//~ ERROR binary operation + cannot be applied to type `&int`
}
src/test/compile-fail/issue-6762.rs
浏览文件 @
40681395
...
...
@@ -4,20 +4,17 @@
// transferring ownership of the owned box before invoking the stack
// closure results in a crash.
fn
twice
(
x
:
~
uint
)
->
uint
{
fn
twice
(
x
:
~
uint
)
->
uint
{
*
x
*
2
}
fn
invoke
(
f
:
&
fn
()
->
uint
)
{
fn
invoke
(
f
:
||
->
uint
)
{
f
();
}
fn
main
()
{
fn
main
()
{
let
x
:
~
uint
=
~
9
;
let
sq
:
&
fn
()
->
uint
=
||
{
*
x
*
*
x
};
let
sq
:
||
->
uint
=
||
{
*
x
*
*
x
};
twice
(
x
);
invoke
(
sq
);
...
...
src/test/compile-fail/issue-7573.rs
浏览文件 @
40681395
...
...
@@ -35,7 +35,7 @@ pub fn remove_package_from_database() {
}
pub
fn
list_database
(
f
:
&
fn
(
&
PkgId
)
)
{
pub
fn
list_database
(
f
:
|
&
PkgId
|
)
{
let
stuff
=
[
"foo"
,
"bar"
];
for
l
in
stuff
.iter
()
{
...
...
src/test/compile-fail/kindck-freeze.rs
浏览文件 @
40681395
...
...
@@ -45,7 +45,7 @@ fn test<'a,T,U:Freeze>(_: &'a int) {
assert_freeze
::
<&
'a
mut
Dummy
:
Freeze
>
();
//~ ERROR does not fulfill `Freeze`
// closures are like an `&mut` object
assert_freeze
::
<
&
fn
()
>
();
//~ ERROR does not fulfill `Freeze`
assert_freeze
::
<
||
>
();
//~ ERROR does not fulfill `Freeze`
// unsafe ptrs are ok unless they point at unfreezeable things
assert_freeze
::
<*
int
>
();
...
...
src/test/compile-fail/lint-unused-mut-variables.rs
浏览文件 @
40681395
...
...
@@ -55,7 +55,7 @@ fn what(mut foo: int) {} //~ ERROR: variable does not need to be mutable
let
mut
_
allowed
=
1
;
}
fn
callback
(
f
:
&
fn
()
)
{}
fn
callback
(
f
:
||
)
{}
// make sure the lint attribute can be turned off
#[allow(unused_mut)]
...
...
src/test/compile-fail/lint-unused-unsafe.rs
浏览文件 @
40681395
...
...
@@ -18,7 +18,7 @@ mod foo {
}
}
fn
callback
<
T
>
(
_
f
:
&
fn
()
->
T
)
->
T
{
fail
!
()
}
fn
callback
<
T
>
(
_
f
:
||
->
T
)
->
T
{
fail
!
()
}
unsafe
fn
unsf
()
{}
fn
bad1
()
{
unsafe
{}
}
//~ ERROR: unnecessary `unsafe` block
...
...
src/test/compile-fail/liveness-block-unint.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
force
(
f
:
&
fn
()
)
{
f
();
}
fn
force
(
f
:
||
)
{
f
();
}
fn
main
()
{
let
x
:
int
;
force
(||
{
...
...
src/test/compile-fail/liveness-closure-require-ret.rs
浏览文件 @
40681395
...
...
@@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
force
(
f
:
&
fn
()
->
int
)
->
int
{
f
()
}
fn
force
(
f
:
||
->
int
)
->
int
{
f
()
}
fn
main
()
{
info!
(
"{:?}"
,
force
(||
{}));
}
//~ ERROR mismatched types
src/test/compile-fail/liveness-init-in-called-fn-expr.rs
浏览文件 @
40681395
...
...
@@ -9,7 +9,7 @@
// except according to those terms.
fn
main
()
{
let
j
:
&
fn
()
->
int
=
||
{
let
j
:
||
->
int
=
||
{
let
i
:
int
;
i
//~ ERROR use of possibly uninitialized variable: `i`
};
...
...
src/test/compile-fail/liveness-init-in-fn-expr.rs
浏览文件 @
40681395
...
...
@@ -9,7 +9,7 @@
// except according to those terms.
fn
main
()
{
let
f
:
&
fn
()
->
int
=
||
{
let
f
:
||
->
int
=
||
{
let
i
:
int
;
i
//~ ERROR use of possibly uninitialized variable: `i`
};
...
...
src/test/compile-fail/missing-do.rs
浏览文件 @
40681395
...
...
@@ -10,7 +10,7 @@
// Regression test for issue #2783
fn
foo
(
f
:
&
fn
()
)
{
f
()
}
fn
foo
(
f
:
||
)
{
f
()
}
fn
main
()
{
~
""
||
42
;
//~ ERROR binary operation || cannot be applied to type
...
...
src/test/compile-fail/moves-based-on-type-block-bad.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@ enum E {
Baz
}
fn
f
(
s
:
&
S
,
g
:
&
fn
(
&
S
)
)
{
fn
f
(
s
:
&
S
,
g
:
|
&
S
|
)
{
g
(
s
)
}
...
...
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
浏览文件 @
40681395
...
...
@@ -36,7 +36,7 @@ fn innocent_looking_victim() {
}
}
fn
conspirator
(
f
:
&
fn
(
&
R
,
bool
)
)
{
fn
conspirator
(
f
:
|
&
R
,
bool
|
)
{
let
r
=
R
{
c
:
f
};
f
(
&
r
,
false
)
//~ ERROR use of moved value
}
...
...
src/test/compile-fail/omitted-arg-wrong-types.rs
浏览文件 @
40681395
...
...
@@ -9,7 +9,7 @@
// except according to those terms.
// xfail-test - #2093
fn
let_in
<
T
>
(
x
:
T
,
f
:
&
fn
(
T
)
)
{}
fn
let_in
<
T
>
(
x
:
T
,
f
:
|
T
|
)
{}
fn
main
()
{
let_in
(
3u
,
|
i
|
{
assert
!
(
i
==
3
);
});
...
...
src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs
浏览文件 @
40681395
...
...
@@ -15,7 +15,7 @@
use
extra
::
arc
;
use
std
::
util
;
fn
foo
(
blk
:
&
fn
()
)
{
fn
foo
(
blk
:
||
)
{
blk
();
blk
();
}
...
...
src/test/compile-fail/once-fn-subtyping.rs
浏览文件 @
40681395
...
...
@@ -11,7 +11,7 @@
#[feature(once_fns)]
;
fn
main
()
{
let
f
:
&
once
fn
()
=
||();
let
g
:
&
fn
()
=
f
;
//~ ERROR mismatched types
let
h
:
&
fn
()
=
||();
let
g
:
||
=
f
;
//~ ERROR mismatched types
let
h
:
||
=
||();
let
i
:
&
once
fn
()
=
h
;
// ok
}
src/test/compile-fail/qquote-1.rs
浏览文件 @
40681395
...
...
@@ -62,6 +62,6 @@ fn main() {
check_pp
(
expr3
,
pprust
::
print_expr
,
"2 - 23 + 7"
);
}
fn
check_pp
<
T
>
(
expr
:
T
,
f
:
&
fn
(
pprust
::
ps
,
T
)
,
expect
:
str
)
{
fn
check_pp
<
T
>
(
expr
:
T
,
f
:
|
pprust
::
ps
,
T
|
,
expect
:
str
)
{
fail
!
();
}
src/test/compile-fail/qquote-2.rs
浏览文件 @
40681395
...
...
@@ -57,6 +57,6 @@ fn main() {
check_pp
(
*
stmt
,
pprust
::
print_stmt
,
""
);
}
fn
check_pp
<
T
>
(
expr
:
T
,
f
:
&
fn
(
pprust
::
ps
,
T
)
,
expect
:
str
)
{
fn
check_pp
<
T
>
(
expr
:
T
,
f
:
|
pprust
::
ps
,
T
|
,
expect
:
str
)
{
fail
!
();
}
src/test/compile-fail/regionck-closure-lifetimes.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
env
<
'a
>
(
_
:
&
'a
uint
,
blk
:
&
fn
(
p
:
&
'a
fn
())
)
{
fn
env
<
'a
>
(
_
:
&
'a
uint
,
blk
:
|
p
:
'a
|||
)
{
// Test that the closure here cannot be assigned
// the lifetime `'a`, which outlives the current
// block.
...
...
@@ -21,7 +21,7 @@ fn env<'a>(_: &'a uint, blk: &fn(p: &'a fn())) {
blk
(||
*
statep
=
1
);
//~ ERROR cannot infer an appropriate lifetime
}
fn
no_env_no_for
<
'a
>
(
_
:
&
'a
uint
,
blk
:
&
fn
(
p
:
&
'a
fn
())
)
{
fn
no_env_no_for
<
'a
>
(
_
:
&
'a
uint
,
blk
:
|
p
:
'a
|||
)
{
// Test that a closure with no free variables CAN
// outlive the block in which it is created.
//
...
...
src/test/compile-fail/regions-creating-enums.rs
浏览文件 @
40681395
...
...
@@ -27,7 +27,7 @@ fn compute(x: &ast) -> uint {
}
}
fn
map_nums
(
x
:
&
ast
,
f
:
&
fn
(
uint
)
->
uint
)
->
&
ast
{
fn
map_nums
(
x
:
&
ast
,
f
:
|
uint
|
->
uint
)
->
&
ast
{
match
*
x
{
num
(
x
)
=>
{
return
&
num
(
f
(
x
));
//~ ERROR borrowed value does not live long enough
...
...
src/test/compile-fail/regions-escape-bound-fn-2.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
with_int
(
f
:
&
fn
(
x
:
&
int
)
)
{
fn
with_int
(
f
:
|
x
:
&
int
|
)
{
let
x
=
3
;
f
(
&
x
);
}
...
...
src/test/compile-fail/regions-escape-bound-fn.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
with_int
(
f
:
&
fn
(
x
:
&
int
)
)
{
fn
with_int
(
f
:
|
x
:
&
int
|
)
{
let
x
=
3
;
f
(
&
x
);
}
...
...
src/test/compile-fail/regions-escape-via-trait-or-not.rs
浏览文件 @
40681395
...
...
@@ -18,7 +18,7 @@ fn get(self) -> int {
}
}
fn
with
<
R
:
deref
>
(
f
:
&
fn
(
x
:
&
int
)
->
R
)
->
int
{
fn
with
<
R
:
deref
>
(
f
:
|
x
:
&
int
|
->
R
)
->
int
{
f
(
&
3
)
.get
()
}
...
...
src/test/compile-fail/regions-fn-bound.rs
浏览文件 @
40681395
...
...
@@ -11,8 +11,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
of
<
T
>
()
->
&
fn
(
T
)
{
fail
!
();
}
fn
subtype
<
T
>
(
x
:
&
fn
(
T
)
)
{
fail
!
();
}
fn
of
<
T
>
()
->
|
T
|
{
fail
!
();
}
fn
subtype
<
T
>
(
x
:
|
T
|
)
{
fail
!
();
}
fn
test_fn
<
T
>
(
_
x
:
&
'x
T
,
_
y
:
&
'y
T
,
_
z
:
&
'z
T
)
{
// Here, x, y, and z are free. Other letters
...
...
@@ -21,14 +21,14 @@ fn test_fn<T>(_x: &'x T, _y: &'y T, _z: &'z T) {
// iff T1 <: T2.
// should be the default:
subtype
::
<
&
'static
fn
()
>
(
of
::
<&
fn
()
>
());
subtype
::
<
&
fn
()
>
(
of
::
<&
'static
fn
()
>
());
subtype
::
<
'static
||
>
(
of
::
<
||
>
());
subtype
::
<
||
>
(
of
::
<
'static
||
>
());
//
subtype
::
<
&
'x
fn
()
>
(
of
::
<&
fn
()
>
());
//~ ERROR mismatched types
subtype
::
<
&
'x
fn
()
>
(
of
::
<&
'y
fn
()
>
());
//~ ERROR mismatched types
subtype
::
<
'x
||
>
(
of
::
<
||
>
());
//~ ERROR mismatched types
subtype
::
<
'x
||
>
(
of
::
<
'y
||
>
());
//~ ERROR mismatched types
subtype
::
<
&
'x
fn
()
>
(
of
::
<&
'static
fn
()
>
());
//~ ERROR mismatched types
subtype
::
<
&
'static
fn
()
>
(
of
::
<&
'x
fn
()
>
());
subtype
::
<
'x
||
>
(
of
::
<
'static
||
>
());
//~ ERROR mismatched types
subtype
::
<
'static
||
>
(
of
::
<
'x
||
>
());
}
src/test/compile-fail/regions-fn-subtyping.rs
浏览文件 @
40681395
...
...
@@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
of
<
T
>
()
->
&
fn
(
T
)
{
fail
!
();
}
fn
subtype
<
T
>
(
x
:
&
fn
(
T
)
)
{
fail
!
();
}
fn
of
<
T
>
()
->
|
T
|
{
fail
!
();
}
fn
subtype
<
T
>
(
x
:
|
T
|
)
{
fail
!
();
}
fn
test_fn
<
'x
,
'y
,
'z
,
T
>
(
_
x
:
&
'x
T
,
_
y
:
&
'y
T
,
_
z
:
&
'z
T
)
{
// Here, x, y, and z are free. Other letters
...
...
@@ -17,29 +17,29 @@ fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) {
// subtype::<T1>(of::<T2>()) will typecheck
// iff T1 <: T2.
subtype
::
<
&
fn
<
'a
>
(
&
'a
T
)
>
(
of
::
<
&
fn
<
'a
>
(
&
'a
T
)
>
());
subtype
::
<
<
'a
>
|
&
'a
T
|
>
(
of
::
<
<
'a
>
|
&
'a
T
|
>
());
subtype
::
<
&
fn
<
'a
>
(
&
'a
T
)
>
(
of
::
<
&
fn
<
'b
>
(
&
'b
T
)
>
());
subtype
::
<
<
'a
>
|
&
'a
T
|
>
(
of
::
<
<
'b
>
|
&
'b
T
|
>
());
subtype
::
<
&
fn
<
'b
>
(
&
'b
T
)
>
(
of
::
<
&
fn
(
&
'x
T
)
>
());
subtype
::
<
<
'b
>
|
&
'b
T
|
>
(
of
::
<
|
&
'x
T
|
>
());
subtype
::
<
&
fn
(
&
'x
T
)
>
(
of
::
<
&
fn
<
'b
>
(
&
'b
T
)
>
());
//~ ERROR mismatched types
subtype
::
<
|
&
'x
T
|
>
(
of
::
<
<
'b
>
|
&
'b
T
|
>
());
//~ ERROR mismatched types
subtype
::
<
&
fn
<
'a
,
'b
>
(
&
'a
T
,
&
'b
T
)
>
(
of
::
<
&
fn
<
'a
>
(
&
'a
T
,
&
'a
T
)
>
());
subtype
::
<
<
'a
,
'b
>
|
&
'a
T
,
&
'b
T
|
>
(
of
::
<
<
'a
>
|
&
'a
T
,
&
'a
T
|
>
());
subtype
::
<
&
fn
<
'a
>
(
&
'a
T
,
&
'a
T
)
>
(
of
::
<
&
fn
<
'a
,
'b
>
(
&
'a
T
,
&
'b
T
)
>
());
//~ ERROR mismatched types
subtype
::
<
<
'a
>
|
&
'a
T
,
&
'a
T
|
>
(
of
::
<
<
'a
,
'b
>
|
&
'a
T
,
&
'b
T
|
>
());
//~ ERROR mismatched types
subtype
::
<
&
fn
<
'a
,
'b
>
(
&
'a
T
,
&
'b
T
)
>
(
of
::
<
&
fn
(
&
'x
T
,
&
'y
T
)
>
());
subtype
::
<
<
'a
,
'b
>
|
&
'a
T
,
&
'b
T
|
>
(
of
::
<
|
&
'x
T
,
&
'y
T
|
>
());
subtype
::
<
&
fn
(
&
'x
T
,
&
'y
T
)
>
(
of
::
<
&
fn
<
'a
,
'b
>
(
&
'a
T
,
&
'b
T
)
>
());
//~ ERROR mismatched types
subtype
::
<
|
&
'x
T
,
&
'y
T
|
>
(
of
::
<
<
'a
,
'b
>
|
&
'a
T
,
&
'b
T
|
>
());
//~ ERROR mismatched types
}
fn
main
()
{}
src/test/compile-fail/regions-fns.rs
浏览文件 @
40681395
...
...
@@ -12,7 +12,7 @@
// we reported errors in this case:
fn
not_ok
<
'b
>
(
a
:
&
uint
,
b
:
&
'b
uint
)
{
let
mut
g
:
&
fn
(
x
:
&
uint
)
=
|
x
:
&
'b
uint
|
{};
let
mut
g
:
|
x
:
&
uint
|
=
|
x
:
&
'b
uint
|
{};
//~^ ERROR mismatched types
g
(
a
);
}
...
...
src/test/compile-fail/regions-free-region-ordering-callee.rs
浏览文件 @
40681395
...
...
@@ -30,7 +30,7 @@ fn ordering3<'a, 'b>(x: &'a uint, y: &'b uint) -> &'a &'b uint {
fail
!
();
}
fn
ordering4
<
'a
,
'b
>
(
a
:
&
'a
uint
,
b
:
&
'b
uint
,
x
:
&
fn
(
&
'a
&
'b
uint
)
)
{
fn
ordering4
<
'a
,
'b
>
(
a
:
&
'a
uint
,
b
:
&
'b
uint
,
x
:
|
&
'a
&
'b
uint
|
)
{
let
z
:
Option
<&
'a
&
'b
uint
>
=
None
;
}
...
...
src/test/compile-fail/regions-free-region-ordering-caller.rs
浏览文件 @
40681395
...
...
@@ -26,7 +26,7 @@ fn call3<'a, 'b>(a: &'a uint, b: &'b uint) {
}
fn
call4
<
'a
,
'b
>
(
a
:
&
'a
uint
,
b
:
&
'b
uint
)
{
let
z
:
Option
<
&
fn
(
&
'a
&
'b
uint
)
>
=
None
;
let
z
:
Option
<
|
&
'a
&
'b
uint
|
>
=
None
;
//~^ ERROR pointer has a longer lifetime than the data it references
}
...
...
src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
浏览文件 @
40681395
...
...
@@ -12,7 +12,7 @@
fn
borrow
<
'r
,
T
>
(
x
:
&
'r
T
)
->
&
'r
T
{
x
}
fn
foo
(
cond
:
&
fn
()
->
bool
,
box
:
&
fn
()
->
@
int
)
{
fn
foo
(
cond
:
||
->
bool
,
box
:
||
->
@
int
)
{
let
mut
y
:
&
int
;
loop
{
let
x
=
box
();
...
...
src/test/compile-fail/regions-infer-call-3.rs
浏览文件 @
40681395
...
...
@@ -10,7 +10,7 @@
fn
select
<
'r
>
(
x
:
&
'r
int
,
y
:
&
'r
int
)
->
&
'r
int
{
x
}
fn
with
<
T
>
(
f
:
&
fn
(
x
:
&
int
)
->
T
)
->
T
{
fn
with
<
T
>
(
f
:
|
x
:
&
int
|
->
T
)
->
T
{
f
(
&
20
)
}
...
...
src/test/compile-fail/regions-name-undeclared.rs
浏览文件 @
40681395
...
...
@@ -43,16 +43,16 @@ fn f(a: &'a int) { } //~ ERROR undeclared lifetime
// &'a CAN be declared on functions and used then:
fn
g
<
'a
>
(
a
:
&
'a
int
)
{
}
// OK
fn
h
(
a
:
&
fn
<
'a
>
(
&
'a
int
)
)
{
}
// OK
fn
h
(
a
:
<
'a
>
|
&
'a
int
|
)
{
}
// OK
}
// Test nesting of lifetimes in fn type declarations
fn
fn_types
(
a
:
&
'a
int
,
//~ ERROR undeclared lifetime
b
:
&
fn
<
'a
>
(
a
:
&
'a
int
,
b
:
&
'b
int
,
//~ ERROR undeclared lifetime
c
:
&
fn
<
'b
>
(
a
:
&
'a
int
,
b
:
&
'b
int
)
,
d
:
&
'b
int
)
,
//~ ERROR undeclared lifetime
b
:
<
'a
>
|
a
:
&
'a
int
,
b
:
&
'b
int
,
//~ ERROR undeclared lifetime
c
:
<
'b
>
|
a
:
&
'a
int
,
b
:
&
'b
int
|
,
d
:
&
'b
int
|
,
//~ ERROR undeclared lifetime
c
:
&
'a
int
)
//~ ERROR undeclared lifetime
{
}
...
...
src/test/compile-fail/regions-nested-fns-2.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
ignore
(
_
f
:
&
fn
<
'z
>
(
&
'z
int
)
->
&
'z
int
)
{}
fn
ignore
(
_
f
:
<
'z
>
|
&
'z
int
|
->
&
'z
int
)
{}
fn
nested
()
{
let
y
=
3
;
...
...
src/test/compile-fail/regions-nested-fns.rs
浏览文件 @
40681395
...
...
@@ -14,13 +14,13 @@ fn nested<'x>(x: &'x int) {
let
y
=
3
;
let
mut
ay
=
&
y
;
//~ ERROR cannot infer an appropriate lifetime
ignore
::
<
&
fn
<
'z
>
(
&
'z
int
)
>
(|
z
|
{
ignore
::
<
<
'z
>
|
&
'z
int
|
>
(|
z
|
{
ay
=
x
;
ay
=
&
y
;
ay
=
z
;
});
ignore
::
<
&
fn
<
'z
>
(
&
'z
int
)
->
&
'z
int
>
(|
z
|
{
ignore
::
<
<
'z
>
|
&
'z
int
|
->
&
'z
int
>
(|
z
|
{
if
false
{
return
x
;
}
//~ ERROR mismatched types
//~^ ERROR cannot infer an appropriate lifetime
if
false
{
return
ay
;
}
...
...
src/test/compile-fail/regions-ref-in-fn-arg.rs
浏览文件 @
40681395
...
...
@@ -2,7 +2,7 @@ fn arg_item(~ref x: ~int) -> &'static int {
x
//~^ ERROR borrowed value does not live long enough
}
fn
with
<
R
>
(
f
:
&
fn
(
~
int
)
->
R
)
->
R
{
f
(
~
3
)
}
fn
with
<
R
>
(
f
:
|
~
int
|
->
R
)
->
R
{
f
(
~
3
)
}
fn
arg_closure
()
->
&
'static
int
{
with
(|
~
ref
x
|
x
)
//~ ERROR borrowed value does not live long enough
...
...
src/test/compile-fail/regions-ret-borrowed-1.rs
浏览文件 @
40681395
...
...
@@ -12,7 +12,7 @@
// some point regions-ret-borrowed reported an error but this file did
// not, due to special hardcoding around the anonymous region.
fn
with
<
R
>
(
f
:
&
fn
<
'a
>
(
x
:
&
'a
int
)
->
R
)
->
R
{
fn
with
<
R
>
(
f
:
<
'a
>
|
x
:
&
'a
int
|
->
R
)
->
R
{
f
(
&
3
)
}
...
...
src/test/compile-fail/regions-ret-borrowed.rs
浏览文件 @
40681395
...
...
@@ -15,7 +15,7 @@
// used to successfully compile because we failed to account for the
// fact that fn(x: &int) rebound the region &.
fn
with
<
R
>
(
f
:
&
fn
(
x
:
&
int
)
->
R
)
->
R
{
fn
with
<
R
>
(
f
:
|
x
:
&
int
|
->
R
)
->
R
{
f
(
&
3
)
}
...
...
src/test/compile-fail/type-arg-out-of-scope.rs
浏览文件 @
40681395
...
...
@@ -10,6 +10,6 @@
// error-pattern:attempt to use a type argument out of scope
fn
foo
<
T
>
(
x
:
T
)
{
fn
bar
(
f
:
&
fn
(
T
)
->
T
)
{
}
fn
bar
(
f
:
|
T
|
->
T
)
{
}
}
fn
main
()
{
foo
(
1
);
}
src/test/debug-info/lexical-scope-in-stack-closure.rs
浏览文件 @
40681395
...
...
@@ -51,7 +51,7 @@ fn main() {
zzz
();
sentinel
();
let
stack_closure
:
&
fn
(
int
)
=
|
x
|
{
let
stack_closure
:
|
int
|
=
|
x
|
{
zzz
();
sentinel
();
...
...
src/test/run-fail/unwind-iter.rs
浏览文件 @
40681395
...
...
@@ -13,7 +13,7 @@
#[allow(unreachable_code)]
;
#[allow(unused_variable)]
;
fn
x
(
it
:
&
fn
(
int
)
)
{
fn
x
(
it
:
|
int
|
)
{
fail
!
();
it
(
0
);
}
...
...
src/test/run-fail/unwind-iter2.rs
浏览文件 @
40681395
...
...
@@ -10,7 +10,7 @@
// error-pattern:fail
fn
x
(
it
:
&
fn
(
int
)
)
{
fn
x
(
it
:
|
int
|
)
{
let
_
a
=
@
0
;
it
(
1
);
}
...
...
src/test/run-fail/unwind-lambda.rs
浏览文件 @
40681395
...
...
@@ -16,13 +16,13 @@ fn main() {
let
cheese
=
~
"roquefort"
;
let
carrots
=
@~
"crunchy"
;
let
result
:
&
'static
fn
(
@~
str
,
&
fn
(
~
str
)
)
=
(|
tasties
,
macerate
|
{
let
result
:
&
'static
fn
(
@~
str
,
|
~
str
|
)
=
(|
tasties
,
macerate
|
{
macerate
((
*
tasties
)
.clone
());
});
result
(
carrots
,
|
food
|
{
let
mush
=
food
+
cheese
;
let
cheese
=
cheese
.clone
();
let
f
:
&
fn
()
=
||
{
let
f
:
||
=
||
{
let
_
chew
=
mush
+
cheese
;
fail
!
(
"so yummy"
)
};
...
...
src/test/run-pass-fulldeps/qquote.rs
浏览文件 @
40681395
...
...
@@ -74,7 +74,7 @@ fn main() {
}
fn
check_pp
<
T
>
(
cx
:
fake_ext_ctxt
,
expr
:
T
,
f
:
&
fn
(
pprust
::
ps
,
T
)
,
expect
:
~
str
)
{
expr
:
T
,
f
:
|
pprust
::
ps
,
T
|
,
expect
:
~
str
)
{
let
s
=
do
io
::
with_str_writer
|
wr
|
{
let
pp
=
pprust
::
rust_printer
(
wr
,
cx
.parse_sess
()
.interner
);
f
(
pp
,
expr
);
...
...
src/test/run-pass/argument-passing.rs
浏览文件 @
40681395
...
...
@@ -21,7 +21,7 @@ fn f1(a: &mut X, b: &mut int, c: int) -> int {
return
r
;
}
fn
f2
(
a
:
int
,
f
:
&
fn
(
int
)
)
->
int
{
f
(
1
);
return
a
;
}
fn
f2
(
a
:
int
,
f
:
|
int
|
)
->
int
{
f
(
1
);
return
a
;
}
pub
fn
main
()
{
let
mut
a
=
X
{
x
:
1
};
...
...
src/test/run-pass/assignability-trait.rs
浏览文件 @
40681395
...
...
@@ -13,17 +13,17 @@
// it.
trait
iterable
<
A
>
{
fn
iterate
(
&
self
,
blk
:
&
fn
(
x
:
&
A
)
->
bool
)
->
bool
;
fn
iterate
(
&
self
,
blk
:
|
x
:
&
A
|
->
bool
)
->
bool
;
}
impl
<
'self
,
A
>
iterable
<
A
>
for
&
'self
[
A
]
{
fn
iterate
(
&
self
,
f
:
&
fn
(
x
:
&
A
)
->
bool
)
->
bool
{
fn
iterate
(
&
self
,
f
:
|
x
:
&
A
|
->
bool
)
->
bool
{
self
.iter
()
.advance
(
f
)
}
}
impl
<
A
>
iterable
<
A
>
for
~
[
A
]
{
fn
iterate
(
&
self
,
f
:
&
fn
(
x
:
&
A
)
->
bool
)
->
bool
{
fn
iterate
(
&
self
,
f
:
|
x
:
&
A
|
->
bool
)
->
bool
{
self
.iter
()
.advance
(
f
)
}
}
...
...
src/test/run-pass/autobind.rs
浏览文件 @
40681395
...
...
@@ -10,10 +10,10 @@
fn
f
<
T
>
(
x
:
~
[
T
])
->
T
{
return
x
[
0
];
}
fn
g
(
act
:
&
fn
(
~
[
int
])
->
int
)
->
int
{
return
act
(
~
[
1
,
2
,
3
]);
}
fn
g
(
act
:
|
~
[
int
]|
->
int
)
->
int
{
return
act
(
~
[
1
,
2
,
3
]);
}
pub
fn
main
()
{
assert_eq!
(
g
(
f
),
1
);
let
f1
:
&
fn
(
~
[
~
str
])
->
~
str
=
f
;
let
f1
:
|
~
[
~
str
]|
->
~
str
=
f
;
assert_eq!
(
f1
(
~
[
~
"x"
,
~
"y"
,
~
"z"
]),
~
"x"
);
}
src/test/run-pass/block-arg-call-as.rs
浏览文件 @
40681395
...
...
@@ -10,11 +10,11 @@
extern
mod
extra
;
fn
asSendfn
(
f
:
proc
()
->
uint
)
->
uint
{
fn
asSendfn
(
f
:
proc
()
->
uint
)
->
uint
{
return
f
();
}
fn
asBlock
(
f
:
&
fn
()
->
uint
)
->
uint
{
fn
asBlock
(
f
:
||
->
uint
)
->
uint
{
return
f
();
}
...
...
src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs
浏览文件 @
40681395
...
...
@@ -9,7 +9,7 @@
// except according to those terms.
pub
fn
main
()
{
fn
f
(
i
:
&
fn
()
->
uint
)
->
uint
{
i
()
}
fn
f
(
i
:
||
->
uint
)
->
uint
{
i
()
}
let
v
=
~
[
-
1.0
,
0.0
,
1.0
,
2.0
,
3.0
];
let
z
=
do
do
v
.iter
()
.fold
(
f
)
|
x
,
_
y
|
{
x
}
{
22u
};
assert_eq!
(
z
,
22u
);
...
...
src/test/run-pass/block-arg-used-as-any.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
call_any
(
f
:
&
fn
()
->
uint
)
->
uint
{
fn
call_any
(
f
:
||
->
uint
)
->
uint
{
return
f
();
}
...
...
src/test/run-pass/block-explicit-types.rs
浏览文件 @
40681395
...
...
@@ -9,6 +9,6 @@
// except according to those terms.
pub
fn
main
()
{
fn
as_buf
<
T
>
(
s
:
~
str
,
f
:
&
fn
(
~
str
)
->
T
)
->
T
{
f
(
s
)
}
fn
as_buf
<
T
>
(
s
:
~
str
,
f
:
|
~
str
|
->
T
)
->
T
{
f
(
s
)
}
as_buf
(
~
"foo"
,
|
foo
:
~
str
|
->
()
error!
(
"{}"
,
foo
)
);
}
src/test/run-pass/block-fn-coerce.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
force
(
f
:
&
fn
()
->
int
)
->
int
{
return
f
();
}
fn
force
(
f
:
||
->
int
)
->
int
{
return
f
();
}
pub
fn
main
()
{
fn
f
()
->
int
{
return
7
;
}
assert_eq!
(
force
(
f
),
7
);
...
...
src/test/run-pass/block-iter-1.rs
浏览文件 @
40681395
...
...
@@ -10,7 +10,7 @@
// xfail-fast
fn
iter_vec
<
T
>
(
v
:
~
[
T
],
f
:
&
fn
(
&
T
)
)
{
for
x
in
v
.iter
()
{
f
(
x
);
}
}
fn
iter_vec
<
T
>
(
v
:
~
[
T
],
f
:
|
&
T
|
)
{
for
x
in
v
.iter
()
{
f
(
x
);
}
}
pub
fn
main
()
{
let
v
=
~
[
1
,
2
,
3
,
4
,
5
,
6
,
7
];
...
...
src/test/run-pass/block-iter-2.rs
浏览文件 @
40681395
...
...
@@ -10,7 +10,7 @@
// xfail-fast
fn
iter_vec
<
T
>
(
v
:
~
[
T
],
f
:
&
fn
(
&
T
)
)
{
for
x
in
v
.iter
()
{
f
(
x
);
}
}
fn
iter_vec
<
T
>
(
v
:
~
[
T
],
f
:
|
&
T
|
)
{
for
x
in
v
.iter
()
{
f
(
x
);
}
}
pub
fn
main
()
{
let
v
=
~
[
1
,
2
,
3
,
4
,
5
];
...
...
src/test/run-pass/borrowck-borrow-from-expr-block.rs
浏览文件 @
40681395
...
...
@@ -13,7 +13,7 @@
use
std
::
borrow
;
use
std
::
ptr
;
fn
borrow
(
x
:
&
int
,
f
:
&
fn
(
x
:
&
int
)
)
{
fn
borrow
(
x
:
&
int
,
f
:
|
x
:
&
int
|
)
{
f
(
x
)
}
...
...
src/test/run-pass/borrowck-mut-uniq.rs
浏览文件 @
40681395
...
...
@@ -20,7 +20,7 @@ fn add_int(x: &mut Ints, v: int) {
util
::
swap
(
&
mut
values
,
&
mut
x
.values
);
}
fn
iter_ints
(
x
:
&
Ints
,
f
:
&
fn
(
x
:
&
int
)
->
bool
)
->
bool
{
fn
iter_ints
(
x
:
&
Ints
,
f
:
|
x
:
&
int
|
->
bool
)
->
bool
{
let
l
=
x
.values
.len
();
range
(
0u
,
l
)
.advance
(|
i
|
f
(
&
x
.values
[
i
]))
}
...
...
src/test/run-pass/borrowck-preserve-box-in-field.rs
浏览文件 @
40681395
...
...
@@ -12,7 +12,7 @@
use
std
::
ptr
;
fn
borrow
(
x
:
&
int
,
f
:
&
fn
(
x
:
&
int
)
)
{
fn
borrow
(
x
:
&
int
,
f
:
|
x
:
&
int
|
)
{
let
before
=
*
x
;
f
(
x
);
let
after
=
*
x
;
...
...
src/test/run-pass/borrowck-preserve-box-in-uniq.rs
浏览文件 @
40681395
...
...
@@ -12,7 +12,7 @@
use
std
::
ptr
;
fn
borrow
(
x
:
&
int
,
f
:
&
fn
(
x
:
&
int
)
)
{
fn
borrow
(
x
:
&
int
,
f
:
|
x
:
&
int
|
)
{
let
before
=
*
x
;
f
(
x
);
let
after
=
*
x
;
...
...
src/test/run-pass/borrowck-preserve-box.rs
浏览文件 @
40681395
...
...
@@ -12,7 +12,7 @@
use
std
::
ptr
;
fn
borrow
(
x
:
&
int
,
f
:
&
fn
(
x
:
&
int
)
)
{
fn
borrow
(
x
:
&
int
,
f
:
|
x
:
&
int
|
)
{
let
before
=
*
x
;
f
(
x
);
let
after
=
*
x
;
...
...
src/test/run-pass/borrowck-preserve-expl-deref.rs
浏览文件 @
40681395
...
...
@@ -12,7 +12,7 @@
use
std
::
ptr
;
fn
borrow
(
x
:
&
int
,
f
:
&
fn
(
x
:
&
int
)
)
{
fn
borrow
(
x
:
&
int
,
f
:
|
x
:
&
int
|
)
{
let
before
=
*
x
;
f
(
x
);
let
after
=
*
x
;
...
...
src/test/run-pass/closure-inference.rs
浏览文件 @
40681395
...
...
@@ -12,7 +12,7 @@
fn
foo
(
i
:
int
)
->
int
{
i
+
1
}
fn
apply
<
A
>
(
f
:
&
fn
(
A
)
->
A
,
v
:
A
)
->
A
{
f
(
v
)
}
fn
apply
<
A
>
(
f
:
|
A
|
->
A
,
v
:
A
)
->
A
{
f
(
v
)
}
pub
fn
main
()
{
let
f
=
{|
i
|
foo
(
i
)};
...
...
src/test/run-pass/do-empty-args.rs
浏览文件 @
40681395
...
...
@@ -11,7 +11,7 @@
// no-reformat
// Testing various forms of `do` with empty arg lists
fn
f
(
_
f
:
&
fn
()
->
bool
)
->
bool
{
fn
f
(
_
f
:
||
->
bool
)
->
bool
{
true
}
...
...
src/test/run-pass/do-no-args.rs
浏览文件 @
40681395
...
...
@@ -10,9 +10,9 @@
// Testing that we can drop the || in do exprs
fn
f
(
_
f
:
&
fn
()
->
bool
)
->
bool
{
true
}
fn
f
(
_
f
:
||
->
bool
)
->
bool
{
true
}
fn
d
(
_
f
:
&
fn
()
)
{
}
fn
d
(
_
f
:
||
)
{
}
pub
fn
main
()
{
do
d
{
}
...
...
src/test/run-pass/do-pure.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
f
(
_
f
:
&
fn
()
)
{
fn
f
(
_
f
:
||
)
{
}
fn
g
()
{
...
...
src/test/run-pass/do-stack.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
f
(
f
:
&
fn
(
int
)
)
{
f
(
10
)
}
fn
f
(
f
:
|
int
|
)
{
f
(
10
)
}
pub
fn
main
()
{
do
f
()
|
i
|
{
assert
!
(
i
==
10
)
}
...
...
src/test/run-pass/do1.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
f
(
f
:
&
fn
(
int
)
)
{
f
(
10
)
}
fn
f
(
f
:
|
int
|
)
{
f
(
10
)
}
pub
fn
main
()
{
do
f
()
|
i
|
{
assert
!
(
i
==
10
)
}
...
...
src/test/run-pass/do2.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
f
(
f
:
&
fn
(
int
)
->
int
)
->
int
{
f
(
10
)
}
fn
f
(
f
:
|
int
|
->
int
)
->
int
{
f
(
10
)
}
pub
fn
main
()
{
assert_eq!
(
do
f
()
|
i
|
{
i
},
10
);
...
...
src/test/run-pass/do3.rs
浏览文件 @
40681395
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn
f
(
f
:
&
fn
(
int
)
->
int
)
->
int
{
f
(
10
)
}
fn
f
(
f
:
|
int
|
->
int
)
->
int
{
f
(
10
)
}
pub
fn
main
()
{
assert_eq!
(
do
f
|
i
|
{
i
},
10
);
...
...
src/test/run-pass/fn-bare-coerce-to-block.rs
浏览文件 @
40681395
...
...
@@ -10,7 +10,7 @@
fn
bare
()
{}
fn
likes_block
(
f
:
&
fn
()
)
{
f
()
}
fn
likes_block
(
f
:
||
)
{
f
()
}
pub
fn
main
()
{
likes_block
(
bare
);
...
...
src/test/run-pass/fn-pattern-expected-type.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/fn-type-infer.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/foreach-nested.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/foreach-put-structured.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/foreach-simple-outer-slot.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/fun-call-variants.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/generic-static-methods.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-1458.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-2185.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-2190-2.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-2487-a.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-3429.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-3796.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-3874.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-3904.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-5239-2.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-6153.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/issue-868.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/iter-range.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/lambda-infer-unresolved.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/last-use-in-block.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/last-use-is-capture.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/match-phi.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/monad.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/move-nullary-fn.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/mut-function-arguments.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/newlambdas.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/non-legacy-modes.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/purity-infer.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/reflect-visit-data.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/regions-fn-subtyping-2.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/regions-fn-subtyping.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/regions-infer-call-2.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/regions-params.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/sendfn-is-a-block.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/static-impl.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/task-killjoin-rsrc.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/tempfile.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/trait-bounds-in-arc.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/trait-generic.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/type-params-in-for-each.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/unnamed_argument_mode.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/unused-move-capture.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/variadic-ffi.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
src/test/run-pass/vec-matching-fold.rs
浏览文件 @
40681395
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录