From e07f36c9610bac9433151cdaacb9764004d822e6 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 5 Oct 2022 09:18:00 +0000 Subject: [PATCH] Add a regression test --- .../different_defining_uses_never_type3.rs | 12 ++++++++++++ .../different_defining_uses_never_type3.stderr | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/test/ui/type-alias-impl-trait/different_defining_uses_never_type3.rs create mode 100644 src/test/ui/type-alias-impl-trait/different_defining_uses_never_type3.stderr diff --git a/src/test/ui/type-alias-impl-trait/different_defining_uses_never_type3.rs b/src/test/ui/type-alias-impl-trait/different_defining_uses_never_type3.rs new file mode 100644 index 0000000000000..bc827a8f2113a --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/different_defining_uses_never_type3.rs @@ -0,0 +1,12 @@ +#![feature(type_alias_impl_trait)] + +type Tait = impl Sized; + +struct One; +fn one() -> Tait { One } + +struct Two(T); +fn two() -> Tait { Two::<()>(todo!()) } +//~^ ERROR concrete type differs from previous defining opaque type use + +fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/different_defining_uses_never_type3.stderr b/src/test/ui/type-alias-impl-trait/different_defining_uses_never_type3.stderr new file mode 100644 index 0000000000000..146a57cbb7e05 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/different_defining_uses_never_type3.stderr @@ -0,0 +1,14 @@ +error: concrete type differs from previous defining opaque type use + --> $DIR/different_defining_uses_never_type3.rs:9:13 + | +LL | fn two() -> Tait { Two::<()>(todo!()) } + | ^^^^ expected `One`, got `Two<()>` + | +note: previous use here + --> $DIR/different_defining_uses_never_type3.rs:6:20 + | +LL | fn one() -> Tait { One } + | ^^^ + +error: aborting due to previous error +