diff --git a/src/test/ui/existential_types/generic_duplicate_param_use5.rs b/src/test/ui/existential_types/generic_duplicate_param_use5.rs new file mode 100644 index 00000000000..f9d336d759b --- /dev/null +++ b/src/test/ui/existential_types/generic_duplicate_param_use5.rs @@ -0,0 +1,15 @@ +#![feature(existential_type)] + +fn main() {} + +// test that unused generic parameters are ok +existential type Two: 'static; + +fn one(t: T) -> Two { + t +} + +fn two(t: T, _: U) -> Two { +//~^ ERROR defining existential type use differs from previous + t +} diff --git a/src/test/ui/existential_types/generic_duplicate_param_use5.stderr b/src/test/ui/existential_types/generic_duplicate_param_use5.stderr new file mode 100644 index 00000000000..e2bf4a9e0df --- /dev/null +++ b/src/test/ui/existential_types/generic_duplicate_param_use5.stderr @@ -0,0 +1,19 @@ +error: defining existential type use differs from previous + --> $DIR/generic_duplicate_param_use5.rs:12:1 + | +LL | / fn two(t: T, _: U) -> Two { +LL | | //~^ ERROR defining existential type use differs from previous +LL | | t +LL | | } + | |_^ + | +note: previous use here + --> $DIR/generic_duplicate_param_use5.rs:8:1 + | +LL | / fn one(t: T) -> Two { +LL | | t +LL | | } + | |_^ + +error: aborting due to previous error +