Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b88f8678
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,发现更多精彩内容 >>
提交
b88f8678
编写于
9月 12, 2014
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update error messages in compile-fail tests
上级
a8d478db
变更
87
隐藏空白更改
内联
并排
Showing
87 changed file
with
381 addition
and
256 deletion
+381
-256
src/test/compile-fail/bad-method-typaram-kind.rs
src/test/compile-fail/bad-method-typaram-kind.rs
+1
-1
src/test/compile-fail/bad-sized.rs
src/test/compile-fail/bad-sized.rs
+3
-5
src/test/compile-fail/builtin-superkinds-double-superkind.rs
src/test/compile-fail/builtin-superkinds-double-superkind.rs
+2
-2
src/test/compile-fail/builtin-superkinds-in-metadata.rs
src/test/compile-fail/builtin-superkinds-in-metadata.rs
+2
-1
src/test/compile-fail/builtin-superkinds-self-type.rs
src/test/compile-fail/builtin-superkinds-self-type.rs
+3
-3
src/test/compile-fail/builtin-superkinds-simple.rs
src/test/compile-fail/builtin-superkinds-simple.rs
+1
-1
src/test/compile-fail/builtin-superkinds-typaram-not-send.rs
src/test/compile-fail/builtin-superkinds-typaram-not-send.rs
+1
-1
src/test/compile-fail/comm-not-freeze.rs
src/test/compile-fail/comm-not-freeze.rs
+3
-3
src/test/compile-fail/conflicting-implementations-aux.rs
src/test/compile-fail/conflicting-implementations-aux.rs
+1
-4
src/test/compile-fail/conflicting-implementations.rs
src/test/compile-fail/conflicting-implementations.rs
+2
-3
src/test/compile-fail/deriving-span-Default-struct.rs
src/test/compile-fail/deriving-span-Default-struct.rs
+1
-1
src/test/compile-fail/deriving-span-Zero-struct.rs
src/test/compile-fail/deriving-span-Zero-struct.rs
+2
-4
src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
+2
-4
src/test/compile-fail/drop-on-non-struct.rs
src/test/compile-fail/drop-on-non-struct.rs
+3
-6
src/test/compile-fail/dst-bad-assign-2.rs
src/test/compile-fail/dst-bad-assign-2.rs
+2
-2
src/test/compile-fail/dst-bad-assign.rs
src/test/compile-fail/dst-bad-assign.rs
+1
-0
src/test/compile-fail/dst-bad-coerce1.rs
src/test/compile-fail/dst-bad-coerce1.rs
+1
-1
src/test/compile-fail/dst-bad-coerce2.rs
src/test/compile-fail/dst-bad-coerce2.rs
+2
-2
src/test/compile-fail/dst-bad-coercions.rs
src/test/compile-fail/dst-bad-coercions.rs
+3
-4
src/test/compile-fail/dst-bad-deep.rs
src/test/compile-fail/dst-bad-deep.rs
+1
-2
src/test/compile-fail/dst-sized-trait-param.rs
src/test/compile-fail/dst-sized-trait-param.rs
+23
-0
src/test/compile-fail/error-should-say-copy-not-pod.rs
src/test/compile-fail/error-should-say-copy-not-pod.rs
+1
-1
src/test/compile-fail/ifmt-unimpl.rs
src/test/compile-fail/ifmt-unimpl.rs
+1
-1
src/test/compile-fail/impl-bounds-checking.rs
src/test/compile-fail/impl-bounds-checking.rs
+1
-1
src/test/compile-fail/issue-14915.rs
src/test/compile-fail/issue-14915.rs
+2
-2
src/test/compile-fail/issue-3907-2.rs
src/test/compile-fail/issue-3907-2.rs
+1
-1
src/test/compile-fail/issue-5035-2.rs
src/test/compile-fail/issue-5035-2.rs
+1
-1
src/test/compile-fail/issue-5883.rs
src/test/compile-fail/issue-5883.rs
+3
-4
src/test/compile-fail/issue-6458-2.rs
src/test/compile-fail/issue-6458-2.rs
+2
-1
src/test/compile-fail/issue-7013.rs
src/test/compile-fail/issue-7013.rs
+1
-6
src/test/compile-fail/kindck-copy.rs
src/test/compile-fail/kindck-copy.rs
+13
-13
src/test/compile-fail/kindck-impl-type-params-2.rs
src/test/compile-fail/kindck-impl-type-params-2.rs
+1
-1
src/test/compile-fail/kindck-impl-type-params.rs
src/test/compile-fail/kindck-impl-type-params.rs
+10
-8
src/test/compile-fail/kindck-inherited-copy-bound.rs
src/test/compile-fail/kindck-inherited-copy-bound.rs
+2
-2
src/test/compile-fail/kindck-proc-bounds.rs
src/test/compile-fail/kindck-proc-bounds.rs
+2
-2
src/test/compile-fail/kindck-send-object.rs
src/test/compile-fail/kindck-send-object.rs
+5
-4
src/test/compile-fail/kindck-send-object1.rs
src/test/compile-fail/kindck-send-object1.rs
+3
-0
src/test/compile-fail/kindck-send-object2.rs
src/test/compile-fail/kindck-send-object2.rs
+2
-2
src/test/compile-fail/kindck-send-unsafe.rs~rust-lang_master
src/test/compile-fail/kindck-send-unsafe.rs~rust-lang_master
+22
-0
src/test/compile-fail/map-types.rs
src/test/compile-fail/map-types.rs
+1
-2
src/test/compile-fail/marker-no-copy.rs
src/test/compile-fail/marker-no-copy.rs
+1
-1
src/test/compile-fail/marker-no-send.rs
src/test/compile-fail/marker-no-send.rs
+1
-1
src/test/compile-fail/marker-no-share.rs
src/test/compile-fail/marker-no-share.rs
+1
-1
src/test/compile-fail/mut-not-freeze.rs
src/test/compile-fail/mut-not-freeze.rs
+1
-1
src/test/compile-fail/mutable-enum-indirect.rs
src/test/compile-fail/mutable-enum-indirect.rs
+1
-1
src/test/compile-fail/no-send-res-ports.rs
src/test/compile-fail/no-send-res-ports.rs
+2
-1
src/test/compile-fail/no_send-enum.rs
src/test/compile-fail/no_send-enum.rs
+1
-2
src/test/compile-fail/no_send-rc.rs
src/test/compile-fail/no_send-rc.rs
+1
-2
src/test/compile-fail/no_send-struct.rs
src/test/compile-fail/no_send-struct.rs
+1
-2
src/test/compile-fail/no_share-enum.rs
src/test/compile-fail/no_share-enum.rs
+1
-2
src/test/compile-fail/no_share-rc.rs
src/test/compile-fail/no_share-rc.rs
+1
-2
src/test/compile-fail/no_share-struct.rs
src/test/compile-fail/no_share-struct.rs
+1
-2
src/test/compile-fail/object-does-not-impl-trait.rs
src/test/compile-fail/object-does-not-impl-trait.rs
+2
-2
src/test/compile-fail/pinned-deep-copy.rs
src/test/compile-fail/pinned-deep-copy.rs
+1
-2
src/test/compile-fail/regions-bound-missing-bound-in-impl.rs
src/test/compile-fail/regions-bound-missing-bound-in-impl.rs
+0
-2
src/test/compile-fail/regions-bounded-by-send.rs
src/test/compile-fail/regions-bounded-by-send.rs
+3
-0
src/test/compile-fail/regions-bounded-method-type-parameters.rs
...st/compile-fail/regions-bounded-method-type-parameters.rs
+0
-2
src/test/compile-fail/regions-escape-via-trait-or-not.rs
src/test/compile-fail/regions-escape-via-trait-or-not.rs
+0
-2
src/test/compile-fail/regions-lifetime-bounds-on-fns.rs
src/test/compile-fail/regions-lifetime-bounds-on-fns.rs
+0
-2
src/test/compile-fail/repeat-to-run-dtor-twice.rs
src/test/compile-fail/repeat-to-run-dtor-twice.rs
+2
-1
src/test/compile-fail/task-rng-isnt-sendable.rs
src/test/compile-fail/task-rng-isnt-sendable.rs
+1
-1
src/test/compile-fail/trait-bounds-not-on-bare-trait.rs
src/test/compile-fail/trait-bounds-not-on-bare-trait.rs
+1
-1
src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs
.../compile-fail/trait-bounds-on-structs-and-enums-locals.rs
+3
-4
src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs
.../compile-fail/trait-bounds-on-structs-and-enums-static.rs
+1
-2
src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs
...test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs
+2
-13
src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs
...est/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs
+26
-0
src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
+10
-21
src/test/compile-fail/trait-coercion-generic-bad.rs
src/test/compile-fail/trait-coercion-generic-bad.rs
+1
-2
src/test/compile-fail/type-params-in-different-spaces-2.rs
src/test/compile-fail/type-params-in-different-spaces-2.rs
+2
-2
src/test/compile-fail/typeck-unsafe-always-share.rs
src/test/compile-fail/typeck-unsafe-always-share.rs
+1
-1
src/test/compile-fail/unboxed-closures-vtable-mismatch.rs
src/test/compile-fail/unboxed-closures-vtable-mismatch.rs
+1
-2
src/test/compile-fail/unboxed-closures-wrong-trait.rs
src/test/compile-fail/unboxed-closures-wrong-trait.rs
+1
-1
src/test/compile-fail/unique-pinned-nocopy.rs
src/test/compile-fail/unique-pinned-nocopy.rs
+1
-2
src/test/compile-fail/unique-unique-kind.rs
src/test/compile-fail/unique-unique-kind.rs
+1
-1
src/test/compile-fail/unique-vec-res.rs
src/test/compile-fail/unique-vec-res.rs
+2
-4
src/test/compile-fail/unsendable-class.rs
src/test/compile-fail/unsendable-class.rs
+2
-2
src/test/compile-fail/unsized-bare-typaram.rs
src/test/compile-fail/unsized-bare-typaram.rs
+1
-2
src/test/compile-fail/unsized-enum.rs
src/test/compile-fail/unsized-enum.rs
+9
-2
src/test/compile-fail/unsized-struct.rs
src/test/compile-fail/unsized-struct.rs
+5
-2
src/test/compile-fail/unsized3.rs
src/test/compile-fail/unsized3.rs
+13
-32
src/test/compile-fail/unsized6.rs
src/test/compile-fail/unsized6.rs
+14
-18
src/test/compile-fail/unsized7.rs
src/test/compile-fail/unsized7.rs
+43
-0
src/test/compile-fail/vec-res-add.rs
src/test/compile-fail/vec-res-add.rs
+2
-2
src/test/compile-fail/vtable-res-trait-param.rs
src/test/compile-fail/vtable-res-trait-param.rs
+1
-2
src/test/compile-fail/where-clauses-unsatisfied.rs
src/test/compile-fail/where-clauses-unsatisfied.rs
+1
-4
src/test/run-pass/drop-struct-as-object.rs
src/test/run-pass/drop-struct-as-object.rs
+42
-0
src/test/run-pass/object-one-type-two-traits.rs
src/test/run-pass/object-one-type-two-traits.rs
+39
-0
未找到文件。
src/test/compile-fail/bad-method-typaram-kind.rs
浏览文件 @
b88f8678
...
...
@@ -9,7 +9,7 @@
// except according to those terms.
fn
foo
<
T
:
'static
>
()
{
1u
.bar
::
<
T
>
();
//~ ERROR
: does not fulfill `Send`
1u
.bar
::
<
T
>
();
//~ ERROR
`core::kinds::Send` is not implemented
}
trait
bar
{
...
...
src/test/compile-fail/bad-sized.rs
浏览文件 @
b88f8678
...
...
@@ -16,10 +16,8 @@ trait Trait {}
pub
fn
main
()
{
let
x
:
Vec
<
Trait
+
Sized
>
=
Vec
::
new
();
//~^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
//~^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
//~^^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
//~^ ERROR the trait `core::kinds::Sized` is not implemented
//~^^ ERROR the trait `core::kinds::Sized` is not implemented
let
x
:
Vec
<
Box
<
RefCell
<
Trait
+
Sized
>>>
=
Vec
::
new
();
//~^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
//~^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
//~^ ERROR the trait `core::kinds::Sized` is not implemented
}
src/test/compile-fail/builtin-superkinds-double-superkind.rs
浏览文件 @
b88f8678
...
...
@@ -13,9 +13,9 @@
trait
Foo
:
Send
+
Sync
{
}
impl
<
T
:
Sync
>
Foo
for
(
T
,)
{
}
//~ ERROR cannot implement this trait
impl
<
T
:
Sync
+
'static
>
Foo
for
(
T
,)
{
}
//~ ERROR the trait `core::kinds::Send` is not implemented
impl
<
T
:
Send
>
Foo
for
(
T
,
T
)
{
}
//~ ERROR
cannot implement this trait
impl
<
T
:
Send
>
Foo
for
(
T
,
T
)
{
}
//~ ERROR
the trait `core::kinds::Sync` is not implemented
impl
<
T
:
Send
+
Sync
>
Foo
for
(
T
,
T
,
T
)
{
}
// (ok)
...
...
src/test/compile-fail/builtin-superkinds-in-metadata.rs
浏览文件 @
b88f8678
...
...
@@ -21,6 +21,7 @@
impl
<
T
:
Sync
>
RequiresShare
for
X
<
T
>
{
}
impl
<
T
:
Sync
>
RequiresRequiresShareAndSend
for
X
<
T
>
{
}
//~ ERROR cannot implement this trait
impl
<
T
:
Sync
+
'static
>
RequiresRequiresShareAndSend
for
X
<
T
>
{
}
//~^ ERROR the trait `core::kinds::Send` is not implemented
fn
main
()
{
}
src/test/compile-fail/builtin-superkinds-self-type.rs
浏览文件 @
b88f8678
...
...
@@ -12,12 +12,12 @@
// to use capabilities granted by builtin kinds as supertraits.
trait
Foo
:
Sync
+
'static
{
fn
foo
(
self
,
mut
chan
:
Sender
<
Self
>
)
{
chan
.send
(
self
);
//~ ERROR does not fulfill `Send`
}
fn
foo
(
self
,
mut
chan
:
Sender
<
Self
>
)
{
}
}
impl
<
T
:
Sync
>
Foo
for
T
{
}
//~^ ERROR the parameter type `T` may not live long enough
//~^^ ERROR the parameter type `T` may not live long enough
fn
main
()
{
let
(
tx
,
rx
)
=
channel
();
...
...
src/test/compile-fail/builtin-superkinds-simple.rs
浏览文件 @
b88f8678
...
...
@@ -14,6 +14,6 @@
trait
Foo
:
Send
{
}
impl
<
'a
>
Foo
for
&
'a
mut
()
{
}
//~^ ERROR
which does not fulfill `Send`, cannot implement this trait
//~^ ERROR
does not fulfill the required lifetime
fn
main
()
{
}
src/test/compile-fail/builtin-superkinds-typaram-not-send.rs
浏览文件 @
b88f8678
...
...
@@ -12,6 +12,6 @@
trait
Foo
:
Send
{
}
impl
<
T
:
Sync
>
Foo
for
T
{
}
//~ ERROR cannot implement this trait
impl
<
T
:
Sync
+
'static
>
Foo
for
T
{
}
//~ ERROR the trait `core::kinds::Send` is not implemented
fn
main
()
{
}
src/test/compile-fail/comm-not-freeze.rs
浏览文件 @
b88f8678
...
...
@@ -11,7 +11,7 @@
fn
test
<
T
:
Sync
>
()
{}
fn
main
()
{
test
::
<
Sender
<
int
>>
();
//~ ERROR:
does not fulfill `Sync`
test
::
<
Receiver
<
int
>>
();
//~ ERROR:
does not fulfill `Sync`
test
::
<
Sender
<
int
>>
();
//~ ERROR:
does not fulfill `Sync`
test
::
<
Sender
<
int
>>
();
//~ ERROR:
`core::kinds::Sync` is not implemented
test
::
<
Receiver
<
int
>>
();
//~ ERROR:
`core::kinds::Sync` is not implemented
test
::
<
Sender
<
int
>>
();
//~ ERROR:
`core::kinds::Sync` is not implemented
}
src/test/compile-fail/conflicting-implementations-aux.rs
浏览文件 @
b88f8678
...
...
@@ -15,10 +15,7 @@
extern
crate
trait_impl_conflict
;
use
trait_impl_conflict
::
Foo
;
impl
<
A
>
Foo
for
A
{
//~^ ERROR conflicting implementations for trait `trait_impl_conflict::Foo`
//~^^ ERROR cannot provide an extension implementation where both trait and type
// are not defined in this crate
impl
<
A
>
Foo
for
A
{
//~ ERROR E0117
}
fn
main
()
{
...
...
src/test/compile-fail/conflicting-implementations.rs
浏览文件 @
b88f8678
...
...
@@ -8,15 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: conflicting implementations for trait `Foo`
trait
Foo
{
}
impl
Foo
for
int
{
impl
Foo
for
int
{
//~ ERROR conflicting implementations
}
impl
<
A
>
Foo
for
A
{
impl
<
A
>
Foo
for
A
{
//~ NOTE conflicting implementation here
}
...
...
src/test/compile-fail/deriving-span-Default-struct.rs
浏览文件 @
b88f8678
...
...
@@ -18,7 +18,7 @@
#[deriving(Default)]
struct
Struct
{
x
:
Error
//~ ERROR
x
:
Error
//~ ERROR
`core::default::Default` is not implemented
}
fn
main
()
{}
src/test/compile-fail/deriving-span-Zero-struct.rs
浏览文件 @
b88f8678
...
...
@@ -16,11 +16,9 @@
struct
Error
;
#[deriving(Zero)]
//~ ERROR
failed to find an implementation
#[deriving(Zero)]
//~ ERROR
not implemented
struct
Struct
{
x
:
Error
//~ ERROR failed to find an implementation
//~^ ERROR failed to find an implementation
//~^^ ERROR type `Error` does not implement any method in scope
x
:
Error
}
fn
main
()
{}
src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
浏览文件 @
b88f8678
...
...
@@ -16,11 +16,9 @@
struct
Error
;
#[deriving(Zero)]
//~ ERROR
failed to find an implementation
#[deriving(Zero)]
//~ ERROR
not implemented
struct
Struct
(
Error
//~ ERROR
//~^ ERROR failed to find an implementation
//~^^ ERROR type `Error` does not implement any method in scope
Error
);
fn
main
()
{}
src/test/compile-fail/drop-on-non-struct.rs
浏览文件 @
b88f8678
...
...
@@ -8,12 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
type
Foo
=
Vec
<
u8
>
;
impl
Drop
for
Foo
{
//~^ ERROR cannot provide an extension implementation
impl
Drop
for
int
{
//~^ ERROR the Drop trait may only be implemented on structures
//~^^ ERROR cannot provide an extension implementation
fn
drop
(
&
mut
self
)
{
println!
(
"kaboom"
);
}
...
...
src/test/compile-fail/dst-bad-assign-2.rs
浏览文件 @
b88f8678
...
...
@@ -42,6 +42,6 @@ pub fn main() {
// Assignment.
let
f5
:
&
mut
Fat
<
ToBar
>
=
&
mut
Fat
{
f1
:
5
,
f2
:
"some str"
,
ptr
:
Bar1
{
f
:
42
}
};
let
z
:
Box
<
ToBar
>
=
box
Bar1
{
f
:
36
};
f5
.ptr
=
*
z
;
//~ ERROR dynamically sized type on lhs of assignment
//~^ ERROR
E0161
f5
.ptr
=
*
z
;
//~^ ERROR
the trait `core::kinds::Sized` is not implemented
}
src/test/compile-fail/dst-bad-assign.rs
浏览文件 @
b88f8678
...
...
@@ -43,4 +43,5 @@ pub fn main() {
let
f5
:
&
mut
Fat
<
ToBar
>
=
&
mut
Fat
{
f1
:
5
,
f2
:
"some str"
,
ptr
:
Bar1
{
f
:
42
}
};
let
z
:
Box
<
ToBar
>
=
box
Bar1
{
f
:
36
};
f5
.ptr
=
Bar1
{
f
:
36
};
//~ ERROR mismatched types: expected `ToBar`, found `Bar1`
//~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `ToBar`
}
src/test/compile-fail/dst-bad-coerce1.rs
浏览文件 @
b88f8678
...
...
@@ -28,5 +28,5 @@ pub fn main() {
let
f1
=
Fat
{
ptr
:
Foo
};
let
f2
:
&
Fat
<
Foo
>
=
&
f1
;
let
f3
:
&
Fat
<
Bar
>
=
f2
;
//~^ ERROR
failed to find an implementation of trait Bar for Foo
//~^ ERROR
the trait `Bar` is not implemented for the type `Foo`
}
src/test/compile-fail/dst-bad-coerce2.rs
浏览文件 @
b88f8678
...
...
@@ -22,10 +22,10 @@ pub fn main() {
// With a vec of ints.
let
f1
=
Fat
{
ptr
:
[
1
,
2
,
3
]
};
let
f2
:
&
Fat
<
[
int
,
..
3
]
>
=
&
f1
;
let
f3
:
&
mut
Fat
<
[
int
]
>
=
f2
;
//~ ERROR
cannot borrow immutable dereference
let
f3
:
&
mut
Fat
<
[
int
]
>
=
f2
;
//~ ERROR
mismatched types
// With a trait.
let
f1
=
Fat
{
ptr
:
Foo
};
let
f2
:
&
Fat
<
Foo
>
=
&
f1
;
let
f3
:
&
mut
Fat
<
Bar
>
=
f2
;
//~ ERROR
cannot borrow immutable dereference
let
f3
:
&
mut
Fat
<
Bar
>
=
f2
;
//~ ERROR
mismatched types
}
src/test/compile-fail/dst-bad-coercions.rs
浏览文件 @
b88f8678
...
...
@@ -30,10 +30,9 @@ pub fn main() {
let
y
:
&
T
=
x
;
//~ ERROR mismatched types
// Test that we cannot convert an immutable ptr to a mutable one using *-ptrs
let
x
:
&
mut
T
=
&
S
;
//~ ERROR types differ in mutability
let
x
:
*
mut
T
=
&
S
;
//~ ERROR types differ in mutability
let
x
:
*
mut
S
=
&
S
;
//~^ ERROR mismatched types
let
x
:
&
mut
T
=
&
S
;
//~ ERROR mismatched types
let
x
:
*
mut
T
=
&
S
;
//~ ERROR mismatched types
let
x
:
*
mut
S
=
&
S
;
//~ ERROR mismatched types
// The below four sets of tests test that we cannot implicitly deref a *-ptr
// during a coercion.
...
...
src/test/compile-fail/dst-bad-deep.rs
浏览文件 @
b88f8678
...
...
@@ -21,6 +21,5 @@ pub fn main() {
let
f
:
Fat
<
[
int
,
..
3
]
>
=
Fat
{
ptr
:
[
5
i
,
6
,
7
]
};
let
g
:
&
Fat
<
[
int
]
>
=
&
f
;
let
h
:
&
Fat
<
Fat
<
[
int
]
>>
=
&
Fat
{
ptr
:
*
g
};
//~^ ERROR trying to initialise a dynamically sized struct
//~^^ ERROR E0161
//~^ ERROR the trait `core::kinds::Sized` is not implemented
}
src/test/compile-fail/dst-sized-trait-param.rs
0 → 100644
浏览文件 @
b88f8678
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Check that when you implement a trait that has a sized type
// parameter, the corresponding value must be sized. Also that the
// self type must be sized if appropriate.
trait
Foo
<
T
>
{
fn
take
(
self
,
x
:
&
T
)
{
}
}
// Note: T is sized
impl
Foo
<
[
int
]
>
for
uint
{
}
//~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `[int]`
impl
Foo
<
int
>
for
[
uint
]
{
}
//~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `[uint]`
pub
fn
main
()
{
}
src/test/compile-fail/error-should-say-copy-not-pod.rs
浏览文件 @
b88f8678
...
...
@@ -13,5 +13,5 @@
fn
check_bound
<
T
:
Copy
>
(
_
:
T
)
{}
fn
main
()
{
check_bound
(
"nocopy"
.to_string
());
//~ ERROR
does not fulfill `Copy`
check_bound
(
"nocopy"
.to_string
());
//~ ERROR
the trait `core::kinds::Copy` is not implemented
}
src/test/compile-fail/ifmt-unimpl.rs
浏览文件 @
b88f8678
...
...
@@ -10,5 +10,5 @@
fn
main
()
{
format!
(
"{:d}"
,
"3"
);
//~^ ERROR:
failed to find an implementation of trait core::fmt::Sign
ed
//~^ ERROR:
the trait `core::fmt::Signed` is not implement
ed
}
src/test/compile-fail/impl-bounds-checking.rs
浏览文件 @
b88f8678
...
...
@@ -17,7 +17,7 @@ trait Getter<T: Clone2> {
fn
get
(
&
self
)
->
T
;
}
impl
Getter
<
int
>
for
int
{
//~ ERROR
failed to find an implementation of trait Clone2 for int
impl
Getter
<
int
>
for
int
{
//~ ERROR
the trait `Clone2` is not implemented
fn
get
(
&
self
)
->
int
{
*
self
}
}
...
...
src/test/compile-fail/issue-14915.rs
浏览文件 @
b88f8678
...
...
@@ -15,8 +15,8 @@ fn main() {
let
y
:
Gc
<
int
>
=
box
(
GC
)
0
;
println!
(
"{}"
,
x
+
1
);
//~ ERROR binary operation `+` cannot be applied to type `Box<int>`
//~^ ERROR
cannot determine a type for this bounded type parameter: unconstrained type
//~^ ERROR
unable to infer enough type information
println!
(
"{}"
,
y
+
1
);
//~^ ERROR binary operation `+` cannot be applied to type `Gc<int>`
//~^^ ERROR
cannot determine a type for this bounded type parameter: unconstrained type
//~^^ ERROR
unable to infer enough type information
}
src/test/compile-fail/issue-3907-2.rs
浏览文件 @
b88f8678
...
...
@@ -17,6 +17,6 @@ struct S {
name
:
int
}
fn
bar
(
_
x
:
Foo
)
{}
//~ ERROR
variable `_x` has dynamically sized type
fn
bar
(
_
x
:
Foo
)
{}
//~ ERROR
the trait `core::kinds::Sized` is not implemented
fn
main
()
{}
src/test/compile-fail/issue-5035-2.rs
浏览文件 @
b88f8678
...
...
@@ -11,6 +11,6 @@
trait
I
{}
type
K
=
I
+
'static
;
fn
foo
(
_
x
:
K
)
{}
//~ ERROR:
variable `_x` has dynamically sized type
fn
foo
(
_
x
:
K
)
{}
//~ ERROR:
the trait `core::kinds::Sized` is not implemented
fn
main
()
{}
src/test/compile-fail/issue-5883.rs
浏览文件 @
b88f8678
...
...
@@ -15,10 +15,9 @@ struct Struct {
}
fn
new_struct
(
r
:
A
+
'static
)
->
Struct
{
//~^ ERROR variable `r` has dynamically sized type
Struct
{
r
:
r
}
//~ ERROR trying to initialise a dynamically sized struct
//~^ ERROR E0161
//~^^ ERROR E0161
//~^ ERROR the trait `core::kinds::Sized` is not implemented
Struct
{
r
:
r
}
//~^ ERROR the trait `core::kinds::Sized` is not implemented
}
trait
Curve
{}
...
...
src/test/compile-fail/issue-6458-2.rs
浏览文件 @
b88f8678
...
...
@@ -11,5 +11,6 @@
extern
crate
debug
;
fn
main
()
{
format!
(
"{:?}"
,
None
);
//~ ERROR: cannot determine a type for this bounded
// Unconstrained type:
format!
(
"{:?}"
,
None
);
//~ ERROR: E0101
}
src/test/compile-fail/issue-7013.rs
浏览文件 @
b88f8678
...
...
@@ -32,10 +32,5 @@ struct A {
fn
main
()
{
let
a
=
A
{
v
:
box
B
{
v
:
None
}
as
Box
<
Foo
+
Send
>
};
//~^ ERROR cannot pack type `Box<B>`, which does not fulfill `Send`, as a trait bounded by Send
let
v
=
Rc
::
new
(
RefCell
::
new
(
a
));
let
w
=
v
.clone
();
let
b
=
&*
v
;
let
mut
b
=
b
.borrow_mut
();
b
.v
.set
(
w
.clone
());
//~^ ERROR the trait `core::kinds::Send` is not implemented for the type `B`
}
src/test/compile-fail/kindck-copy.rs
浏览文件 @
b88f8678
...
...
@@ -34,14 +34,14 @@ fn test<'a,T,U:Copy>(_: &'a int) {
assert_copy
::
<&
'a
[
int
]
>
();
// ...unless they are mutable
assert_copy
::
<&
'static
mut
int
>
();
//~ ERROR
does not fulfill
assert_copy
::
<&
'a
mut
int
>
();
//~ ERROR
does not fulfill
assert_copy
::
<&
'static
mut
int
>
();
//~ ERROR
`core::kinds::Copy` is not implemented
assert_copy
::
<&
'a
mut
int
>
();
//~ ERROR
`core::kinds::Copy` is not implemented
// ~ pointers are not ok
assert_copy
::
<
Box
<
int
>>
();
//~ ERROR
does not fulfill
assert_copy
::
<
String
>
();
//~ ERROR
does not fulfill
assert_copy
::
<
Vec
<
int
>
>
();
//~ ERROR
does not fulfill
assert_copy
::
<
Box
<&
'a
mut
int
>>
();
//~ ERROR
does not fulfill
assert_copy
::
<
Box
<
int
>>
();
//~ ERROR
`core::kinds::Copy` is not implemented
assert_copy
::
<
String
>
();
//~ ERROR
`core::kinds::Copy` is not implemented
assert_copy
::
<
Vec
<
int
>
>
();
//~ ERROR
`core::kinds::Copy` is not implemented
assert_copy
::
<
Box
<&
'a
mut
int
>>
();
//~ ERROR
`core::kinds::Copy` is not implemented
// borrowed object types are generally ok
assert_copy
::
<&
'a
Dummy
>
();
...
...
@@ -49,14 +49,14 @@ fn test<'a,T,U:Copy>(_: &'a int) {
assert_copy
::
<&
'static
Dummy
+
Copy
>
();
// owned object types are not ok
assert_copy
::
<
Box
<
Dummy
>>
();
//~ ERROR
does not fulfill
assert_copy
::
<
Box
<
Dummy
+
Copy
>>
();
//~ ERROR
does not fulfill
assert_copy
::
<
Box
<
Dummy
>>
();
//~ ERROR
`core::kinds::Copy` is not implemented
assert_copy
::
<
Box
<
Dummy
+
Copy
>>
();
//~ ERROR
`core::kinds::Copy` is not implemented
// mutable object types are not ok
assert_copy
::
<&
'a
mut
Dummy
+
Copy
>
();
//~ ERROR
does not fulfill
assert_copy
::
<&
'a
mut
Dummy
+
Copy
>
();
//~ ERROR
`core::kinds::Copy` is not implemented
// closures are like an `&mut` object
assert_copy
::
<
||
>
();
//~ ERROR
does not fulfill
assert_copy
::
<
||
>
();
//~ ERROR
`core::kinds::Copy` is not implemented
// unsafe ptrs are ok
assert_copy
::
<*
const
int
>
();
...
...
@@ -74,11 +74,11 @@ fn test<'a,T,U:Copy>(_: &'a int) {
assert_copy
::
<
MyStruct
>
();
// structs containing non-POD are not ok
assert_copy
::
<
MyNoncopyStruct
>
();
//~ ERROR
does not fulfill
assert_copy
::
<
MyNoncopyStruct
>
();
//~ ERROR
`core::kinds::Copy` is not implemented
// managed or ref counted types are not ok
assert_copy
::
<
Gc
<
int
>>
();
//~ ERROR
does not fulfill
assert_copy
::
<
Rc
<
int
>>
();
//~ ERROR
does not fulfill
assert_copy
::
<
Gc
<
int
>>
();
//~ ERROR
`core::kinds::Copy` is not implemented
assert_copy
::
<
Rc
<
int
>>
();
//~ ERROR
`core::kinds::Copy` is not implemented
}
pub
fn
main
()
{
...
...
src/test/compile-fail/kindck-impl-type-params-2.rs
浏览文件 @
b88f8678
...
...
@@ -19,5 +19,5 @@ fn take_param<T:Foo>(foo: &T) { }
fn
main
()
{
let
x
=
box
3
i
;
take_param
(
&
x
);
//~^ ERROR
instantiating a type parameter with an incompatible type
//~^ ERROR
the trait `core::kinds::Copy` is not implemented
}
src/test/compile-fail/kindck-impl-type-params.rs
浏览文件 @
b88f8678
...
...
@@ -20,20 +20,22 @@ impl<T: Send + Copy> Gettable<T> for S<T> {}
fn
f
<
T
>
(
val
:
T
)
{
let
t
:
S
<
T
>
=
S
;
let
a
=
&
t
as
&
Gettable
<
T
>
;
//~^ ERROR instantiating a type parameter with an incompatible type `T`
//~^ ERROR the trait `core::kinds::Send` is not implemented
//~^^ ERROR the trait `core::kinds::Copy` is not implemented
let
a
:
&
Gettable
<
T
>
=
&
t
;
//~^ ERROR instantiating a type parameter with an incompatible type `T`
//~^ ERROR the trait `core::kinds::Send` is not implemented
//~^^ ERROR the trait `core::kinds::Copy` is not implemented
}
fn
main
()
{
let
t
:
S
<&
int
>
=
S
;
let
a
=
&
t
as
&
Gettable
<&
int
>
;
//~^ ERROR instantiating a type parameter with an incompatible type
fn
foo
<
'a
>
()
{
let
t
:
S
<&
'a
int
>
=
S
;
let
a
=
&
t
as
&
Gettable
<&
'a
int
>
;
let
t
:
Box
<
S
<
String
>>
=
box
S
;
let
a
=
t
as
Box
<
Gettable
<
String
>>
;
//~^ ERROR
instantiating a type parameter with an incompatible type
//~^ ERROR
the trait `core::kinds::Copy` is not implemented
let
t
:
Box
<
S
<
String
>>
=
box
S
;
let
a
:
Box
<
Gettable
<
String
>>
=
t
;
//~^ ERROR
instantiating a type parameter with an incompatible type
//~^ ERROR
the trait `core::kinds::Copy` is not implemented
}
fn
main
()
{
}
src/test/compile-fail/kindck-inherited-copy-bound.rs
浏览文件 @
b88f8678
...
...
@@ -23,8 +23,8 @@ fn take_param<T:Foo>(foo: &T) { }
fn
main
()
{
let
x
=
box
3
i
;
take_param
(
&
x
);
//~ ERROR
does not fulfill `Copy`
take_param
(
&
x
);
//~ ERROR
`core::kinds::Copy` is not implemented
let
y
=
&
x
;
let
z
=
&
x
as
&
Foo
;
//~ ERROR
does not fulfill `Copy`
let
z
=
&
x
as
&
Foo
;
//~ ERROR
`core::kinds::Copy` is not implemented
}
src/test/compile-fail/kindck-proc-bounds.rs
浏览文件 @
b88f8678
...
...
@@ -13,10 +13,10 @@ fn is_freeze<T: Sync>() {}
fn
foo
<
'a
>
()
{
is_send
::
<
proc
()
>
();
//~^ ERROR:
instantiating a type parameter with an incompatible type
//~^ ERROR:
the trait `core::kinds::Send` is not implemented
is_freeze
::
<
proc
()
>
();
//~^ ERROR:
instantiating a type parameter with an incompatible type
//~^ ERROR:
the trait `core::kinds::Sync` is not implemented
}
fn
main
()
{
}
src/test/compile-fail/kindck-send-object.rs
浏览文件 @
b88f8678
...
...
@@ -19,19 +19,20 @@ trait Message : Send { }
// careful with object types, who knows what they close over...
fn
object_ref_with_static_bound_not_ok
()
{
assert_send
::
<&
'static
Dummy
+
'static
>
();
//~ ERROR does not fulfill
assert_send
::
<&
'static
Dummy
+
'static
>
();
//~^ ERROR the trait `core::kinds::Send` is not implemented
}
fn
box_object_with_no_bound_not_ok
<
'a
>
()
{
assert_send
::
<
Box
<
Dummy
>>
();
//~ ERROR
does not fulfill
assert_send
::
<
Box
<
Dummy
>>
();
//~ ERROR
the trait `core::kinds::Send` is not implemented
}
fn
proc_with_no_bound_not_ok
<
'a
>
()
{
assert_send
::
<
proc
()
>
();
//~ ERROR
does not fulfill
assert_send
::
<
proc
()
>
();
//~ ERROR
the trait `core::kinds::Send` is not implemented
}
fn
closure_with_no_bound_not_ok
<
'a
>
()
{
assert_send
::
<
||:
'static
>
();
//~ ERROR
does not fulfill
assert_send
::
<
||:
'static
>
();
//~ ERROR
the trait `core::kinds::Send` is not implemented
}
fn
object_with_send_bound_ok
()
{
...
...
src/test/compile-fail/kindck-send-object1.rs
浏览文件 @
b88f8678
...
...
@@ -18,6 +18,7 @@ trait Dummy { }
// careful with object types, who knows what they close over...
fn
test51
<
'a
>
()
{
assert_send
::
<&
'a
Dummy
>
();
//~ ERROR does not fulfill the required lifetime
//~^ ERROR the trait `core::kinds::Send` is not implemented
}
fn
test52
<
'a
>
()
{
assert_send
::
<&
'a
Dummy
+
Send
>
();
//~ ERROR does not fulfill the required lifetime
...
...
@@ -35,10 +36,12 @@ fn test61() {
// them not ok
fn
test_70
<
'a
>
()
{
assert_send
::
<
proc
():
'a
>
();
//~ ERROR does not fulfill the required lifetime
//~^ ERROR the trait `core::kinds::Send` is not implemented
}
fn
test_71
<
'a
>
()
{
assert_send
::
<
Box
<
Dummy
+
'a
>>
();
//~ ERROR does not fulfill the required lifetime
//~^ ERROR the trait `core::kinds::Send` is not implemented
}
fn
main
()
{
}
src/test/compile-fail/kindck-send-object2.rs
浏览文件 @
b88f8678
...
...
@@ -14,11 +14,11 @@ fn assert_send<T:Send>() { }
trait
Dummy
{
}
fn
test50
()
{
assert_send
::
<&
'static
Dummy
>
();
//~ ERROR
does not fulfill `Send`
assert_send
::
<&
'static
Dummy
>
();
//~ ERROR
the trait `core::kinds::Send` is not implemented
}
fn
test53
()
{
assert_send
::
<
Box
<
Dummy
>>
();
//~ ERROR
does not fulfill `Send`
assert_send
::
<
Box
<
Dummy
>>
();
//~ ERROR
the trait `core::kinds::Send` is not implemented
}
// ...unless they are properly bounded
...
...
src/test/compile-fail/kindck-send-unsafe.rs~rust-lang_master
0 → 100644
浏览文件 @
b88f8678
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn assert_send<T:Send>() { }
// unsafe ptrs are ok unless they point at unsendable things
fn test70() {
assert_send::<*mut int>();
}
fn test71<'a>() {
assert_send::<*mut &'a int>(); //~ ERROR does not fulfill the required lifetime
}
fn main() {
}
src/test/compile-fail/map-types.rs
浏览文件 @
b88f8678
...
...
@@ -18,6 +18,5 @@ fn main() {
let
x
:
Box
<
HashMap
<
int
,
int
>>
=
box
HashMap
::
new
();
let
x
:
Box
<
Map
<
int
,
int
>>
=
x
;
let
y
:
Box
<
Map
<
uint
,
int
>>
=
box
x
;
//~^ ERROR failed to find an implementation of trait collections::Map<uint,int>
//~^^ ERROR failed to find an implementation of trait core::collections::Collection
//~^ ERROR the trait `collections::Map<uint,int>` is not implemented
}
src/test/compile-fail/marker-no-copy.rs
浏览文件 @
b88f8678
...
...
@@ -14,5 +14,5 @@ fn foo<P:Copy>(p: P) { }
fn
main
()
{
foo
(
marker
::
NoCopy
);
//~ ERROR
does not fulfill
foo
(
marker
::
NoCopy
);
//~ ERROR
the trait `core::kinds::Copy` is not implemented
}
src/test/compile-fail/marker-no-send.rs
浏览文件 @
b88f8678
...
...
@@ -14,5 +14,5 @@ fn foo<P:Send>(p: P) { }
fn
main
()
{
foo
(
marker
::
NoSend
);
//~ ERROR
does not fulfill `Send`
foo
(
marker
::
NoSend
);
//~ ERROR
the trait `core::kinds::Send` is not implemented
}
src/test/compile-fail/marker-no-share.rs
浏览文件 @
b88f8678
...
...
@@ -14,5 +14,5 @@ fn foo<P: Sync>(p: P) { }
fn
main
()
{
foo
(
marker
::
NoSync
);
//~ ERROR
does not fulfill `Sync`
foo
(
marker
::
NoSync
);
//~ ERROR
the trait `core::kinds::Sync` is not implemented
}
src/test/compile-fail/mut-not-freeze.rs
浏览文件 @
b88f8678
...
...
@@ -14,5 +14,5 @@ fn f<T: Sync>(_: T) {}
fn
main
()
{
let
x
=
RefCell
::
new
(
0
i
);
f
(
x
);
//~ ERROR
: which does not fulfill `Sync`
f
(
x
);
//~ ERROR
`core::kinds::Sync` is not implemented
}
src/test/compile-fail/mutable-enum-indirect.rs
浏览文件 @
b88f8678
...
...
@@ -19,5 +19,5 @@ fn bar<T: Sync>(_: T) {}
fn
main
()
{
let
x
=
A
(
marker
::
NoSync
);
bar
(
&
x
);
//~ ERROR t
ype parameter with an incompatible type
bar
(
&
x
);
//~ ERROR t
he trait `core::kinds::Sync` is not implemented
}
src/test/compile-fail/no-send-res-ports.rs
浏览文件 @
b88f8678
...
...
@@ -36,7 +36,8 @@ fn foo(x: Port<()>) -> foo {
let
x
=
foo
(
Port
(
box
(
GC
)
()));
task
::
spawn
(
proc
()
{
let
y
=
x
;
//~ ERROR does not fulfill `Send`
let
y
=
x
;
//~^ ERROR does not fulfill `Send`
println!
(
"{:?}"
,
y
);
});
}
src/test/compile-fail/no_send-enum.rs
浏览文件 @
b88f8678
...
...
@@ -19,6 +19,5 @@ fn bar<T: Send>(_: T) {}
fn
main
()
{
let
x
=
A
(
marker
::
NoSend
);
bar
(
x
);
//~^ ERROR instantiating a type parameter with an incompatible type `Foo`,
// which does not fulfill `Send`
//~^ ERROR `core::kinds::Send` is not implemented
}
src/test/compile-fail/no_send-rc.rs
浏览文件 @
b88f8678
...
...
@@ -15,6 +15,5 @@ fn bar<T: Send>(_: T) {}
fn
main
()
{
let
x
=
Rc
::
new
(
5
i
);
bar
(
x
);
//~^ ERROR instantiating a type parameter with an incompatible type `alloc::rc::Rc<int>`,
// which does not fulfill `Send`
//~^ ERROR `core::kinds::Send` is not implemented
}
src/test/compile-fail/no_send-struct.rs
浏览文件 @
b88f8678
...
...
@@ -20,6 +20,5 @@ fn bar<T: Send>(_: T) {}
fn
main
()
{
let
x
=
Foo
{
a
:
5
,
ns
:
marker
::
NoSend
};
bar
(
x
);
//~^ ERROR instantiating a type parameter with an incompatible type `Foo`,
// which does not fulfill `Send`
//~^ ERROR the trait `core::kinds::Send` is not implemented
}
src/test/compile-fail/no_share-enum.rs
浏览文件 @
b88f8678
...
...
@@ -17,6 +17,5 @@ fn bar<T: Sync>(_: T) {}
fn
main
()
{
let
x
=
A
(
marker
::
NoSync
);
bar
(
x
);
//~^ ERROR instantiating a type parameter with an incompatible type `Foo`,
// which does not fulfill `Sync`
//~^ ERROR the trait `core::kinds::Sync` is not implemented
}
src/test/compile-fail/no_share-rc.rs
浏览文件 @
b88f8678
...
...
@@ -16,6 +16,5 @@ fn bar<T: Sync>(_: T) {}
fn
main
()
{
let
x
=
Rc
::
new
(
RefCell
::
new
(
5
i
));
bar
(
x
);
//~^ ERROR instantiating a type parameter with an incompatible type
// `std::rc::Rc<std::cell::RefCell<int>>`, which does not fulfill `Sync`
//~^ ERROR the trait `core::kinds::Sync` is not implemented
}
src/test/compile-fail/no_share-struct.rs
浏览文件 @
b88f8678
...
...
@@ -17,6 +17,5 @@ fn bar<T: Sync>(_: T) {}
fn
main
()
{
let
x
=
Foo
{
a
:
5
,
m
:
marker
::
NoSync
};
bar
(
x
);
//~^ ERROR instantiating a type parameter with an incompatible type `Foo`,
// which does not fulfill `Sync`
//~^ ERROR the trait `core::kinds::Sync` is not implemented
}
src/test/compile-fail/object-does-not-impl-trait.rs
浏览文件 @
b88f8678
...
...
@@ -14,6 +14,6 @@
trait
Foo
{}
fn
take_foo
<
F
:
Foo
>
(
f
:
F
)
{}
fn
take_object
(
f
:
Box
<
Foo
>
)
{
take_foo
(
f
);
}
//~ ERROR failed to find an implementation of trait
//~^ ERROR
failed to find an implementation
fn
take_object
(
f
:
Box
<
Foo
>
)
{
take_foo
(
f
);
}
//~^ ERROR
the trait `Foo` is not implemented
fn
main
()
{}
src/test/compile-fail/pinned-deep-copy.rs
浏览文件 @
b88f8678
...
...
@@ -43,8 +43,7 @@ fn main() {
{
// Can't do this copy
let
x
=
box
box
box
A
{
y
:
r
(
i
)};
let
_
z
=
x
.clone
();
//~ ERROR failed to find an implementation
//~^ ERROR failed to find an implementation
let
_
z
=
x
.clone
();
//~ ERROR not implemented
println!
(
"{:?}"
,
x
);
}
println!
(
"{:?}"
,
*
i
);
...
...
src/test/compile-fail/regions-bound-missing-bound-in-impl.rs
浏览文件 @
b88f8678
...
...
@@ -12,8 +12,6 @@
// nominal types (but not on other types) and that they are type
// checked.
#![no_std]
struct
Inv
<
'a
>
{
// invariant w/r/t 'a
x
:
&
'a
mut
&
'a
int
}
...
...
src/test/compile-fail/regions-bounded-by-send.rs
浏览文件 @
b88f8678
...
...
@@ -58,6 +58,7 @@ fn box_with_region_not_ok<'a>() {
fn
object_with_random_bound_not_ok
<
'a
>
()
{
assert_send
::
<&
'a
Dummy
+
'a
>
();
//~ ERROR does not fulfill
//~^ ERROR not implemented
}
fn
object_with_send_bound_not_ok
<
'a
>
()
{
...
...
@@ -66,10 +67,12 @@ fn object_with_send_bound_not_ok<'a>() {
fn
proc_with_lifetime_not_ok
<
'a
>
()
{
assert_send
::
<
proc
():
'a
>
();
//~ ERROR does not fulfill
//~^ ERROR not implemented
}
fn
closure_with_lifetime_not_ok
<
'a
>
()
{
assert_send
::
<
||:
'a
>
();
//~ ERROR does not fulfill
//~^ ERROR not implemented
}
// unsafe pointers are ok unless they point at unsendable things
...
...
src/test/compile-fail/regions-bounded-method-type-parameters.rs
浏览文件 @
b88f8678
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![no_std]
// Check that explicit region bounds are allowed on the various
// nominal types (but not on other types) and that they are type
// checked.
...
...
src/test/compile-fail/regions-escape-via-trait-or-not.rs
浏览文件 @
b88f8678
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![no_std]
#![allow(dead_code)]
trait
Deref
{
...
...
src/test/compile-fail/regions-lifetime-bounds-on-fns.rs
浏览文件 @
b88f8678
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![no_std]
fn
a
<
'a
,
'b
:
'a
>
(
x
:
&
mut
&
'a
int
,
y
:
&
mut
&
'b
int
)
{
// Note: this is legal because of the `'b:'a` declaration.
*
x
=
*
y
;
...
...
src/test/compile-fail/repeat-to-run-dtor-twice.rs
浏览文件 @
b88f8678
...
...
@@ -24,5 +24,6 @@ fn drop(&mut self) {
fn
main
()
{
let
a
=
Foo
{
x
:
3
};
let
_
=
[
a
,
..
5
];
//~ ERROR copying a value of non-copyable type
let
_
=
[
a
,
..
5
];
//~^ ERROR the trait `core::kinds::Copy` is not implemented for the type `Foo`
}
src/test/compile-fail/task-rng-isnt-sendable.rs
浏览文件 @
b88f8678
...
...
@@ -16,5 +16,5 @@ fn test_send<S: Send>() {}
pub
fn
main
()
{
test_send
::
<
rand
::
TaskRng
>
();
//~^ ERROR
: incompatible type `std::rand::TaskRng`, which does not fulfill `Send`
//~^ ERROR
`core::kinds::Send` is not implemented
}
src/test/compile-fail/trait-bounds-not-on-bare-trait.rs
浏览文件 @
b88f8678
...
...
@@ -14,7 +14,7 @@ trait Foo {
// This should emit the less confusing error, not the more confusing one.
fn
foo
(
_
x
:
Foo
+
Send
)
{
//~^ERROR
variable `_x` has dynamically sized type `Foo+Send`
//~^ERROR
the trait `core::kinds::Sized` is not implemented
}
fn
main
()
{
}
src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs
浏览文件 @
b88f8678
...
...
@@ -16,12 +16,11 @@ struct Foo<T:Trait> {
fn
main
()
{
let
foo
=
Foo
{
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
x
:
3
i
};
let
baz
:
Foo
<
uint
>
=
fail
!
();
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
}
src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs
浏览文件 @
b88f8678
...
...
@@ -15,8 +15,7 @@ struct Foo<T:Trait> {
}
static
X
:
Foo
<
uint
>
=
Foo
{
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
x
:
1
,
};
...
...
src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs
浏览文件 @
b88f8678
...
...
@@ -15,22 +15,11 @@
use
trait_bounds_on_structs_and_enums_xc
::{
Bar
,
Foo
,
Trait
};
fn
explode
(
x
:
Foo
<
uint
>
)
{}
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
fn
kaboom
(
y
:
Bar
<
f32
>
)
{}
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
fn
main
()
{
let
foo
=
Foo
{
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
x
:
3
i
};
let
bar
:
Bar
<
f64
>
=
return
;
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
let
_
=
bar
;
}
src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs
0 → 100644
浏览文件 @
b88f8678
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:trait_bounds_on_structs_and_enums_xc.rs
extern
crate
trait_bounds_on_structs_and_enums_xc
;
use
trait_bounds_on_structs_and_enums_xc
::{
Bar
,
Foo
,
Trait
};
fn
main
()
{
let
foo
=
Foo
{
//~^ ERROR not implemented
x
:
3
i
};
let
bar
:
Bar
<
f64
>
=
return
;
//~^ ERROR not implemented
let
_
=
bar
;
}
src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
浏览文件 @
b88f8678
...
...
@@ -20,40 +20,34 @@ enum Bar<T:Trait> {
CBar
(
uint
),
}
fn
explode
(
x
:
Foo
<
uint
>
)
{}
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
fn
explode
(
x
:
Foo
<
u32
>
)
{}
//~^ ERROR not implemented
fn
kaboom
(
y
:
Bar
<
f32
>
)
{}
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
impl
<
T
>
Foo
<
T
>
{
//~ ERROR failed to find an implementation
//~^ ERROR
instantiating a type parameter with an incompatible type
impl
<
T
>
Foo
<
T
>
{
//~^ ERROR
the trait `Trait` is not implemented
fn
uhoh
()
{}
}
struct
Baz
{
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
a
:
Foo
<
int
>
,
}
enum
Boo
{
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
Quux
(
Bar
<
uint
>
),
}
struct
Badness
<
T
>
{
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
b
:
Foo
<
T
>
,
}
enum
MoreBadness
<
T
>
{
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
EvenMoreBadness
(
Bar
<
T
>
),
}
...
...
@@ -64,15 +58,10 @@ fn whatever() {}
struct
Struct
;
impl
PolyTrait
<
Foo
<
uint
>>
for
Struct
{
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
//~^ ERROR not implemented
fn
whatever
()
{}
}
fn
main
()
{
let
bar
:
Bar
<
f64
>
=
return
;
//~^ ERROR failed to find an implementation
//~^^ ERROR instantiating a type parameter with an incompatible type
let
_
=
bar
;
}
src/test/compile-fail/trait-coercion-generic-bad.rs
浏览文件 @
b88f8678
...
...
@@ -25,7 +25,6 @@ fn f(&self, x: &'static str) {
fn
main
()
{
let
s
:
Box
<
Trait
<
int
>>
=
box
Struct
{
person
:
"Fred"
};
//~^ ERROR expected Trait<int>, found Trait<&'static str>
//~^^ ERROR expected Trait<int>, found Trait<&'static str>
//~^ ERROR type mismatch
s
.f
(
1
);
}
src/test/compile-fail/type-params-in-different-spaces-2.rs
浏览文件 @
b88f8678
...
...
@@ -15,12 +15,12 @@ trait Tr<T> {
// these compile as if Self: Tr<U>, even tho only Self: Tr<Self or T>
trait
A
:
Tr
<
Self
>
{
fn
test
<
U
>
(
u
:
U
)
->
Self
{
Tr
::
op
(
u
)
//~ ERROR
expected Tr<U>, found Tr<Self>
Tr
::
op
(
u
)
//~ ERROR
type mismatch
}
}
trait
B
<
T
>
:
Tr
<
T
>
{
fn
test
<
U
>
(
u
:
U
)
->
Self
{
Tr
::
op
(
u
)
//~ ERROR
expected Tr<U>, found Tr<T>
Tr
::
op
(
u
)
//~ ERROR
type mismatch
}
}
...
...
src/test/compile-fail/typeck-unsafe-always-share.rs
浏览文件 @
b88f8678
...
...
@@ -39,5 +39,5 @@ fn main() {
let
ns
=
NoSync
{
m
:
marker
::
NoSync
};
test
(
ns
);
//~^ ERROR
instantiating a type parameter with an incompatible type `NoSync`, which does not fulfill `Sync`
//~^ ERROR
`core::kinds::Sync` is not implemented
}
src/test/compile-fail/unboxed-closures-vtable-mismatch.rs
浏览文件 @
b88f8678
...
...
@@ -18,8 +18,7 @@ fn call_it<F:FnMut<(int,int),int>>(y: int, mut f: F) -> int {
pub
fn
main
()
{
let
f
=
|
&
mut
:
x
:
uint
,
y
:
int
|
->
int
{
(
x
as
int
)
+
y
};
let
z
=
call_it
(
3
,
f
);
//~ ERROR expected core::ops::FnMut
//~^ ERROR expected core::ops::FnMut
let
z
=
call_it
(
3
,
f
);
//~ ERROR type mismatch
println!
(
"{}"
,
z
);
}
src/test/compile-fail/unboxed-closures-wrong-trait.rs
浏览文件 @
b88f8678
...
...
@@ -17,6 +17,6 @@ fn c<F:|: int, int| -> int>(f: F) -> int {
fn
main
()
{
let
z
:
int
=
7
;
assert_eq!
(
c
(|
&
:
x
:
int
,
y
|
x
+
y
+
z
),
10
);
//~^ ERROR
failed to find an implementation
//~^ ERROR
not implemented
}
src/test/compile-fail/unique-pinned-nocopy.rs
浏览文件 @
b88f8678
...
...
@@ -20,7 +20,6 @@ fn drop(&mut self) {}
fn
main
()
{
let
i
=
box
r
{
b
:
true
};
let
_
j
=
i
.clone
();
//~ ERROR failed to find an implementation
//~^ ERROR failed to find an implementation
let
_
j
=
i
.clone
();
//~ ERROR not implemented
println!
(
"{:?}"
,
i
);
}
src/test/compile-fail/unique-unique-kind.rs
浏览文件 @
b88f8678
...
...
@@ -16,5 +16,5 @@ fn f<T:Send>(_i: T) {
fn
main
()
{
let
i
=
box
box
(
GC
)
100
i
;
f
(
i
);
//~ ERROR
does not fulfill `Send`
f
(
i
);
//~ ERROR
`core::kinds::Send` is not implemented
}
src/test/compile-fail/unique-vec-res.rs
浏览文件 @
b88f8678
...
...
@@ -36,10 +36,8 @@ fn main() {
let
r1
=
vec!
(
box
r
{
i
:
i1
});
let
r2
=
vec!
(
box
r
{
i
:
i2
});
f
(
r1
.clone
(),
r2
.clone
());
//~^ ERROR failed to find an implementation of
//~^^ ERROR failed to find an implementation of
//~^^^ ERROR failed to find an implementation of
//~^^^^ ERROR failed to find an implementation of
//~^ ERROR the trait `core::clone::Clone` is not implemented
//~^^ ERROR the trait `core::clone::Clone` is not implemented
println!
(
"{:?}"
,
(
r2
,
i1
.get
()));
println!
(
"{:?}"
,
(
r1
,
i2
.get
()));
}
src/test/compile-fail/unsendable-class.rs
浏览文件 @
b88f8678
...
...
@@ -28,6 +28,6 @@ fn foo(i:int, j: Gc<String>) -> foo {
fn
main
()
{
let
cat
=
"kitty"
.to_string
();
let
(
tx
,
_
)
=
channel
();
//~ ERROR
does not fulfill `Send`
tx
.send
(
foo
(
42
,
box
(
GC
)
(
cat
)));
//~ ERROR
does not fulfill `Send`
let
(
tx
,
_
)
=
channel
();
//~ ERROR
`core::kinds::Send` is not implemented
tx
.send
(
foo
(
42
,
box
(
GC
)
(
cat
)));
//~ ERROR
`core::kinds::Send` is not implemented
}
src/test/compile-fail/unsized-bare-typaram.rs
浏览文件 @
b88f8678
...
...
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: instantiating a type parameter with an incompatible type
fn
bar
<
T
:
Sized
>
()
{
}
fn
foo
<
Sized
?
T
>
()
{
bar
::
<
T
>
()
}
fn
foo
<
Sized
?
T
>
()
{
bar
::
<
T
>
()
}
//~ ERROR the trait `core::kinds::Sized` is not implemented
fn
main
()
{
}
src/test/compile-fail/unsized-enum.rs
浏览文件 @
b88f8678
...
...
@@ -8,7 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: instantiating a type parameter with an incompatible type
enum
Foo
<
T
>
{
FooSome
(
T
),
FooNone
}
fn
bar
<
T
:
Sized
>
()
{
}
fn
foo
<
Sized
?
T
>
()
{
bar
::
<
Option
<
T
>>
()
}
fn
foo
<
Sized
?
T
>
()
{
bar
::
<
Foo
<
T
>>
()
}
//~^ ERROR the trait `core::kinds::Sized` is not implemented
//~^^ ERROR the trait `core::kinds::Sized` is not implemented
//
// One error is for T being provided to Foo<T>, the other is
// for Foo<T> being provided to bar.
fn
main
()
{
}
src/test/compile-fail/unsized-struct.rs
浏览文件 @
b88f8678
...
...
@@ -8,10 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: instantiating a type parameter with an incompatible type
struct
Foo
<
T
>
{
data
:
T
}
fn
bar
<
T
:
Sized
>
()
{
}
fn
foo
<
Sized
?
T
>
()
{
bar
::
<
Foo
<
T
>>
()
}
//~^ ERROR the trait `core::kinds::Sized` is not implemented
//~^^ ERROR the trait `core::kinds::Sized` is not implemented
// One error is for the T in Foo<T>, the other is for Foo<T> as a value
// for bar's type parameter.
fn
main
()
{
}
src/test/compile-fail/unsized3.rs
浏览文件 @
b88f8678
...
...
@@ -8,12 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test sized-ness checking in substitution.
// Test sized-ness checking in substitution
within fn bodies.
.
// Unbounded.
fn
f1
<
Sized
?
X
>
(
x
:
&
X
)
{
f2
::
<
X
>
(
x
);
//~ ERROR instantiating a type parameter with an incompatible type `X`, which does n
f2
::
<
X
>
(
x
);
//~^ ERROR the trait `core::kinds::Sized` is not implemented
}
fn
f2
<
X
>
(
x
:
&
X
)
{
}
...
...
@@ -21,7 +22,8 @@ fn f2<X>(x: &X) {
// Bounded.
trait
T
for
Sized
?
{}
fn
f3
<
Sized
?
X
:
T
>
(
x
:
&
X
)
{
f4
::
<
X
>
(
x
);
//~ ERROR instantiating a type parameter with an incompatible type `X`, which does n
f4
::
<
X
>
(
x
);
//~^ ERROR the trait `core::kinds::Sized` is not implemented
}
fn
f4
<
X
:
T
>
(
x
:
&
X
)
{
}
...
...
@@ -34,7 +36,8 @@ enum E<Sized? X> {
fn
f5
<
Y
>
(
x
:
&
Y
)
{}
fn
f6
<
Sized
?
X
>
(
x
:
&
X
)
{}
fn
f7
<
Sized
?
X
>
(
x1
:
&
E
<
X
>
,
x2
:
&
E
<
X
>
)
{
f5
(
x1
);
//~ERROR instantiating a type parameter with an incompatible type `E<X>`, which does not
f5
(
x1
);
//~^ ERROR the trait `core::kinds::Sized` is not implemented
f6
(
x2
);
// ok
}
...
...
@@ -45,40 +48,18 @@ struct S<Sized? X> {
}
fn
f8
<
Sized
?
X
>
(
x1
:
&
S
<
X
>
,
x2
:
&
S
<
X
>
)
{
f5
(
x1
);
//~ERROR instantiating a type parameter with an incompatible type `S<X>`, which does not
f5
(
x1
);
//~^ ERROR the trait `core::kinds::Sized` is not implemented
f6
(
x2
);
// ok
}
// Test some tuples.
fn
f9
<
Sized
?
X
>
(
x1
:
Box
<
S
<
X
>>
,
x2
:
Box
<
E
<
X
>>
)
{
f5
(
&
(
*
x1
,
34
i
));
//~ERROR E0161
//~^ ERROR
instantiating a type parameter with an incompatible type
f5
(
&
(
32
i
,
*
x2
));
//~ERROR E0161
//~^ ERROR
instantiating a type parameter with an incompatible type
f5
(
&
(
*
x1
,
34
i
));
//~^ ERROR
the trait `core::kinds::Sized` is not implemented
f5
(
&
(
32
i
,
*
x2
));
//~^ ERROR
the trait `core::kinds::Sized` is not implemented
}
// impl - bounded
trait
T1
<
Z
:
T
>
{
}
struct
S3
<
Sized
?
Y
>
;
impl
<
Sized
?
X
:
T
>
T1
<
X
>
for
S3
<
X
>
{
//~ ERROR instantiating a type parameter with an incompatible
}
// impl - unbounded
trait
T2
<
Z
>
{
}
impl
<
Sized
?
X
>
T2
<
X
>
for
S3
<
X
>
{
//~ ERROR instantiating a type parameter with an incompatible type
}
// impl - struct
trait
T3
<
Sized
?
Z
>
{
}
struct
S4
<
Y
>
;
impl
<
Sized
?
X
>
T3
<
X
>
for
S4
<
X
>
{
//~ ERROR instantiating a type parameter with an incompatible type
}
impl
<
Sized
?
X
>
S4
<
X
>
{
//~ ERROR instantiating a type parameter with an incompatible type
}
pub
fn
main
()
{
}
src/test/compile-fail/unsized6.rs
浏览文件 @
b88f8678
...
...
@@ -14,33 +14,29 @@
trait
T
for
Sized
?
{}
fn
f1
<
Sized
?
X
>
(
x
:
&
X
)
{
let
_
:
X
;
//
~ERROR variable `_` has dynamically sized type `X`
let
_
:
(
int
,
(
X
,
int
));
//
~ERROR variable `_` has dynamically sized type `(int,(X,int))`
let
y
:
X
;
//~ERROR
variable `y` has dynamically sized type `X`
let
y
:
(
int
,
(
X
,
int
));
//~ERROR
variable `y` has dynamically sized type `(int,(X,int))`
let
_
:
X
;
//
<-- this is OK, no bindings created, no initializer.
let
_
:
(
int
,
(
X
,
int
));
//
same
let
y
:
X
;
//~ERROR
the trait `core::kinds::Sized` is not implemented
let
y
:
(
int
,
(
X
,
int
));
//~ERROR
the trait `core::kinds::Sized` is not implemented
}
fn
f2
<
Sized
?
X
:
T
>
(
x
:
&
X
)
{
let
_
:
X
;
//~ERROR variable `_` has dynamically sized type `X`
let
_
:
(
int
,
(
X
,
int
));
//~ERROR variable `_` has dynamically sized type `(int,(X,int))`
let
y
:
X
;
//~ERROR variable `y` has dynamically sized type `X`
let
y
:
(
int
,
(
X
,
int
));
//~ERROR variable `y` has dynamically sized type `(int,(X,int))`
let
y
:
X
;
//~ERROR the trait `core::kinds::Sized` is not implemented
let
y
:
(
int
,
(
X
,
int
));
//~ERROR the trait `core::kinds::Sized` is not implemented
}
fn
f3
<
Sized
?
X
>
(
x1
:
Box
<
X
>
,
x2
:
Box
<
X
>
,
x3
:
Box
<
X
>
)
{
let
y
:
X
=
*
x1
;
//~ERROR variable `y` has dynamically sized type `X`
let
y
=
*
x2
;
//~ERROR variable `y` has dynamically sized type `X`
let
(
y
,
z
)
=
(
*
x3
,
4
i
);
//~ERROR variable `y` has dynamically sized type `X`
//~^ ERROR E0161
let
y
:
X
=
*
x1
;
//~ERROR the trait `core::kinds::Sized` is not implemented
let
y
=
*
x2
;
//~ERROR the trait `core::kinds::Sized` is not implemented
let
(
y
,
z
)
=
(
*
x3
,
4
i
);
//~ERROR the trait `core::kinds::Sized` is not implemented
}
fn
f4
<
Sized
?
X
:
T
>
(
x1
:
Box
<
X
>
,
x2
:
Box
<
X
>
,
x3
:
Box
<
X
>
)
{
let
y
:
X
=
*
x1
;
//~ERROR variable `y` has dynamically sized type `X`
let
y
=
*
x2
;
//~ERROR variable `y` has dynamically sized type `X`
let
(
y
,
z
)
=
(
*
x3
,
4
i
);
//~ERROR variable `y` has dynamically sized type `X`
//~^ ERROR E0161
let
y
:
X
=
*
x1
;
//~ERROR the trait `core::kinds::Sized` is not implemented
let
y
=
*
x2
;
//~ERROR the trait `core::kinds::Sized` is not implemented
let
(
y
,
z
)
=
(
*
x3
,
4
i
);
//~ERROR the trait `core::kinds::Sized` is not implemented
}
fn
g1
<
Sized
?
X
>
(
x
:
X
)
{}
//~ERROR
variable `x` has dynamically sized type `X`
fn
g2
<
Sized
?
X
:
T
>
(
x
:
X
)
{}
//~ERROR
variable `x` has dynamically sized type `X`
fn
g1
<
Sized
?
X
>
(
x
:
X
)
{}
//~ERROR
the trait `core::kinds::Sized` is not implemented
fn
g2
<
Sized
?
X
:
T
>
(
x
:
X
)
{}
//~ERROR
the trait `core::kinds::Sized` is not implemented
pub
fn
main
()
{
}
src/test/compile-fail/unsized7.rs
0 → 100644
浏览文件 @
b88f8678
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test sized-ness checking in substitution in impls.
trait
T
for
Sized
?
{}
// I would like these to fail eventually.
// impl - bounded
trait
T1
<
Z
:
T
>
{
}
struct
S3
<
Sized
?
Y
>
;
impl
<
Sized
?
X
:
T
>
T1
<
X
>
for
S3
<
X
>
{
//~^ ERROR `core::kinds::Sized` is not implemented for the type `X`
}
// impl - unbounded
trait
T2
<
Z
>
{
}
struct
S4
<
Sized
?
Y
>
;
impl
<
Sized
?
X
>
T2
<
X
>
for
S4
<
X
>
{
//~^ ERROR `core::kinds::Sized` is not implemented for the type `X`
}
// impl - struct
trait
T3
<
Sized
?
Z
>
{
}
struct
S5
<
Y
>
;
impl
<
Sized
?
X
>
T3
<
X
>
for
S5
<
X
>
{
//~ ERROR not implemented
}
impl
<
Sized
?
X
>
S5
<
X
>
{
//~ ERROR not implemented
}
fn
main
()
{
}
src/test/compile-fail/vec-res-add.rs
浏览文件 @
b88f8678
...
...
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: failed to find an implementation
struct
r
{
i
:
int
}
...
...
@@ -25,5 +23,7 @@ fn main() {
let
i
=
vec!
(
r
(
0
));
let
j
=
vec!
(
r
(
1
));
let
k
=
i
+
j
;
//~^ ERROR not implemented
println!
(
"{}"
,
j
);
//~^ ERROR not implemented
}
src/test/compile-fail/vtable-res-trait-param.rs
浏览文件 @
b88f8678
...
...
@@ -24,8 +24,7 @@ fn gimme_an_a<A:TraitA>(&self, a: A) -> int {
fn
call_it
<
B
:
TraitB
>
(
b
:
B
)
->
int
{
let
y
=
4u
;
b
.gimme_an_a
(
y
)
//~ ERROR failed to find an implementation of trait TraitA
//~^ ERROR failed to find an implementation of trait TraitA
b
.gimme_an_a
(
y
)
//~ ERROR the trait `TraitA` is not implemented
}
fn
main
()
{
...
...
src/test/compile-fail/where-clauses-unsatisfied.rs
浏览文件 @
b88f8678
...
...
@@ -15,9 +15,6 @@ fn equal<T>(_: &T, _: &T) -> bool where T : Eq {
fn
main
()
{
drop
(
equal
(
&
Struct
,
&
Struct
))
//~^ ERROR failed to find an implementation of trait core::cmp::Eq
//~^^ ERROR failed to find an implementation of trait core::cmp::PartialEq
//~^^^ ERROR failed to find an implementation of trait core::cmp::Eq
//~^^^^ ERROR failed to find an implementation of trait core::cmp::PartialEq
//~^ ERROR the trait `core::cmp::Eq` is not implemented
}
src/test/run-pass/drop-struct-as-object.rs
0 → 100644
浏览文件 @
b88f8678
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that destructor on a struct runs successfully after the struct
// is boxed and converted to an object.
static
mut
value
:
uint
=
0
;
struct
Cat
{
name
:
uint
,
}
trait
Dummy
{
fn
get
(
&
self
)
->
uint
;
}
impl
Dummy
for
Cat
{
fn
get
(
&
self
)
->
uint
{
self
.name
}
}
impl
Drop
for
Cat
{
fn
drop
(
&
mut
self
)
{
unsafe
{
value
=
self
.name
;
}
}
}
pub
fn
main
()
{
{
let
x
=
box
Cat
{
name
:
22
};
let
nyan
:
Box
<
Dummy
>
=
x
as
Box
<
Dummy
>
;
}
unsafe
{
assert_eq!
(
value
,
22
);
}
}
src/test/run-pass/object-one-type-two-traits.rs
0 → 100644
浏览文件 @
b88f8678
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Testing creating two vtables with the same self type, but different
// traits.
use
std
::
any
::
Any
;
use
std
::
any
::
AnyRefExt
;
trait
Wrap
{
fn
get
(
&
self
)
->
int
;
fn
wrap
(
self
:
Box
<
Self
>
)
->
Box
<
Any
+
'static
>
;
}
impl
Wrap
for
int
{
fn
get
(
&
self
)
->
int
{
*
self
}
fn
wrap
(
self
:
Box
<
int
>
)
->
Box
<
Any
+
'static
>
{
self
as
Box
<
Any
+
'static
>
}
}
fn
is
<
T
:
'static
>
(
x
:
&
Any
)
->
bool
{
x
.is
::
<
T
>
()
}
fn
main
()
{
let
x
=
box
22
i
as
Box
<
Wrap
>
;
println!
(
"x={}"
,
x
.get
());
let
y
=
x
.wrap
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录