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 +