Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1a819a22
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,发现更多精彩内容 >>
提交
1a819a22
编写于
9月 20, 2016
作者:
S
sinkuu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make E0243/0244 message consistent with E0107
上级
3fc8304f
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
41 addition
and
36 deletion
+41
-36
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+16
-11
src/test/compile-fail/E0243.rs
src/test/compile-fail/E0243.rs
+2
-2
src/test/compile-fail/E0244.rs
src/test/compile-fail/E0244.rs
+2
-2
src/test/compile-fail/generic-type-less-params-with-defaults.rs
...st/compile-fail/generic-type-less-params-with-defaults.rs
+2
-2
src/test/compile-fail/generic-type-more-params-with-defaults.rs
...st/compile-fail/generic-type-more-params-with-defaults.rs
+2
-2
src/test/compile-fail/issue-14092.rs
src/test/compile-fail/issue-14092.rs
+2
-2
src/test/compile-fail/issue-23024.rs
src/test/compile-fail/issue-23024.rs
+1
-1
src/test/compile-fail/typeck-builtin-bound-type-parameters.rs
...test/compile-fail/typeck-builtin-bound-type-parameters.rs
+8
-8
src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs
src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs
+2
-2
src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs
src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs
+2
-2
src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs
src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs
+2
-2
未找到文件。
src/librustc_typeck/astconv.rs
浏览文件 @
1a819a22
...
...
@@ -2245,27 +2245,32 @@ fn check_type_argument_count(tcx: TyCtxt, span: Span, supplied: usize,
"expected"
};
let
arguments_plural
=
if
required
==
1
{
""
}
else
{
"s"
};
struct_span_err!
(
tcx
.sess
,
span
,
E0243
,
"wrong number of type arguments"
)
.span_label
(
span
,
&
format!
(
"{} {} type argument{}, found {}"
,
expected
,
required
,
arguments_plural
,
supplied
)
)
struct_span_err!
(
tcx
.sess
,
span
,
E0243
,
"wrong number of type arguments: {} {}, found {}"
,
expected
,
required
,
supplied
)
.span_label
(
span
,
&
format!
(
"{} {} type argument{}"
,
expected
,
required
,
arguments_plural
))
.emit
();
}
else
if
supplied
>
accepted
{
let
expected
=
if
required
==
0
{
"expected no"
.to_string
()
}
else
if
required
<
accepted
{
let
expected
=
if
required
<
accepted
{
format!
(
"expected at most {}"
,
accepted
)
}
else
{
format!
(
"expected {}"
,
accepted
)
};
let
arguments_plural
=
if
accepted
==
1
{
""
}
else
{
"s"
};
struct_span_err!
(
tcx
.sess
,
span
,
E0244
,
"wrong number of type arguments"
)
struct_span_err!
(
tcx
.sess
,
span
,
E0244
,
"wrong number of type arguments: {}, found {}"
,
expected
,
supplied
)
.span_label
(
span
,
&
format!
(
"{} type argument{}, found {}"
,
expected
,
arguments_plural
,
supplied
)
&
format!
(
"{} type argument{}"
,
if
accepted
==
0
{
"expected no"
}
else
{
&
expected
},
arguments_plural
)
)
.emit
();
}
...
...
src/test/compile-fail/E0243.rs
浏览文件 @
1a819a22
...
...
@@ -10,8 +10,8 @@
struct
Foo
<
T
>
{
x
:
T
}
struct
Bar
{
x
:
Foo
}
//~^ ERROR
E0243
//~| NOTE expected 1 type argument
, found 0
//~^ ERROR
wrong number of type arguments: expected 1, found 0 [E0243]
//~| NOTE expected 1 type argument
fn
main
()
{
}
src/test/compile-fail/E0244.rs
浏览文件 @
1a819a22
...
...
@@ -10,8 +10,8 @@
struct
Foo
{
x
:
bool
}
struct
Bar
<
S
,
T
>
{
x
:
Foo
<
S
,
T
>
}
//~^ ERROR
E0244
//~| NOTE expected no type arguments
, found 2
//~^ ERROR
wrong number of type arguments: expected 0, found 2 [E0244]
//~| NOTE expected no type arguments
fn
main
()
{
...
...
src/test/compile-fail/generic-type-less-params-with-defaults.rs
浏览文件 @
1a819a22
...
...
@@ -17,6 +17,6 @@ struct Vec<T, A = Heap>(
fn
main
()
{
let
_
:
Vec
;
//~^ ERROR
E0243
//~| NOTE expected at least 1 type argument
, found 0
//~^ ERROR
wrong number of type arguments: expected at least 1, found 0 [E0243]
//~| NOTE expected at least 1 type argument
}
src/test/compile-fail/generic-type-more-params-with-defaults.rs
浏览文件 @
1a819a22
...
...
@@ -17,6 +17,6 @@ struct Vec<T, A = Heap>(
fn
main
()
{
let
_
:
Vec
<
isize
,
Heap
,
bool
>
;
//~^ ERROR
E0244
//~| NOTE expected at most 2 type arguments
, found 3
//~^ ERROR
wrong number of type arguments: expected at most 2, found 3 [E0244]
//~| NOTE expected at most 2 type arguments
}
src/test/compile-fail/issue-14092.rs
浏览文件 @
1a819a22
...
...
@@ -9,7 +9,7 @@
// except according to those terms.
fn
fn1
(
0
:
Box
)
{}
//~^ ERROR
E0243
//~| NOTE expected 1 type argument
, found 0
//~^ ERROR
wrong number of type arguments: expected 1, found 0 [E0243]
//~| NOTE expected 1 type argument
fn
main
()
{}
src/test/compile-fail/issue-23024.rs
浏览文件 @
1a819a22
...
...
@@ -18,6 +18,6 @@ fn h(x:i32) -> i32 {3*x}
vfnfer
.push
(
box
h
);
println!
(
"{:?}"
,(
vfnfer
[
0
]
as
Fn
)(
3
));
//~^ ERROR the precise format of `Fn`-family traits'
//~| ERROR
E0243
//~| ERROR
wrong number of type arguments: expected 1, found 0 [E0243]
//~| ERROR the value of the associated type `Output` (from the trait `std::ops::FnOnce`)
}
src/test/compile-fail/typeck-builtin-bound-type-parameters.rs
浏览文件 @
1a819a22
...
...
@@ -9,16 +9,16 @@
// except according to those terms.
fn
foo1
<
T
:
Copy
<
U
>
,
U
>
(
x
:
T
)
{}
//~^ ERROR
E0244
//~| NOTE expected no type arguments
, found 1
//~^ ERROR
wrong number of type arguments: expected 0, found 1 [E0244]
//~| NOTE expected no type arguments
trait
Trait
:
Copy
<
Send
>
{}
//~^ ERROR
E0244
//~| NOTE expected no type arguments
, found 1
//~^ ERROR
wrong number of type arguments: expected 0, found 1 [E0244]
//~| NOTE expected no type arguments
struct
MyStruct1
<
T
:
Copy
<
T
>>
;
//~^ ERROR
E0244
//~| NOTE expected no type arguments
, found 1
//~^ ERROR
wrong number of type arguments: expected 0, found 1 [E0244]
//~| NOTE expected no type arguments
struct
MyStruct2
<
'a
,
T
:
Copy
<
'a
>>
;
//~^ ERROR: wrong number of lifetime parameters: expected 0, found 1
...
...
@@ -26,8 +26,8 @@ trait Trait: Copy<Send> {}
fn
foo2
<
'a
,
T
:
Copy
<
'a
,
U
>
,
U
>
(
x
:
T
)
{}
//~^ ERROR
E0244
//~| NOTE expected no type arguments
, found 1
//~^ ERROR
wrong number of type arguments: expected 0, found 1 [E0244]
//~| NOTE expected no type arguments
//~| ERROR: wrong number of lifetime parameters: expected 0, found 1
//~| NOTE unexpected lifetime parameter
...
...
src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs
浏览文件 @
1a819a22
...
...
@@ -17,6 +17,6 @@ struct Foo<'a, T:'a> {
pub
fn
main
()
{
let
c
:
Foo
<
_
,
_
>
=
Foo
{
r
:
&
5
};
//~^ ERROR
E0244
//~| NOTE expected 1 type argument
, found 2
//~^ ERROR
wrong number of type arguments: expected 1, found 2 [E0244]
//~| NOTE expected 1 type argument
}
src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs
浏览文件 @
1a819a22
...
...
@@ -17,6 +17,6 @@ struct Foo<'a, T:'a> {
pub
fn
main
()
{
let
c
:
Foo
<
_
,
usize
>
=
Foo
{
r
:
&
5
};
//~^ ERROR
E0244
//~| NOTE expected 1 type argument
, found 2
//~^ ERROR
wrong number of type arguments: expected 1, found 2 [E0244]
//~| NOTE expected 1 type argument
}
src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs
浏览文件 @
1a819a22
...
...
@@ -13,8 +13,8 @@
trait
Trait
{}
fn
f
<
F
:
Trait
(
isize
)
->
isize
>
(
x
:
F
)
{}
//~^ ERROR
E0244
//~| NOTE expected no type arguments
, found 1
//~^ ERROR
wrong number of type arguments: expected 0, found 1 [E0244]
//~| NOTE expected no type arguments
//~| ERROR E0220
//~| NOTE associated type `Output` not found
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录