mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
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
This commit is contained in:
commit
5be51f27b4
@ -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> {
|
||||
|
@ -1,11 +1,5 @@
|
||||
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`.
|
||||
|
@ -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> {
|
||||
|
@ -1,17 +1,5 @@
|
||||
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:18:43
|
||||
--> $DIR/generic_underconstrained2.rs:16: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: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`
|
||||
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`.
|
||||
|
Loading…
Reference in New Issue
Block a user