Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
49a31a2b
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
49a31a2b
编写于
8月 20, 2021
作者:
S
Santiago Pastorino
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
We meant to use a trait instead of lifetime here
上级
a9ab2e55
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
33 deletion
+12
-33
src/test/ui/type-alias-impl-trait/generic_underconstrained.rs
...test/ui/type-alias-impl-trait/generic_underconstrained.rs
+1
-2
src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr
.../ui/type-alias-impl-trait/generic_underconstrained.stderr
+3
-9
src/test/ui/type-alias-impl-trait/generic_underconstrained2.rs
...est/ui/type-alias-impl-trait/generic_underconstrained2.rs
+2
-4
src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr
...ui/type-alias-impl-trait/generic_underconstrained2.stderr
+6
-18
未找到文件。
src/test/ui/type-alias-impl-trait/generic_underconstrained.rs
浏览文件 @
49a31a2b
...
...
@@ -3,8 +3,7 @@
fn
main
()
{}
trait
Trait
{}
type
Underconstrained
<
T
:
Trait
>
=
impl
'static
;
//~^ ERROR: at least one trait must be specified
type
Underconstrained
<
T
:
Trait
>
=
impl
Send
;
// no `Trait` bound
fn
underconstrain
<
T
>
(
_
:
T
)
->
Underconstrained
<
T
>
{
...
...
src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr
浏览文件 @
49a31a2b
error: at least one trait must be specified
--> $DIR/generic_underconstrained.rs:6:35
|
LL | type Underconstrained<T: Trait> = impl 'static;
| ^^^^^^^^^^^^
error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/generic_underconstrained.rs:
10
:31
--> $DIR/generic_underconstrained.rs:
9
:31
|
LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
...
...
@@ -13,13 +7,13 @@ LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
note: required by a bound in `Underconstrained`
--> $DIR/generic_underconstrained.rs:6:26
|
LL | type Underconstrained<T: Trait> = impl
'static
;
LL | type Underconstrained<T: Trait> = impl
Send
;
| ^^^^^ required by this bound in `Underconstrained`
help: consider restricting type parameter `T`
|
LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
| +++++++
error: aborting due to
2 previous errors
error: aborting due to
previous error
For more information about this error, try `rustc --explain E0277`.
src/test/ui/type-alias-impl-trait/generic_underconstrained2.rs
浏览文件 @
49a31a2b
...
...
@@ -2,8 +2,7 @@
fn
main
()
{}
type
Underconstrained
<
T
:
std
::
fmt
::
Debug
>
=
impl
'static
;
//~^ ERROR: at least one trait must be specified
type
Underconstrained
<
T
:
std
::
fmt
::
Debug
>
=
impl
Send
;
// not a defining use, because it doesn't define *all* possible generics
fn
underconstrained
<
U
>
(
_
:
U
)
->
Underconstrained
<
U
>
{
...
...
@@ -11,8 +10,7 @@ fn underconstrained<U>(_: U) -> Underconstrained<U> {
5u32
}
type
Underconstrained2
<
T
:
std
::
fmt
::
Debug
>
=
impl
'static
;
//~^ ERROR: at least one trait must be specified
type
Underconstrained2
<
T
:
std
::
fmt
::
Debug
>
=
impl
Send
;
// not a defining use, because it doesn't define *all* possible generics
fn
underconstrained2
<
U
,
V
>
(
_
:
U
,
_
:
V
)
->
Underconstrained2
<
V
>
{
...
...
src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr
浏览文件 @
49a31a2b
error: at least one trait must be specified
--> $DIR/generic_underconstrained2.rs:5:45
|
LL | type Underconstrained<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^^^^^^
error: at least one trait must be specified
--> $DIR/generic_underconstrained2.rs:14:46
|
LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^^^^^^
error[E0277]: `U` doesn't implement `Debug`
--> $DIR/generic_underconstrained2.rs:
9
:33
--> $DIR/generic_underconstrained2.rs:
8
:33
|
LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
| ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
...
...
@@ -19,7 +7,7 @@ LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
note: required by a bound in `Underconstrained`
--> $DIR/generic_underconstrained2.rs:5:26
|
LL | type Underconstrained<T: std::fmt::Debug> = impl
'static
;
LL | type Underconstrained<T: std::fmt::Debug> = impl
Send
;
| ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained`
help: consider restricting type parameter `U`
|
...
...
@@ -27,21 +15,21 @@ LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
| +++++++++++++++++
error[E0277]: `V` doesn't implement `Debug`
--> $DIR/generic_underconstrained2.rs:1
8
:43
--> $DIR/generic_underconstrained2.rs:1
6
:43
|
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
note: required by a bound in `Underconstrained2`
--> $DIR/generic_underconstrained2.rs:1
4
:27
--> $DIR/generic_underconstrained2.rs:1
3
:27
|
LL | type Underconstrained2<T: std::fmt::Debug> = impl
'static
;
LL | type Underconstrained2<T: std::fmt::Debug> = impl
Send
;
| ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained2`
help: consider restricting type parameter `V`
|
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
| +++++++++++++++++
error: aborting due to
4
previous errors
error: aborting due to
2
previous errors
For more information about this error, try `rustc --explain E0277`.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录