未验证 提交 5be51f27 编写于 作者: J Jack Huey 提交者: GitHub

Rollup merge of #88182 - spastorino:use-trait-in-tait-tests, r=oli-obk

We meant to use a trait instead of lifetime here

r? `@oli-obk`

Related to #86727
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
fn main() {} fn main() {}
trait Trait {} trait Trait {}
type Underconstrained<T: Trait> = impl 'static; type Underconstrained<T: Trait> = impl Send;
//~^ ERROR: at least one trait must be specified
// no `Trait` bound // no `Trait` bound
fn underconstrain<T>(_: T) -> Underconstrained<T> { fn underconstrain<T>(_: T) -> Underconstrained<T> {
......
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 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> { LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
...@@ -13,13 +7,13 @@ LL | fn underconstrain<T>(_: T) -> Underconstrained<T> { ...@@ -13,13 +7,13 @@ LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
note: required by a bound in `Underconstrained` note: required by a bound in `Underconstrained`
--> $DIR/generic_underconstrained.rs:6:26 --> $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` | ^^^^^ required by this bound in `Underconstrained`
help: consider restricting type parameter `T` help: consider restricting type parameter `T`
| |
LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<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`. For more information about this error, try `rustc --explain E0277`.
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
fn main() {} fn main() {}
type Underconstrained<T: std::fmt::Debug> = impl 'static; type Underconstrained<T: std::fmt::Debug> = impl Send;
//~^ ERROR: at least one trait must be specified
// not a defining use, because it doesn't define *all* possible generics // not a defining use, because it doesn't define *all* possible generics
fn underconstrained<U>(_: U) -> Underconstrained<U> { fn underconstrained<U>(_: U) -> Underconstrained<U> {
...@@ -11,8 +10,7 @@ fn underconstrained<U>(_: U) -> Underconstrained<U> { ...@@ -11,8 +10,7 @@ fn underconstrained<U>(_: U) -> Underconstrained<U> {
5u32 5u32
} }
type Underconstrained2<T: std::fmt::Debug> = impl 'static; type Underconstrained2<T: std::fmt::Debug> = impl Send;
//~^ ERROR: at least one trait must be specified
// not a defining use, because it doesn't define *all* possible generics // not a defining use, because it doesn't define *all* possible generics
fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> { fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
......
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` 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> { LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
| ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
...@@ -19,7 +7,7 @@ LL | fn underconstrained<U>(_: U) -> Underconstrained<U> { ...@@ -19,7 +7,7 @@ LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
note: required by a bound in `Underconstrained` note: required by a bound in `Underconstrained`
--> $DIR/generic_underconstrained2.rs:5:26 --> $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` | ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained`
help: consider restricting type parameter `U` help: consider restricting type parameter `U`
| |
...@@ -27,21 +15,21 @@ LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> { ...@@ -27,21 +15,21 @@ LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
| +++++++++++++++++ | +++++++++++++++++
error[E0277]: `V` doesn't implement `Debug` error[E0277]: `V` doesn't implement `Debug`
--> $DIR/generic_underconstrained2.rs:18:43 --> $DIR/generic_underconstrained2.rs:16:43
| |
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> { LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug` | ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| |
note: required by a bound in `Underconstrained2` note: required by a bound in `Underconstrained2`
--> $DIR/generic_underconstrained2.rs:14:27 --> $DIR/generic_underconstrained2.rs:13: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` | ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained2`
help: consider restricting type parameter `V` help: consider restricting type parameter `V`
| |
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<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`. 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.
先完成此消息的编辑!
想要评论请 注册