1
Fork 0

Don't use implied trait predicates in gather_explicit_predicates_of

This commit is contained in:
Michael Goulet 2023-04-19 00:13:53 +00:00
parent 8ea71f264e
commit bec7193072
22 changed files with 319 additions and 79 deletions

View file

@ -96,8 +96,9 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
| ItemKind::Struct(_, generics) | ItemKind::Struct(_, generics)
| ItemKind::Union(_, generics) => generics, | ItemKind::Union(_, generics) => generics,
ItemKind::Trait(_, _, generics, ..) | ItemKind::TraitAlias(generics, _) => { ItemKind::Trait(_, _, generics, self_bounds, ..)
is_trait = Some(ty::TraitRef::identity(tcx, def_id.to_def_id())); | ItemKind::TraitAlias(generics, self_bounds) => {
is_trait = Some(self_bounds);
generics generics
} }
ItemKind::OpaqueTy(OpaqueTy { generics, .. }) => generics, ItemKind::OpaqueTy(OpaqueTy { generics, .. }) => generics,
@ -119,10 +120,14 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
// Below we'll consider the bounds on the type parameters (including `Self`) // Below we'll consider the bounds on the type parameters (including `Self`)
// and the explicit where-clauses, but to get the full set of predicates // and the explicit where-clauses, but to get the full set of predicates
// on a trait we need to add in the supertrait bounds and bounds found on // on a trait we must also consider the bounds that follow the trait's name,
// associated types. // like `trait Foo: A + B + C`.
if let Some(_trait_ref) = is_trait { if let Some(self_bounds) = is_trait {
predicates.extend(tcx.implied_predicates_of(def_id).predicates.iter().cloned()); predicates.extend(
icx.astconv()
.compute_bounds(tcx.types.self_param, self_bounds, OnlySelfBounds(false))
.predicates(),
);
} }
// In default impls, we can assume that the self type implements // In default impls, we can assume that the self type implements

View file

