From 16201597da9a5dc87e93f0cea9ab7ebf514295aa Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 28 Jun 2021 18:39:51 +0900 Subject: [PATCH] Add a regression test for issue-65384 --- src/test/ui/type-alias-impl-trait/issue-65384.rs | 16 ++++++++++++++++ .../ui/type-alias-impl-trait/issue-65384.stderr | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/test/ui/type-alias-impl-trait/issue-65384.rs create mode 100644 src/test/ui/type-alias-impl-trait/issue-65384.stderr diff --git a/src/test/ui/type-alias-impl-trait/issue-65384.rs b/src/test/ui/type-alias-impl-trait/issue-65384.rs new file mode 100644 index 0000000000000..63666c497c669 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-65384.rs @@ -0,0 +1,16 @@ +#![feature(min_type_alias_impl_trait)] +#![feature(type_alias_impl_trait)] +#![allow(incomplete_features)] + +trait MyTrait {} + +impl MyTrait for () {} + +type Bar = impl MyTrait; + +impl MyTrait for Bar {} +//~^ ERROR: cannot implement trait on type alias impl trait + +fn bazr() -> Bar { } + +fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/issue-65384.stderr b/src/test/ui/type-alias-impl-trait/issue-65384.stderr new file mode 100644 index 0000000000000..01d037266ec60 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-65384.stderr @@ -0,0 +1,14 @@ +error: cannot implement trait on type alias impl trait + --> $DIR/issue-65384.rs:11:1 + | +LL | impl MyTrait for Bar {} + | ^^^^^^^^^^^^^^^^^^^^ + | +note: type alias impl trait defined here + --> $DIR/issue-65384.rs:9:12 + | +LL | type Bar = impl MyTrait; + | ^^^^^^^^^^^^ + +error: aborting due to previous error +