Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
7098cfda
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,发现更多精彩内容 >>
提交
7098cfda
编写于
1月 12, 2016
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix test cases accordingly
上级
25937942
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
43 addition
and
1 deletion
+43
-1
src/test/compile-fail/empty-struct-unit-pat.rs
src/test/compile-fail/empty-struct-unit-pat.rs
+2
-0
src/test/compile-fail/private-in-public-warn.rs
src/test/compile-fail/private-in-public-warn.rs
+36
-0
src/test/compile-fail/private-variant-reexport.rs
src/test/compile-fail/private-variant-reexport.rs
+4
-0
src/test/compile-fail/type-parameter-invalid-lint.rs
src/test/compile-fail/type-parameter-invalid-lint.rs
+1
-1
未找到文件。
src/test/compile-fail/empty-struct-unit-pat.rs
浏览文件 @
7098cfda
...
@@ -32,6 +32,7 @@ fn main() { //~ ERROR: compilation successful
...
@@ -32,6 +32,7 @@ fn main() { //~ ERROR: compilation successful
// }
// }
match
e1
{
match
e1
{
Empty1
(
..
)
=>
()
//~ WARN `Empty1` does not name a tuple variant or a tuple struct
Empty1
(
..
)
=>
()
//~ WARN `Empty1` does not name a tuple variant or a tuple struct
//~^ WARN HARD ERROR
}
}
// Rejected by parser as yet
// Rejected by parser as yet
// match e2 {
// match e2 {
...
@@ -39,5 +40,6 @@ fn main() { //~ ERROR: compilation successful
...
@@ -39,5 +40,6 @@ fn main() { //~ ERROR: compilation successful
// }
// }
match
e2
{
match
e2
{
E
::
Empty2
(
..
)
=>
()
//~ WARN `E::Empty2` does not name a tuple variant or a tuple struct
E
::
Empty2
(
..
)
=>
()
//~ WARN `E::Empty2` does not name a tuple variant or a tuple struct
//~^ WARN HARD ERROR
}
}
}
}
src/test/compile-fail/private-in-public-warn.rs
浏览文件 @
7098cfda
...
@@ -26,23 +26,34 @@ pub trait PubTr {
...
@@ -26,23 +26,34 @@ pub trait PubTr {
}
}
pub
type
Alias
=
Priv
;
//~ WARN private type in public interface
pub
type
Alias
=
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
pub
enum
E
{
pub
enum
E
{
V1
(
Priv
),
//~ WARN private type in public interface
V1
(
Priv
),
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
V2
{
field
:
Priv
},
//~ WARN private type in public interface
V2
{
field
:
Priv
},
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
pub
trait
Tr
{
pub
trait
Tr
{
const
C
:
Priv
=
Priv
;
//~ WARN private type in public interface
const
C
:
Priv
=
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
type
Alias
=
Priv
;
//~ WARN private type in public interface
type
Alias
=
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
fn
f1
(
arg
:
Priv
)
{}
//~ WARN private type in public interface
fn
f1
(
arg
:
Priv
)
{}
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
fn
f2
()
->
Priv
{
panic!
()
}
//~ WARN private type in public interface
fn
f2
()
->
Priv
{
panic!
()
}
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
extern
{
extern
{
pub
static
ES
:
Priv
;
//~ WARN private type in public interface
pub
static
ES
:
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
pub
fn
ef1
(
arg
:
Priv
);
//~ WARN private type in public interface
pub
fn
ef1
(
arg
:
Priv
);
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
pub
fn
ef2
()
->
Priv
;
//~ WARN private type in public interface
pub
fn
ef2
()
->
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
impl
PubTr
for
Pub
{
impl
PubTr
for
Pub
{
type
Alias
=
Priv
;
//~ WARN private type in public interface
type
Alias
=
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
}
}
...
@@ -53,14 +64,21 @@ pub trait PubTr {}
...
@@ -53,14 +64,21 @@ pub trait PubTr {}
pub
type
Alias
<
T
:
PrivTr
>
=
T
;
//~ WARN private trait in public interface
pub
type
Alias
<
T
:
PrivTr
>
=
T
;
//~ WARN private trait in public interface
//~^ WARN trait bounds are not (yet) enforced in type definitions
//~^ WARN trait bounds are not (yet) enforced in type definitions
//~| WARNING HARD ERROR
pub
trait
Tr1
:
PrivTr
{}
//~ WARN private trait in public interface
pub
trait
Tr1
:
PrivTr
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
pub
trait
Tr2
<
T
:
PrivTr
>
{}
//~ WARN private trait in public interface
pub
trait
Tr2
<
T
:
PrivTr
>
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
pub
trait
Tr3
{
pub
trait
Tr3
{
type
Alias
:
PrivTr
;
//~ WARN private trait in public interface
type
Alias
:
PrivTr
;
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
fn
f
<
T
:
PrivTr
>
(
arg
:
T
)
{}
//~ WARN private trait in public interface
fn
f
<
T
:
PrivTr
>
(
arg
:
T
)
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
}
}
impl
<
T
:
PrivTr
>
Pub
<
T
>
{}
//~ WARN private trait in public interface
impl
<
T
:
PrivTr
>
Pub
<
T
>
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
impl
<
T
:
PrivTr
>
PubTr
for
Pub
<
T
>
{}
//~ WARN private trait in public interface
impl
<
T
:
PrivTr
>
PubTr
for
Pub
<
T
>
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
}
}
mod
traits_where
{
mod
traits_where
{
...
@@ -69,12 +87,17 @@ trait PrivTr {}
...
@@ -69,12 +87,17 @@ trait PrivTr {}
pub
trait
PubTr
{}
pub
trait
PubTr
{}
pub
type
Alias
<
T
>
where
T
:
PrivTr
=
T
;
//~ WARN private trait in public interface
pub
type
Alias
<
T
>
where
T
:
PrivTr
=
T
;
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
pub
trait
Tr2
<
T
>
where
T
:
PrivTr
{}
//~ WARN private trait in public interface
pub
trait
Tr2
<
T
>
where
T
:
PrivTr
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
pub
trait
Tr3
{
pub
trait
Tr3
{
fn
f
<
T
>
(
arg
:
T
)
where
T
:
PrivTr
{}
//~ WARN private trait in public interface
fn
f
<
T
>
(
arg
:
T
)
where
T
:
PrivTr
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
}
}
impl
<
T
>
Pub
<
T
>
where
T
:
PrivTr
{}
//~ WARN private trait in public interface
impl
<
T
>
Pub
<
T
>
where
T
:
PrivTr
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
impl
<
T
>
PubTr
for
Pub
<
T
>
where
T
:
PrivTr
{}
//~ WARN private trait in public interface
impl
<
T
>
PubTr
for
Pub
<
T
>
where
T
:
PrivTr
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
}
}
mod
generics
{
mod
generics
{
...
@@ -84,9 +107,13 @@ trait PrivTr<T> {}
...
@@ -84,9 +107,13 @@ trait PrivTr<T> {}
pub
trait
PubTr
<
T
>
{}
pub
trait
PubTr
<
T
>
{}
pub
trait
Tr1
:
PrivTr
<
Pub
>
{}
//~ WARN private trait in public interface
pub
trait
Tr1
:
PrivTr
<
Pub
>
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
pub
trait
Tr2
:
PubTr
<
Priv
>
{}
//~ WARN private type in public interface
pub
trait
Tr2
:
PubTr
<
Priv
>
{}
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
pub
trait
Tr3
:
PubTr
<
[
Priv
;
1
]
>
{}
//~ WARN private type in public interface
pub
trait
Tr3
:
PubTr
<
[
Priv
;
1
]
>
{}
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
pub
trait
Tr4
:
PubTr
<
Pub
<
Priv
>>
{}
//~ WARN private type in public interface
pub
trait
Tr4
:
PubTr
<
Pub
<
Priv
>>
{}
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
mod
impls
{
mod
impls
{
...
@@ -113,6 +140,7 @@ impl PrivTr for Pub {
...
@@ -113,6 +140,7 @@ impl PrivTr for Pub {
}
}
impl
PubTr
for
Pub
{
impl
PubTr
for
Pub
{
type
Alias
=
Priv
;
//~ WARN private type in public interface
type
Alias
=
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
}
}
...
@@ -179,9 +207,11 @@ pub fn f1(arg: PrivUseAlias) {} // OK
...
@@ -179,9 +207,11 @@ pub fn f1(arg: PrivUseAlias) {} // OK
pub
trait
Tr1
:
PrivUseAliasTr
{}
// OK
pub
trait
Tr1
:
PrivUseAliasTr
{}
// OK
// This should be OK, if type aliases are substituted
// This should be OK, if type aliases are substituted
pub
trait
Tr2
:
PrivUseAliasTr
<
PrivAlias
>
{}
//~ WARN private type in public interface
pub
trait
Tr2
:
PrivUseAliasTr
<
PrivAlias
>
{}
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
impl
PrivAlias
{
impl
PrivAlias
{
pub
fn
f
(
arg
:
Priv
)
{}
//~ WARN private type in public interface
pub
fn
f
(
arg
:
Priv
)
{}
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
// This doesn't even parse
// This doesn't even parse
// impl <Priv as PrivTr>::AssocAlias {
// impl <Priv as PrivTr>::AssocAlias {
...
@@ -189,12 +219,15 @@ pub fn f(arg: Priv) {} //~ WARN private type in public interface
...
@@ -189,12 +219,15 @@ pub fn f(arg: Priv) {} //~ WARN private type in public interface
// }
// }
impl
PrivUseAliasTr
for
PrivUseAlias
{
impl
PrivUseAliasTr
for
PrivUseAlias
{
type
Check
=
Priv
;
//~ WARN private type in public interface
type
Check
=
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
impl
PrivUseAliasTr
for
PrivAlias
{
impl
PrivUseAliasTr
for
PrivAlias
{
type
Check
=
Priv
;
//~ WARN private type in public interface
type
Check
=
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
impl
PrivUseAliasTr
for
<
Priv
as
PrivTr
>
::
AssocAlias
{
impl
PrivUseAliasTr
for
<
Priv
as
PrivTr
>
::
AssocAlias
{
type
Check
=
Priv
;
//~ WARN private type in public interface
type
Check
=
Priv
;
//~ WARN private type in public interface
//~^ WARNING HARD ERROR
}
}
}
}
...
@@ -217,8 +250,11 @@ trait PrivTr {
...
@@ -217,8 +250,11 @@ trait PrivTr {
impl
PrivTr
for
Priv
{}
impl
PrivTr
for
Priv
{}
pub
trait
Tr1
:
PrivUseAliasTr
{}
//~ WARN private trait in public interface
pub
trait
Tr1
:
PrivUseAliasTr
{}
//~ WARN private trait in public interface
//~^ WARNING HARD ERROR
pub
trait
Tr2
:
PrivUseAliasTr
<
PrivAlias
>
{}
//~ WARN private trait in public interface
pub
trait
Tr2
:
PrivUseAliasTr
<
PrivAlias
>
{}
//~ WARN private trait in public interface
//~^ WARN private type in public interface
//~^ WARN private type in public interface
//~| WARNING HARD ERROR
//~| WARNING HARD ERROR
impl
PrivUseAlias
{
impl
PrivUseAlias
{
pub
fn
f
(
arg
:
Priv
)
{}
// OK
pub
fn
f
(
arg
:
Priv
)
{}
// OK
...
...
src/test/compile-fail/private-variant-reexport.rs
浏览文件 @
7098cfda
...
@@ -13,18 +13,22 @@
...
@@ -13,18 +13,22 @@
mod
m1
{
mod
m1
{
pub
use
::
E
::
V
;
//~ WARN variant `V` is private, and cannot be reexported
pub
use
::
E
::
V
;
//~ WARN variant `V` is private, and cannot be reexported
//~^ WARNING HARD ERROR
}
}
mod
m2
{
mod
m2
{
pub
use
::
E
::{
V
};
//~ WARN variant `V` is private, and cannot be reexported
pub
use
::
E
::{
V
};
//~ WARN variant `V` is private, and cannot be reexported
//~^ WARNING HARD ERROR
}
}
mod
m3
{
mod
m3
{
pub
use
::
E
::
V
::{
self
};
//~ WARN variant `V` is private, and cannot be reexported
pub
use
::
E
::
V
::{
self
};
//~ WARN variant `V` is private, and cannot be reexported
//~^ WARNING HARD ERROR
}
}
mod
m4
{
mod
m4
{
pub
use
::
E
::
*
;
//~ WARN variant `V` is private, and cannot be reexported
pub
use
::
E
::
*
;
//~ WARN variant `V` is private, and cannot be reexported
//~^ WARNING HARD ERROR
}
}
enum
E
{
V
}
enum
E
{
V
}
...
...
src/test/compile-fail/type-parameter-invalid-lint.rs
浏览文件 @
7098cfda
...
@@ -13,5 +13,5 @@
...
@@ -13,5 +13,5 @@
fn
avg
<
T
=
i32
>
(
_
:
T
)
{}
fn
avg
<
T
=
i32
>
(
_
:
T
)
{}
//~^ ERROR defaults for type parameters are only allowed
//~^ ERROR defaults for type parameters are only allowed
//~|
NOTE
HARD ERROR
//~|
WARNING
HARD ERROR
fn
main
()
{}
fn
main
()
{}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录