@ -19,6 +19,8 @@ pub trait SVec: Index<
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
Output = <Index<<Self as SVec>::Item, Output = <Index<<Self as SVec>::Item,
//~^ expected 1 lifetime argument //~^ expected 1 lifetime argument
//~| expected 1 generic argument //~| expected 1 generic argument
@ -26,6 +28,8 @@ pub trait SVec: Index<
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
Output = <Self as SVec>::Item> as SVec>::Item, Output = <Self as SVec>::Item> as SVec>::Item,
//~^ expected 1 lifetime argument //~^ expected 1 lifetime argument
//~| expected 1 generic argument //~| expected 1 generic argument
@ -34,11 +38,15 @@ pub trait SVec: Index<
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| expected 1 generic argument //~| expected 1 generic argument
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
> { > {
type Item<'a, T>; type Item<'a, T>;

View file

@ -5,7 +5,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -21,7 +21,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -31,13 +31,13 @@ LL | <Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:22:37 --> $DIR/issue-105742.rs:24:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -47,13 +47,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:22:37 --> $DIR/issue-105742.rs:24:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -63,13 +63,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:29:30 --> $DIR/issue-105742.rs:33:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -79,13 +79,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:29:30 --> $DIR/issue-105742.rs:33:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -95,13 +95,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:29:46 --> $DIR/issue-105742.rs:33:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -111,13 +111,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:29:46 --> $DIR/issue-105742.rs:33:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -133,7 +133,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -149,7 +149,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -165,7 +165,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -181,7 +181,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -191,13 +191,13 @@ LL | <Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:22:37 --> $DIR/issue-105742.rs:24:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -207,13 +207,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:22:37 --> $DIR/issue-105742.rs:24:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -223,13 +223,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:29:30 --> $DIR/issue-105742.rs:33:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -239,13 +239,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:29:30 --> $DIR/issue-105742.rs:33:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -255,13 +255,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:29:46 --> $DIR/issue-105742.rs:33:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -271,13 +271,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:29:46 --> $DIR/issue-105742.rs:33:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -317,13 +317,141 @@ LL | | > {
| |__^ ...because it uses `Self` as a type parameter | |__^ ...because it uses `Self` as a type parameter
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:45:38 --> $DIR/issue-105742.rs:15:21
|
LL | <Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10
|
LL | type Item<'a, T>;
| ^^^^ --
help: add missing lifetime argument
|
LL | <Self as SVec>::Item<'a>,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:15:21
|
LL | <Self as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10
|
LL | type Item<'a, T>;
| ^^^^ -
help: add missing generic argument
|
LL | <Self as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:24:37
|
LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10
|
LL | type Item<'a, T>;
| ^^^^ --
help: add missing lifetime argument
|
LL | Output = <Index<<Self as SVec>::Item<'a>,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:24:37
|
LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10
|
LL | type Item<'a, T>;
| ^^^^ -
help: add missing generic argument
|
LL | Output = <Index<<Self as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:30
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10
|
LL | type Item<'a, T>;
| ^^^^ --
help: add missing lifetime argument
|
LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:30
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10
|
LL | type Item<'a, T>;
| ^^^^ -
help: add missing generic argument
|
LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:46
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10
|
LL | type Item<'a, T>;
| ^^^^ --
help: add missing lifetime argument
|
LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:46
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10
|
LL | type Item<'a, T>;
| ^^^^ -
help: add missing generic argument
|
LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:53:38
| |
LL | fn len(&self) -> <Self as SVec>::Item; LL | fn len(&self) -> <Self as SVec>::Item;
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -333,13 +461,13 @@ LL | fn len(&self) -> <Self as SVec>::Item<'_>;
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:45:38 --> $DIR/issue-105742.rs:53:38
| |
LL | fn len(&self) -> <Self as SVec>::Item; LL | fn len(&self) -> <Self as SVec>::Item;
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:43:10 --> $DIR/issue-105742.rs:51:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -348,7 +476,7 @@ help: add missing generic argument
LL | fn len(&self) -> <Self as SVec>::Item<T>; LL | fn len(&self) -> <Self as SVec>::Item<T>;
| +++ | +++
error: aborting due to 21 previous errors error: aborting due to 29 previous errors
Some errors have detailed explanations: E0038, E0107. Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`. For more information about an error, try `rustc --explain E0038`.

View file

@ -193,10 +193,13 @@ trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
trait TRS1: Iterator<Item: Copy, Item: Send> {} trait TRS1: Iterator<Item: Copy, Item: Send> {}
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
trait TRS2: Iterator<Item: Copy, Item: Copy> {} trait TRS2: Iterator<Item: Copy, Item: Copy> {}
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
trait TRS3: Iterator<Item: 'static, Item: 'static> {} trait TRS3: Iterator<Item: 'static, Item: 'static> {}
//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
trait TRW1<T> trait TRW1<T>
where where
T: Iterator<Item: Copy, Item: Send>, T: Iterator<Item: Copy, Item: Send>,

View file

@ -367,7 +367,15 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:196:34 --> $DIR/duplicate.rs:194:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:197:34
| |
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {} LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -375,7 +383,15 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:198:37 --> $DIR/duplicate.rs:197:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:200:37
| |
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {} LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here | ------------- ^^^^^^^^^^^^^ re-bound here
@ -383,7 +399,15 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:202:29 --> $DIR/duplicate.rs:200:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:205:29
| |
LL | T: Iterator<Item: Copy, Item: Send>, LL | T: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -391,7 +415,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:208:29 --> $DIR/duplicate.rs:211:29
| |
LL | T: Iterator<Item: Copy, Item: Copy>, LL | T: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -399,7 +423,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:214:32 --> $DIR/duplicate.rs:217:32
| |
LL | T: Iterator<Item: 'static, Item: 'static>, LL | T: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here | ------------- ^^^^^^^^^^^^^ re-bound here
@ -407,7 +431,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:220:32 --> $DIR/duplicate.rs:223:32
| |
LL | Self: Iterator<Item: Copy, Item: Send>, LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -415,7 +439,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:220:32 --> $DIR/duplicate.rs:223:32
| |
LL | Self: Iterator<Item: Copy, Item: Send>, LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -423,7 +447,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:227:32 --> $DIR/duplicate.rs:230:32
| |
LL | Self: Iterator<Item: Copy, Item: Copy>, LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -431,7 +455,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:227:32 --> $DIR/duplicate.rs:230:32
| |
LL | Self: Iterator<Item: Copy, Item: Copy>, LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -439,7 +463,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:234:35 --> $DIR/duplicate.rs:237:35
| |
LL | Self: Iterator<Item: 'static, Item: 'static>, LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here | ------------- ^^^^^^^^^^^^^ re-bound here
@ -447,7 +471,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:234:35 --> $DIR/duplicate.rs:237:35
| |
LL | Self: Iterator<Item: 'static, Item: 'static>, LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here | ------------- ^^^^^^^^^^^^^ re-bound here
@ -455,7 +479,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:252:40 --> $DIR/duplicate.rs:255:40
| |
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>; LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -463,7 +487,7 @@ LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:254:44 --> $DIR/duplicate.rs:257:44
| |
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>; LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -471,7 +495,7 @@ LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:256:43 --> $DIR/duplicate.rs:259:43
| |
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>; LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here | ------------- ^^^^^^^^^^^^^ re-bound here
@ -479,7 +503,7 @@ LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:240:34 --> $DIR/duplicate.rs:243:34
| |
LL | type A: Iterator<Item: Copy, Item: Send>; LL | type A: Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -487,7 +511,7 @@ LL | type A: Iterator<Item: Copy, Item: Send>;
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:244:34 --> $DIR/duplicate.rs:247:34
| |
LL | type A: Iterator<Item: Copy, Item: Copy>; LL | type A: Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -495,13 +519,13 @@ LL | type A: Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:248:37 --> $DIR/duplicate.rs:251:37
| |
LL | type A: Iterator<Item: 'static, Item: 'static>; LL | type A: Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here | ------------- ^^^^^^^^^^^^^ re-bound here
| | | |
| `Item` bound here first | `Item` bound here first
error: aborting due to 63 previous errors error: aborting due to 66 previous errors
For more information about this error, try `rustc --explain E0719`. For more information about this error, try `rustc --explain E0719`.

View file

@ -10,6 +10,7 @@ pub trait Parse {
pub trait CoolStuff: Parse<MODE = Mode::Cool> {} pub trait CoolStuff: Parse<MODE = Mode::Cool> {}
//~^ ERROR expected associated constant bound //~^ ERROR expected associated constant bound
//~| ERROR expected associated constant bound
//~| ERROR expected type //~| ERROR expected type
fn no_help() -> Mode::Cool {} fn no_help() -> Mode::Cool {}

View file

@ -8,7 +8,7 @@ LL | pub trait CoolStuff: Parse<MODE = Mode::Cool> {}
| help: try using the variant's enum: `Mode` | help: try using the variant's enum: `Mode`
error[E0573]: expected type, found variant `Mode::Cool` error[E0573]: expected type, found variant `Mode::Cool`
--> $DIR/assoc_const_eq_diagnostic.rs:15:17 --> $DIR/assoc_const_eq_diagnostic.rs:16:17
| |
LL | fn no_help() -> Mode::Cool {} LL | fn no_help() -> Mode::Cool {}
| ^^^^^^^^^^ | ^^^^^^^^^^
@ -28,6 +28,18 @@ note: associated constant defined here
LL | const MODE: Mode; LL | const MODE: Mode;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors error: expected associated constant bound, found type
--> $DIR/assoc_const_eq_diagnostic.rs:11:28
|
LL | pub trait CoolStuff: Parse<MODE = Mode::Cool> {}
| ^^^^^^^^^^^^^^^^^ help: if equating a const, try wrapping with braces: `MODE = { const }`
|
note: associated constant defined here
--> $DIR/assoc_const_eq_diagnostic.rs:8:5
|
LL | const MODE: Mode;
| ^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0573`. For more information about this error, try `rustc --explain E0573`.

View file

@ -1,5 +1,6 @@
trait Foo: Iterator<Item = i32, Item = i32> {} trait Foo: Iterator<Item = i32, Item = i32> {}
//~^ ERROR is already specified //~^ ERROR is already specified
//~| ERROR is already specified
type Unit = (); type Unit = ();

View file

@ -7,13 +7,21 @@ LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/E0719.rs:6:42 --> $DIR/E0719.rs:1:33
|
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/E0719.rs:7:42
| |
LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> { LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
| --------- ^^^^^^^^^^^ re-bound here | --------- ^^^^^^^^^^^ re-bound here
| | | |
| `Item` bound here first | `Item` bound here first
error: aborting due to 2 previous errors error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0719`. For more information about this error, try `rustc --explain E0719`.

View file

@ -4,5 +4,11 @@ error: ~const can only be applied to `#[const_trait]` traits
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^
error: aborting due to previous error error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:19
|
LL | trait Bar: ~const Foo {}
| ^^^
error: aborting due to 2 previous errors

View file

@ -4,5 +4,11 @@ error: ~const can only be applied to `#[const_trait]` traits
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^
error: aborting due to previous error error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:19
|
LL | trait Bar: ~const Foo {}
| ^^^
error: aborting due to 2 previous errors

View file

@ -10,6 +10,7 @@ trait Foo {
#[cfg_attr(any(yy, ny), const_trait)] #[cfg_attr(any(yy, ny), const_trait)]
trait Bar: ~const Foo {} trait Bar: ~const Foo {}
//[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]` //[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
//[ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]`
const fn foo<T: Bar>(x: &T) { const fn foo<T: Bar>(x: &T) {
x.a(); x.a();

View file

@ -1,11 +1,11 @@
error[E0277]: the trait bound `T: ~const Foo` is not satisfied error[E0277]: the trait bound `T: ~const Foo` is not satisfied
--> $DIR/super-traits-fail-2.rs:15:7 --> $DIR/super-traits-fail-2.rs:16:7
| |
LL | x.a(); LL | x.a();
| ^ the trait `~const Foo` is not implemented for `T` | ^ the trait `~const Foo` is not implemented for `T`
| |
note: the trait `Foo` is implemented for `T`, but that implementation is not `const` note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
--> $DIR/super-traits-fail-2.rs:15:5 --> $DIR/super-traits-fail-2.rs:16:5
| |
LL | x.a(); LL | x.a();
| ^ | ^

View file

@ -1,11 +1,11 @@
error[E0277]: the trait bound `T: ~const Foo` is not satisfied error[E0277]: the trait bound `T: ~const Foo` is not satisfied
--> $DIR/super-traits-fail-2.rs:15:7 --> $DIR/super-traits-fail-2.rs:16:7
| |
LL | x.a(); LL | x.a();
| ^ the trait `~const Foo` is not implemented for `T` | ^ the trait `~const Foo` is not implemented for `T`
| |
note: the trait `Foo` is implemented for `T`, but that implementation is not `const` note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
--> $DIR/super-traits-fail-2.rs:15:5 --> $DIR/super-traits-fail-2.rs:16:5
| |
LL | x.a(); LL | x.a();
| ^ | ^

View file

@ -5,10 +5,16 @@ LL | trait Bar: ~const Foo {}
| ^^^ | ^^^
error: ~const can only be applied to `#[const_trait]` traits error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:15:24 --> $DIR/super-traits-fail-3.rs:12:19
|
LL | trait Bar: ~const Foo {}
| ^^^
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:16:24
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^
error: aborting due to 2 previous errors error: aborting due to 3 previous errors

View file

@ -4,5 +4,11 @@ error: ~const can only be applied to `#[const_trait]` traits
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^
error: aborting due to previous error error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:12:19
|
LL | trait Bar: ~const Foo {}
| ^^^
error: aborting due to 2 previous errors

View file

@ -11,6 +11,7 @@ trait Foo {
#[cfg_attr(any(yy, ny), const_trait)] #[cfg_attr(any(yy, ny), const_trait)]
trait Bar: ~const Foo {} trait Bar: ~const Foo {}
//[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]` //[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
//[ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]`
const fn foo<T: ~const Bar>(x: &T) { const fn foo<T: ~const Bar>(x: &T) {
//[yn,nn]~^ ERROR: ~const can only be applied to `#[const_trait]` //[yn,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`

View file

@ -1,5 +1,5 @@
error: ~const can only be applied to `#[const_trait]` traits error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:15:24 --> $DIR/super-traits-fail-3.rs:16:24
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^

View file

@ -2,5 +2,6 @@ trait A<T>: std::ops::Add<Self> + Sized {}
trait B<T>: A<T> {} trait B<T>: A<T> {}
trait C<T>: A<dyn B<T, Output=usize>> {} trait C<T>: A<dyn B<T, Output=usize>> {}
//~^ ERROR the trait `B` cannot be made into an object //~^ ERROR the trait `B` cannot be made into an object
//~| ERROR the trait `B` cannot be made into an object
fn main() {} fn main() {}

View file

@ -12,6 +12,20 @@ LL | trait A<T>: std::ops::Add<Self> + Sized {}
LL | trait B<T>: A<T> {} LL | trait B<T>: A<T> {}
| - this trait cannot be made into an object... | - this trait cannot be made into an object...
error: aborting due to previous error error[E0038]: the trait `B` cannot be made into an object
--> $DIR/issue-38404.rs:3:15
|
LL | trait C<T>: A<dyn B<T, Output=usize>> {}
| ^^^^^^^^^^^^^^^^^^^^^^ `B` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-38404.rs:1:13
|
LL | trait A<T>: std::ops::Add<Self> + Sized {}
| ^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter
LL | trait B<T>: A<T> {}
| - this trait cannot be made into an object...
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0038`. For more information about this error, try `rustc --explain E0038`.

View file

@ -3,6 +3,7 @@ fn foo1<T:Copy<U>, U>(x: T) {}
trait Trait: Copy<dyn Send> {} trait Trait: Copy<dyn Send> {}
//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied //~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied
//~| ERROR trait takes 0 generic arguments but 1 generic argument was supplied
struct MyStruct1<T: Copy<T>>; struct MyStruct1<T: Copy<T>>;
//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied //~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied

View file

@ -15,7 +15,15 @@ LL | trait Trait: Copy<dyn Send> {}
| expected 0 generic arguments | expected 0 generic arguments
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:7:21 --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14
|
LL | trait Trait: Copy<dyn Send> {}
| ^^^^---------- help: remove these generics
| |
| expected 0 generic arguments
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:8:21
| |
LL | struct MyStruct1<T: Copy<T>>; LL | struct MyStruct1<T: Copy<T>>;
| ^^^^--- help: remove these generics | ^^^^--- help: remove these generics
@ -23,7 +31,7 @@ LL | struct MyStruct1<T: Copy<T>>;
| expected 0 generic arguments | expected 0 generic arguments
error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:10:25 --> $DIR/typeck-builtin-bound-type-parameters.rs:11:25
| |
LL | struct MyStruct2<'a, T: Copy<'a>>; LL | struct MyStruct2<'a, T: Copy<'a>>;
| ^^^^---- help: remove these generics | ^^^^---- help: remove these generics
@ -31,7 +39,7 @@ LL | struct MyStruct2<'a, T: Copy<'a>>;
| expected 0 lifetime arguments | expected 0 lifetime arguments
error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 --> $DIR/typeck-builtin-bound-type-parameters.rs:14:15
| |
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
| ^^^^ -- help: remove this lifetime argument | ^^^^ -- help: remove this lifetime argument
@ -39,13 +47,13 @@ LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
| expected 0 lifetime arguments | expected 0 lifetime arguments
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 --> $DIR/typeck-builtin-bound-type-parameters.rs:14:15
| |
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
| ^^^^ - help: remove this generic argument | ^^^^ - help: remove this generic argument
| | | |
| expected 0 generic arguments | expected 0 generic arguments
error: aborting due to 6 previous errors error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0107`. For more information about this error, try `rustc --explain E0107`.