Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ee584249
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,发现更多精彩内容 >>
提交
ee584249
编写于
3月 15, 2013
作者:
B
Ben Striegel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clonify some of run-pass
上级
748c2c9e
变更
39
隐藏空白更改
内联
并排
Showing
39 changed file
with
64 addition
and
61 deletion
+64
-61
src/test/run-pass/alt-value-binding-in-guard-3291.rs
src/test/run-pass/alt-value-binding-in-guard-3291.rs
+1
-1
src/test/run-pass/assignability-trait.rs
src/test/run-pass/assignability-trait.rs
+1
-1
src/test/run-pass/block-iter-2.rs
src/test/run-pass/block-iter-2.rs
+2
-2
src/test/run-pass/block-vec-map2.rs
src/test/run-pass/block-vec-map2.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-preserve-box-sometimes-needed.rs
src/test/run-pass/borrowck-preserve-box-sometimes-needed.rs
+1
-1
src/test/run-pass/class-exports.rs
src/test/run-pass/class-exports.rs
+1
-1
src/test/run-pass/class-implement-traits.rs
src/test/run-pass/class-implement-traits.rs
+1
-1
src/test/run-pass/class-separate-impl.rs
src/test/run-pass/class-separate-impl.rs
+6
-3
src/test/run-pass/expr-alt-generic-unique1.rs
src/test/run-pass/expr-alt-generic-unique1.rs
+2
-2
src/test/run-pass/expr-alt-generic-unique2.rs
src/test/run-pass/expr-alt-generic-unique2.rs
+2
-2
src/test/run-pass/expr-block-generic-unique1.rs
src/test/run-pass/expr-block-generic-unique1.rs
+2
-2
src/test/run-pass/generic-alias-unique.rs
src/test/run-pass/generic-alias-unique.rs
+1
-1
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/hashmap-memory.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-2633-2.rs
src/test/run-pass/issue-2633-2.rs
+1
-1
src/test/run-pass/issue-3389.rs
src/test/run-pass/issue-3389.rs
+1
-1
src/test/run-pass/issue-3609.rs
src/test/run-pass/issue-3609.rs
+1
-1
src/test/run-pass/issue-4541.rs
src/test/run-pass/issue-4541.rs
+1
-1
src/test/run-pass/issue-4542.rs
src/test/run-pass/issue-4542.rs
+1
-1
src/test/run-pass/istr.rs
src/test/run-pass/istr.rs
+2
-2
src/test/run-pass/last-use-in-cap-clause.rs
src/test/run-pass/last-use-in-cap-clause.rs
+1
-1
src/test/run-pass/last-use-is-capture.rs
src/test/run-pass/last-use-is-capture.rs
+2
-2
src/test/run-pass/monad.rs
src/test/run-pass/monad.rs
+2
-2
src/test/run-pass/propagate-expected-type-through-block.rs
src/test/run-pass/propagate-expected-type-through-block.rs
+1
-1
src/test/run-pass/rec-auto.rs
src/test/run-pass/rec-auto.rs
+2
-2
src/test/run-pass/reflect-visit-data.rs
src/test/run-pass/reflect-visit-data.rs
+2
-2
src/test/run-pass/reflect-visit-type.rs
src/test/run-pass/reflect-visit-type.rs
+1
-1
src/test/run-pass/ret-break-cont-in-block.rs
src/test/run-pass/ret-break-cont-in-block.rs
+4
-4
src/test/run-pass/stat.rs
src/test/run-pass/stat.rs
+1
-1
src/test/run-pass/str-append.rs
src/test/run-pass/str-append.rs
+3
-3
src/test/run-pass/str-concat.rs
src/test/run-pass/str-concat.rs
+1
-1
src/test/run-pass/syntax-extension-fmt.rs
src/test/run-pass/syntax-extension-fmt.rs
+2
-2
src/test/run-pass/trait-generic.rs
src/test/run-pass/trait-generic.rs
+1
-1
src/test/run-pass/unique-assign-copy.rs
src/test/run-pass/unique-assign-copy.rs
+1
-1
src/test/run-pass/unique-decl-init-copy.rs
src/test/run-pass/unique-decl-init-copy.rs
+1
-1
src/test/run-pass/unique-in-vec-copy.rs
src/test/run-pass/unique-in-vec-copy.rs
+1
-1
src/test/run-pass/vec-ivec-deadlock.rs
src/test/run-pass/vec-ivec-deadlock.rs
+1
-1
src/test/run-pass/vec-matching-fold.rs
src/test/run-pass/vec-matching-fold.rs
+4
-4
未找到文件。
src/test/run-pass/alt-value-binding-in-guard-3291.rs
浏览文件 @
ee584249
...
...
@@ -11,7 +11,7 @@
fn
foo
(
x
:
Option
<~
int
>
,
b
:
bool
)
->
int
{
match
x
{
None
=>
{
1
}
Some
(
copy
x
)
if
b
=>
{
*
x
}
Some
(
ref
x
)
if
b
=>
{
*
x
.clone
()
}
Some
(
_
)
=>
{
0
}
}
}
...
...
src/test/run-pass/assignability-trait.rs
浏览文件 @
ee584249
...
...
@@ -43,7 +43,7 @@ pub fn main() {
// Call a method
for
x
.iterate
()
|
y
|
{
fail_unless!
(
x
[
*
y
]
==
*
y
);
}
// Call a parameterized function
fail_unless!
(
length
(
copy
x
)
==
vec
::
len
(
x
));
fail_unless!
(
length
(
x
.clone
()
)
==
vec
::
len
(
x
));
// Call a parameterized function, with type arguments that require
// a borrow
fail_unless!
(
length
::
<
int
,
&
[
int
]
>
(
x
)
==
vec
::
len
(
x
));
...
...
src/test/run-pass/block-iter-2.rs
浏览文件 @
ee584249
...
...
@@ -15,8 +15,8 @@
pub
fn
main
()
{
let
v
=
~
[
1
,
2
,
3
,
4
,
5
];
let
mut
sum
=
0
;
iter_vec
(
copy
v
,
|
i
|
{
iter_vec
(
copy
v
,
|
j
|
{
iter_vec
(
v
.clone
()
,
|
i
|
{
iter_vec
(
v
.clone
()
,
|
j
|
{
sum
+=
*
i
*
*
j
;
});
});
...
...
src/test/run-pass/block-vec-map2.rs
浏览文件 @
ee584249
...
...
@@ -15,6 +15,6 @@ pub fn main() {
vec
::
map2
(
~
[
1
,
2
,
3
,
4
,
5
],
~
[
true
,
false
,
false
,
true
,
true
],
|
i
,
b
|
if
*
b
{
-
(
*
i
)
}
else
{
*
i
}
);
error!
(
copy
v
);
error!
(
v
.clone
()
);
fail_unless!
((
v
==
~
[
-
1
,
2
,
3
,
-
4
,
-
5
]));
}
src/test/run-pass/borrowck-borrow-from-expr-block.rs
浏览文件 @
ee584249
...
...
@@ -13,7 +13,7 @@ fn borrow(x: &int, f: &fn(x: &int)) {
}
fn
test1
(
x
:
@~
int
)
{
do
borrow
(
copy
*
x
)
|
p
|
{
do
borrow
(
&*
x
.clone
()
)
|
p
|
{
let
x_a
=
ptr
::
addr_of
(
&
(
**
x
));
fail_unless!
((
x_a
as
uint
)
!=
ptr
::
to_uint
(
p
));
fail_unless!
(
unsafe
{
*
x_a
}
==
*
p
);
...
...
src/test/run-pass/borrowck-preserve-box-sometimes-needed.rs
浏览文件 @
ee584249
...
...
@@ -13,7 +13,7 @@
fn
switcher
(
x
:
Option
<@
int
>
)
{
let
mut
x
=
x
;
match
x
{
Some
(
@
y
)
=>
{
copy
y
;
x
=
None
;
}
Some
(
@
y
)
=>
{
y
.clone
()
;
x
=
None
;
}
None
=>
{
}
}
}
...
...
src/test/run-pass/class-exports.rs
浏览文件 @
ee584249
...
...
@@ -22,7 +22,7 @@ pub struct cat {
}
pub
impl
cat
{
fn
get_name
(
&
self
)
->
~
str
{
copy
self
.name
}
fn
get_name
(
&
self
)
->
~
str
{
self
.name
.clone
()
}
}
pub
fn
cat
(
in_name
:
~
str
)
->
cat
{
...
...
src/test/run-pass/class-implement-traits.rs
浏览文件 @
ee584249
...
...
@@ -53,7 +53,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat
{
meows
:
in_x
,
how_hungry
:
in_y
,
name
:
copy
in_name
name
:
in_name
.clone
()
}
}
...
...
src/test/run-pass/class-separate-impl.rs
浏览文件 @
ee584249
...
...
@@ -9,8 +9,6 @@
// except according to those terms.
// xfail-fast
use
core
::
to_str
::
*
;
struct
cat
{
priv
meows
:
uint
,
...
...
@@ -53,7 +51,12 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
}
impl
ToStr
for
cat
{
pure
fn
to_str
(
&
self
)
->
~
str
{
copy
self
.name
}
pure
fn
to_str
(
&
self
)
->
~
str
{
// FIXME #5384: this unsafe block is to work around purity
unsafe
{
self
.name
.clone
()
}
}
}
fn
print_out
(
thing
:
@
ToStr
,
expected
:
~
str
)
{
...
...
src/test/run-pass/expr-alt-generic-unique1.rs
浏览文件 @
ee584249
...
...
@@ -13,9 +13,9 @@
// -*- rust -*-
type
compare
<
T
>
=
@
fn
(
~
T
,
~
T
)
->
bool
;
fn
test_generic
<
T
:
Copy
>
(
expected
:
~
T
,
eq
:
compare
<
T
>
)
{
fn
test_generic
<
T
:
Copy
+
Clone
>
(
expected
:
~
T
,
eq
:
compare
<
T
>
)
{
let
actual
:
~
T
=
match
true
{
true
=>
{
copy
expected
},
true
=>
{
expected
.clone
()
},
_
=>
fail
!
(
~
"wat"
)
};
fail_unless!
((
eq
(
expected
,
actual
)));
...
...
src/test/run-pass/expr-alt-generic-unique2.rs
浏览文件 @
ee584249
...
...
@@ -13,9 +13,9 @@
type
compare
<
T
>
=
@
fn
(
T
,
T
)
->
bool
;
fn
test_generic
<
T
:
Copy
>
(
expected
:
T
,
eq
:
compare
<
T
>
)
{
fn
test_generic
<
T
:
Copy
+
Clone
>
(
expected
:
T
,
eq
:
compare
<
T
>
)
{
let
actual
:
T
=
match
true
{
true
=>
copy
expected
,
true
=>
expected
.clone
()
,
_
=>
fail
!
(
~
"wat"
)
};
fail_unless!
((
eq
(
expected
,
actual
)));
...
...
src/test/run-pass/expr-block-generic-unique1.rs
浏览文件 @
ee584249
...
...
@@ -13,8 +13,8 @@
// -*- rust -*-
type
compare
<
T
>
=
@
fn
(
~
T
,
~
T
)
->
bool
;
fn
test_generic
<
T
:
Copy
>
(
expected
:
~
T
,
eq
:
compare
<
T
>
)
{
let
actual
:
~
T
=
{
copy
expected
};
fn
test_generic
<
T
:
Copy
+
Clone
>
(
expected
:
~
T
,
eq
:
compare
<
T
>
)
{
let
actual
:
~
T
=
{
expected
.clone
()
};
fail_unless!
((
eq
(
expected
,
actual
)));
}
...
...
src/test/run-pass/generic-alias-unique.rs
浏览文件 @
ee584249
...
...
@@ -14,7 +14,7 @@
pub
fn
main
()
{
let
expected
=
~
100
;
let
actual
=
id
::
<~
int
>
(
copy
expected
);
let
actual
=
id
::
<~
int
>
(
expected
.clone
()
);
debug!
(
*
actual
);
fail_unless!
((
*
expected
==
*
actual
));
}
src/test/run-pass/hashmap-memory.rs
浏览文件 @
ee584249
...
...
@@ -38,8 +38,8 @@ enum ctrl_proto { find_reducer(~[u8], Chan<int>), mapper_done, }
fn
start_mappers
(
ctrl
:
SharedChan
<
ctrl_proto
>
,
inputs
:
~
[
~
str
])
{
for
inputs
.each
|
i
|
{
let
ctrl
=
ctrl
.clone
();
let
i
=
copy
*
i
;
task
::
spawn
(||
map_task
(
ctrl
.clone
(),
copy
i
)
);
let
i
=
i
.clone
()
;
task
::
spawn
(||
map_task
(
ctrl
.clone
(),
i
.clone
()
)
);
}
}
...
...
@@ -79,7 +79,7 @@ pub fn map_reduce(inputs: ~[~str]) {
reducers
=
oldmap
::
HashMap
();
start_mappers
(
ctrl_chan
,
copy
inputs
);
start_mappers
(
ctrl_chan
,
inputs
.clone
()
);
let
mut
num_mappers
=
vec
::
len
(
inputs
)
as
int
;
...
...
src/test/run-pass/issue-2487-a.rs
浏览文件 @
ee584249
...
...
@@ -20,7 +20,7 @@ fn finalize(&self) {}
pub
impl
socket
{
fn
set_identity
(
&
self
)
{
do
closure
{
setsockopt_bytes
(
copy
self
.sock
)
setsockopt_bytes
(
self
.sock
.clone
()
)
}
}
}
...
...
src/test/run-pass/issue-2633-2.rs
浏览文件 @
ee584249
...
...
@@ -14,5 +14,5 @@ fn a_val(&&x: ~int, +y: ~int) -> int {
pub
fn
main
()
{
let
z
=
~
22
;
a_val
(
copy
z
,
copy
z
);
a_val
(
z
.clone
(),
z
.clone
()
);
}
src/test/run-pass/issue-3389.rs
浏览文件 @
ee584249
...
...
@@ -27,6 +27,6 @@ pub fn main() {
let
v
=
~
[
~
"123"
,
~
"abc"
];
node
.content
=
~
[
~
"123"
,
~
"abc"
];
print_str_vector
(
v
);
print_str_vector
(
copy
node
.content
);
print_str_vector
(
node
.content
.clone
()
);
}
src/test/run-pass/issue-3609.rs
浏览文件 @
ee584249
...
...
@@ -19,7 +19,7 @@ fn foo(name: ~str, samples_chan: Chan<Msg>) {
for
uint
::
range
(
0
,
buffer
.len
())
|
i
|
{
error!
(
"%?: %f"
,
i
,
buffer
[
i
])}
};
samples_chan
.send
(
GetSamples
(
copy
name
,
callback
));
samples_chan
.send
(
GetSamples
(
name
.clone
()
,
callback
));
};
}
...
...
src/test/run-pass/issue-4541.rs
浏览文件 @
ee584249
...
...
@@ -14,7 +14,7 @@ fn parse_args() -> ~str {
let
mut
n
=
0
;
while
n
<
args
.len
()
{
match
copy
args
[
n
]
{
match
args
[
n
]
.clone
()
{
~
"-v"
=>
(),
s
=>
{
return
s
;
...
...
src/test/run-pass/issue-4542.rs
浏览文件 @
ee584249
...
...
@@ -11,7 +11,7 @@
// xfail-test
pub
fn
main
()
{
for
os
::
args
()
.each
|
arg
|
{
match
copy
*
arg
{
match
arg
.clone
()
{
s
=>
{
}
}
}
...
...
src/test/run-pass/istr.rs
浏览文件 @
ee584249
...
...
@@ -10,7 +10,7 @@
fn
test_stack_assign
()
{
let
s
:
~
str
=
~
"a"
;
debug!
(
copy
s
);
debug!
(
s
.clone
()
);
let
t
:
~
str
=
~
"a"
;
fail_unless!
((
s
==
t
));
let
u
:
~
str
=
~
"b"
;
...
...
@@ -49,7 +49,7 @@ fn test_append() {
let
mut
s
=
~
"a"
;
s
+=
~
"b"
;
debug!
(
copy
s
);
debug!
(
s
.clone
()
);
fail_unless!
((
s
==
~
"ab"
));
let
mut
s
=
~
"c"
;
...
...
src/test/run-pass/last-use-in-cap-clause.rs
浏览文件 @
ee584249
...
...
@@ -14,7 +14,7 @@ struct A { a: ~int }
fn
foo
()
->
@
fn
()
->
int
{
let
k
=
~
22
;
let
_u
=
A
{
a
:
copy
k
};
let
_u
=
A
{
a
:
k
.clone
()
};
let
result
:
@
fn
()
->
int
=
||
22
;
result
}
...
...
src/test/run-pass/last-use-is-capture.rs
浏览文件 @
ee584249
...
...
@@ -15,6 +15,6 @@ struct A { a: ~int }
pub
fn
main
()
{
fn
invoke
(
f
:
@
fn
())
{
f
();
}
let
k
=
~
22
;
let
_u
=
A
{
a
:
copy
k
};
invoke
(||
error!
(
copy
k
)
)
let
_u
=
A
{
a
:
k
.clone
()
};
invoke
(||
error!
(
k
.clone
()
)
)
}
src/test/run-pass/monad.rs
浏览文件 @
ee584249
...
...
@@ -43,7 +43,7 @@ pub fn main() {
fail_unless!
(
transform
(
Some
(
10
))
==
Some
(
~
"11"
));
fail_unless!
(
transform
(
None
)
==
None
);
fail_unless!
((
~
[
~
"hi"
])
.bind
(|
x
|
~
[
copy
*
x
,
*
x
+
~
"!"
]
)
.bind
(|
x
|
~
[
copy
*
x
,
*
x
+
~
"?"
]
)
==
.bind
(|
x
|
~
[
x
.clone
()
,
*
x
+
~
"!"
]
)
.bind
(|
x
|
~
[
x
.clone
()
,
*
x
+
~
"?"
]
)
==
~
[
~
"hi"
,
~
"hi?"
,
~
"hi!"
,
~
"hi!?"
]);
}
src/test/run-pass/propagate-expected-type-through-block.rs
浏览文件 @
ee584249
...
...
@@ -5,7 +5,7 @@
pub
fn
main
()
{
let
y
=
~
3
;
let
foo
:
@
fn
(
&
int
)
->
int
=
{
let
y
=
copy
y
;
let
y
=
y
.clone
()
;
|
x
|
*
x
+
*
y
};
fail_unless!
(
foo
(
@
22
)
==
25
);
...
...
src/test/run-pass/rec-auto.rs
浏览文件 @
ee584249
...
...
@@ -19,6 +19,6 @@ struct X { foo: ~str, bar: ~str }
pub
fn
main
()
{
let
x
=
X
{
foo
:
~
"hello"
,
bar
:
~
"world"
};
debug!
(
copy
x
.foo
);
debug!
(
copy
x
.bar
);
debug!
(
x
.foo
.clone
()
);
debug!
(
x
.bar
.clone
()
);
}
src/test/run-pass/reflect-visit-data.rs
浏览文件 @
ee584249
...
...
@@ -647,10 +647,10 @@ pub fn main() {
let
v
=
@
v
as
@
TyVisitor
;
visit_tydesc
(
td
,
v
);
for
(
copy
u
.vals
)
.each
|
s
|
{
for
(
u
.vals
.clone
()
)
.each
|
s
|
{
io
::
println
(
fmt!
(
"val: %s"
,
*
s
));
}
error!
(
"%?"
,
copy
u
.vals
);
error!
(
"%?"
,
u
.vals
.clone
()
);
fail_unless!
(
u
.vals
==
~
[
~
"1"
,
~
"2"
,
~
"3"
,
~
"true"
,
~
"false"
,
~
"5"
,
~
"4"
,
~
"3"
,
~
"12"
]);
...
...
src/test/run-pass/reflect-visit-type.rs
浏览文件 @
ee584249
...
...
@@ -150,7 +150,7 @@ pub fn main() {
visit_ty
::
<
i16
>
(
vv
);
visit_ty
::
<~
[
int
]
>
(
vv
);
for
(
copy
v
.types
)
.each
{|
s
|
for
(
v
.types
.clone
()
)
.each
{|
s
|
io
::
println
(
fmt!
(
"type: %s"
,
s
));
}
fail_unless!
(
v
.types
==
[
"bool"
,
"int"
,
"i8"
,
"i16"
,
...
...
src/test/run-pass/ret-break-cont-in-block.rs
浏览文件 @
ee584249
...
...
@@ -20,9 +20,9 @@ fn iter<T>(v: ~[T], it: &fn(&T) -> bool) {
}
}
fn
find_pos
<
T
:
Eq
+
Copy
>
(
n
:
T
,
h
:
~
[
T
])
->
Option
<
uint
>
{
fn
find_pos
<
T
:
Eq
+
Copy
+
Clone
>
(
n
:
T
,
h
:
~
[
T
])
->
Option
<
uint
>
{
let
mut
i
=
0u
;
for
iter
(
copy
h
)
|
e
|
{
for
iter
(
h
.clone
()
)
|
e
|
{
if
*
e
==
n
{
return
Some
(
i
);
}
i
+=
1u
;
}
...
...
@@ -31,8 +31,8 @@ fn find_pos<T:Eq + Copy>(n: T, h: ~[T]) -> Option<uint> {
fn
bail_deep
(
x
:
~
[
~
[
bool
]])
{
let
mut
seen
=
false
;
for
iter
(
copy
x
)
|
x
|
{
for
iter
(
copy
*
x
)
|
x
|
{
for
iter
(
x
.clone
()
)
|
x
|
{
for
iter
(
x
.clone
()
)
|
x
|
{
fail_unless!
(
!
seen
);
if
*
x
{
seen
=
true
;
return
;
}
}
...
...
src/test/run-pass/stat.rs
浏览文件 @
ee584249
...
...
@@ -20,7 +20,7 @@ pub fn main() {
{
match
io
::
file_writer
(
&
path
,
[
io
::
Create
,
io
::
Truncate
])
{
Err
(
copy
e
)
=>
fail
!
(
e
),
Err
(
ref
e
)
=>
fail
!
(
e
.clone
()
),
Ok
(
f
)
=>
{
for
uint
::
range
(
0
,
1000
)
|
_
i
|
{
f
.write_u8
(
0
);
...
...
src/test/run-pass/str-append.rs
浏览文件 @
ee584249
...
...
@@ -16,7 +16,7 @@
fn
test1
()
{
let
mut
s
:
~
str
=
~
"hello"
;
s
+=
~
"world"
;
debug!
(
copy
s
);
debug!
(
s
.clone
()
);
fail_unless!
((
s
[
9
]
==
'd'
as
u8
));
}
...
...
@@ -26,8 +26,8 @@ fn test2() {
let
ff
:
~
str
=
~
"abc"
;
let
a
:
~
str
=
ff
+
~
"ABC"
+
ff
;
let
b
:
~
str
=
~
"ABC"
+
ff
+
~
"ABC"
;
debug!
(
copy
a
);
debug!
(
copy
b
);
debug!
(
a
.clone
()
);
debug!
(
b
.clone
()
);
fail_unless!
((
a
==
~
"abcABCabc"
));
fail_unless!
((
b
==
~
"ABCabcABC"
));
}
...
...
src/test/run-pass/str-concat.rs
浏览文件 @
ee584249
...
...
@@ -16,6 +16,6 @@ pub fn main() {
let
a
:
~
str
=
~
"hello"
;
let
b
:
~
str
=
~
"world"
;
let
s
:
~
str
=
a
+
b
;
debug!
(
copy
s
);
debug!
(
s
.clone
()
);
fail_unless!
((
s
[
9
]
==
'd'
as
u8
));
}
src/test/run-pass/syntax-extension-fmt.rs
浏览文件 @
ee584249
...
...
@@ -11,8 +11,8 @@
extern
mod
std
;
fn
test
(
actual
:
~
str
,
expected
:
~
str
)
{
debug!
(
copy
actual
);
debug!
(
copy
expected
);
debug!
(
actual
.clone
()
);
debug!
(
expected
.clone
()
);
fail_unless!
((
actual
==
expected
));
}
...
...
src/test/run-pass/trait-generic.rs
浏览文件 @
ee584249
...
...
@@ -17,7 +17,7 @@ impl to_str for int {
fn
to_str
(
&
self
)
->
~
str
{
int
::
to_str
(
*
self
)
}
}
impl
to_str
for
~
str
{
fn
to_str
(
&
self
)
->
~
str
{
copy
*
self
}
fn
to_str
(
&
self
)
->
~
str
{
self
.clone
()
}
}
impl
to_str
for
()
{
fn
to_str
(
&
self
)
->
~
str
{
~
"()"
}
...
...
src/test/run-pass/unique-assign-copy.rs
浏览文件 @
ee584249
...
...
@@ -12,7 +12,7 @@ pub fn main() {
let
mut
i
=
~
1
;
// Should be a copy
let
mut
j
;
j
=
copy
i
;
j
=
i
.clone
()
;
*
i
=
2
;
*
j
=
3
;
fail_unless!
(
*
i
==
2
);
...
...
src/test/run-pass/unique-decl-init-copy.rs
浏览文件 @
ee584249
...
...
@@ -11,7 +11,7 @@
pub
fn
main
()
{
let
mut
i
=
~
1
;
// Should be a copy
let
mut
j
=
copy
i
;
let
mut
j
=
i
.clone
()
;
*
i
=
2
;
*
j
=
3
;
fail_unless!
(
*
i
==
2
);
...
...
src/test/run-pass/unique-in-vec-copy.rs
浏览文件 @
ee584249
...
...
@@ -10,7 +10,7 @@
pub
fn
main
()
{
let
mut
a
=
~
[
~
10
];
let
b
=
copy
a
;
let
b
=
a
.clone
()
;
fail_unless!
(
*
a
[
0
]
==
10
);
fail_unless!
(
*
b
[
0
]
==
10
);
...
...
src/test/run-pass/vec-ivec-deadlock.rs
浏览文件 @
ee584249
...
...
@@ -10,6 +10,6 @@
pub
fn
main
()
{
let
a
=
~
[
1
,
2
,
3
,
4
,
5
];
let
mut
b
=
~
[
copy
a
,
copy
a
];
let
mut
b
=
~
[
a
.clone
(),
a
.clone
()
];
b
=
b
+
b
;
// FIXME(#3387)---can't write b += b
}
src/test/run-pass/vec-matching-fold.rs
浏览文件 @
ee584249
fn
foldl
<
T
,
U
:
Copy
>
(
fn
foldl
<
T
,
U
:
Copy
+
Clone
>
(
values
:
&
[
T
],
initial
:
U
,
function
:
&
fn
(
partial
:
U
,
element
:
&
T
)
->
U
...
...
@@ -6,11 +6,11 @@ fn foldl<T, U: Copy>(
match
values
{
[
head
,
..
tail
]
=>
foldl
(
tail
,
function
(
initial
,
&
head
),
function
),
[]
=>
copy
initial
[]
=>
initial
.clone
()
}
}
fn
foldr
<
T
,
U
:
Copy
>
(
fn
foldr
<
T
,
U
:
Copy
+
Clone
>
(
values
:
&
[
T
],
initial
:
U
,
function
:
&
fn
(
element
:
&
T
,
partial
:
U
)
->
U
...
...
@@ -18,7 +18,7 @@ fn foldr<T, U: Copy>(
match
values
{
[
..
head
,
tail
]
=>
foldr
(
head
,
function
(
&
tail
,
initial
),
function
),
[]
=>
copy
initial
[]
=>
initial
.clone
()
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录