diff --git a/src/test/ui/type-alias-impl-trait/issue-63279.rs b/src/test/ui/type-alias-impl-trait/issue-63279.rs new file mode 100644 index 0000000000000..586ff7a31587f --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-63279.rs @@ -0,0 +1,9 @@ +#![feature(type_alias_impl_trait)] + +type Closure = impl FnOnce(); //~ ERROR: type mismatch resolving + +fn c() -> Closure { + || -> Closure { || () } +} + +fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/issue-63279.stderr b/src/test/ui/type-alias-impl-trait/issue-63279.stderr new file mode 100644 index 0000000000000..a5065241fc74d --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-63279.stderr @@ -0,0 +1,13 @@ +error[E0271]: type mismatch resolving `<[closure@$DIR/issue-63279.rs:6:5: 6:28] as std::ops::FnOnce<()>>::Output == ()` + --> $DIR/issue-63279.rs:3:1 + | +LL | type Closure = impl FnOnce(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found () + | + = note: expected type `Closure` + found type `()` + = note: the return type of a function must have a statically known size + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`.