Test all the things
This commit is contained in:
parent
6982fd21d1
commit
ed10a5ba01
7 changed files with 87 additions and 24 deletions
|
|
@ -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`.
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue