diff options
Diffstat (limited to 'tests/ui/variance')
| -rw-r--r-- | tests/ui/variance/variance-unused-type-param.rs | 3 | ||||
| -rw-r--r-- | tests/ui/variance/variance-unused-type-param.stderr | 21 |
2 files changed, 19 insertions, 5 deletions
diff --git a/tests/ui/variance/variance-unused-type-param.rs b/tests/ui/variance/variance-unused-type-param.rs index 7e35f59fd84..ada57ab0d09 100644 --- a/tests/ui/variance/variance-unused-type-param.rs +++ b/tests/ui/variance/variance-unused-type-param.rs @@ -16,6 +16,9 @@ enum ListCell<T> { Nil } +struct SelfTyAlias<T>(Box<Self>); +//~^ ERROR parameter `T` is only used recursively + struct WithBounds<T: Sized> {} //~^ ERROR parameter `T` is never used diff --git a/tests/ui/variance/variance-unused-type-param.stderr b/tests/ui/variance/variance-unused-type-param.stderr index 212db564ac4..1a45bcba45a 100644 --- a/tests/ui/variance/variance-unused-type-param.stderr +++ b/tests/ui/variance/variance-unused-type-param.stderr @@ -25,10 +25,21 @@ LL | Cons(Box<ListCell<T>>), | ^ | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` - = note: all type parameters must be used in a non-recursive way in order to constrain its variance + = note: all type parameters must be used in a non-recursive way in order to constrain their variance + +error: type parameter `T` is only used recursively + --> $DIR/variance-unused-type-param.rs:19:27 + | +LL | struct SelfTyAlias<T>(Box<Self>); + | - ^^^^ + | | + | type parameter must be used non-recursively in the definition + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = note: all type parameters must be used in a non-recursive way in order to constrain their variance error[E0392]: type parameter `T` is never used - --> $DIR/variance-unused-type-param.rs:19:19 + --> $DIR/variance-unused-type-param.rs:22:19 | LL | struct WithBounds<T: Sized> {} | ^ unused type parameter @@ -36,7 +47,7 @@ LL | struct WithBounds<T: Sized> {} = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used - --> $DIR/variance-unused-type-param.rs:22:24 + --> $DIR/variance-unused-type-param.rs:25:24 | LL | struct WithWhereBounds<T> where T: Sized {} | ^ unused type parameter @@ -44,13 +55,13 @@ LL | struct WithWhereBounds<T> where T: Sized {} = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used - --> $DIR/variance-unused-type-param.rs:25:27 + --> $DIR/variance-unused-type-param.rs:28:27 | LL | struct WithOutlivesBounds<T: 'static> {} | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0392`. |
