diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-01-25 20:32:45 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-02-01 16:38:46 +0100 |
| commit | ed10a5ba01cb0e73e3872434da65bf4f3a976f28 (patch) | |
| tree | e1091a4515c2c65e1ef14f2875bd3cc4e6079c06 | |
| parent | 6982fd21d1d7963b2acc489d9de246f2715aab80 (diff) | |
Test all the things
7 files changed, 87 insertions, 24 deletions
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use.stderr b/src/test/ui/existential_types/generic_duplicate_param_use.stderr deleted file mode 100644 index 66706c21054..00000000000 --- a/src/test/ui/existential_types/generic_duplicate_param_use.stderr +++ /dev/null @@ -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`. diff --git a/src/test/ui/existential_types/generic_duplicate_param_use2.rs b/src/test/ui/existential_types/generic_duplicate_param_use2.rs new file mode 100644 index 00000000000..b6cb22da41d --- /dev/null +++ b/src/test/ui/existential_types/generic_duplicate_param_use2.rs @@ -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 +} diff --git a/src/test/ui/existential_types/generic_duplicate_param_use3.rs b/src/test/ui/existential_types/generic_duplicate_param_use3.rs new file mode 100644 index 00000000000..43650a6a352 --- /dev/null +++ b/src/test/ui/existential_types/generic_duplicate_param_use3.rs @@ -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 +} diff --git a/src/test/ui/existential_types/generic_duplicate_param_use3.stderr b/src/test/ui/existential_types/generic_duplicate_param_use3.stderr new file mode 100644 index 00000000000..67c30ad648b --- /dev/null +++ b/src/test/ui/existential_types/generic_duplicate_param_use3.stderr @@ -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 + diff --git a/src/test/ui/existential_types/generic_duplicate_param_use4.rs b/src/test/ui/existential_types/generic_duplicate_param_use4.rs new file mode 100644 index 00000000000..79df528d209 --- /dev/null +++ b/src/test/ui/existential_types/generic_duplicate_param_use4.rs @@ -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 +} diff --git a/src/test/ui/existential_types/generic_duplicate_param_use4.stderr b/src/test/ui/existential_types/generic_duplicate_param_use4.stderr new file mode 100644 index 00000000000..e7a372e0e0c --- /dev/null +++ b/src/test/ui/existential_types/generic_duplicate_param_use4.stderr @@ -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 + diff --git a/src/test/ui/existential_types/unused_generic_param.stderr b/src/test/ui/existential_types/unused_generic_param.stderr deleted file mode 100644 index 348aed3c439..00000000000 --- a/src/test/ui/existential_types/unused_generic_param.stderr +++ /dev/null @@ -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`. |
