Test all the things

This commit is contained in:
Oliver Scherer 2019-01-25 20:32:45 +01:00
parent 6982fd21d1
commit ed10a5ba01
7 changed files with 87 additions and 24 deletions

View file

@ -1,9 +0,0 @@
error[E0091]: type parameter `U` is unused
--> $DIR/generic_duplicate_param_use.rs:5:25
|
LL | existential type Two<T, U>: 'static; //~ ERROR type parameter `U` is unused
| ^ unused type parameter
error: aborting due to previous error
For more information about this error, try `rustc --explain E0091`.

View file

@ -0,0 +1,15 @@
// compile-pass
#![feature(existential_type)]
fn main() {}
// test that unused generic parameters are ok
existential type Two<T, U>: 'static;
fn one<T: 'static>(t: T) -> Two<T, T> {
t
}
fn two<T: 'static, U: 'static>(t: T, _: U) -> Two<T, U> {
t
}

View file

@ -0,0 +1,19 @@
#![feature(existential_type)]
fn main() {}
// test that unused generic parameters are ok
existential type Two<T, U>: 'static;
fn one<T: 'static>(t: T) -> Two<T, T> {
t
}
fn two<T: 'static, U: 'static>(t: T, _: U) -> Two<T, U> {
t
}
fn three<T: 'static, U: 'static>(_: T, u: U) -> Two<T, U> {
//~^ ERROR defining existential type use differs from previous
u
}

View file

@ -0,0 +1,19 @@
error: defining existential type use differs from previous
--> $DIR/generic_duplicate_param_use3.rs:16:1
|
LL | / fn three<T: 'static, U: 'static>(_: T, u: U) -> Two<T, U> {
LL | | //~^ ERROR defining existential type use differs from previous
LL | | u
LL | | }
| |_^
|
note: previous use here
--> $DIR/generic_duplicate_param_use3.rs:8:1
|
LL | / fn one<T: 'static>(t: T) -> Two<T, T> {
LL | | t
LL | | }
| |_^
error: aborting due to previous error

View file

@ -0,0 +1,15 @@
#![feature(existential_type)]
fn main() {}
// test that unused generic parameters are ok
existential type Two<T, U>: 'static;
fn one<T: 'static>(t: T) -> Two<T, T> {
t
}
fn three<T: 'static, U: 'static>(_: T, u: U) -> Two<T, U> {
//~^ ERROR defining existential type use differs from previous
u
}

View file

@ -0,0 +1,19 @@
error: defining existential type use differs from previous
--> $DIR/generic_duplicate_param_use4.rs:12:1
|
LL | / fn three<T: 'static, U: 'static>(_: T, u: U) -> Two<T, U> {
LL | | //~^ ERROR defining existential type use differs from previous
LL | | u
LL | | }
| |_^
|
note: previous use here
--> $DIR/generic_duplicate_param_use4.rs:8:1
|
LL | / fn one<T: 'static>(t: T) -> Two<T, T> {
LL | | t
LL | | }
| |_^
error: aborting due to previous error

View file

@ -1,15 +0,0 @@
error[E0091]: type parameter `T` is unused
--> $DIR/unused_generic_param.rs:6:35
|
LL | existential type PartiallyDefined<T>: 'static; //~ `T` is unused
| ^ unused type parameter
error[E0091]: type parameter `T` is unused
--> $DIR/unused_generic_param.rs:12:36
|
LL | existential type PartiallyDefined2<T>: 'static; //~ `T` is unused
| ^ unused type parameter
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0091`.