diff options
| author | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2021-08-21 20:56:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-21 20:56:38 -0400 |
| commit | 1d0d7c34e8139078b1918695b368be6b02f28c2a (patch) | |
| tree | 033dca5a9b1accacd9cecff6e4ee5ae47ea0d700 | |
| parent | 66b04c650184eb21ccd60a3aab08ed6fcd136943 (diff) | |
| parent | c6c2f11ab614e5e17ddbfa28b5ff9c9e5a2d8b52 (diff) | |
| download | rust-1d0d7c34e8139078b1918695b368be6b02f28c2a.tar.gz rust-1d0d7c34e8139078b1918695b368be6b02f28c2a.zip | |
Rollup merge of #88197 - spastorino:tait-test-fn-type, r=oli-obk
Test tait use in a fn type r? `@oli-obk` I thought this was going to work but doesn't, quickly checked with Niko and he told me that we ruled this out for now. I'm not exactly sure why and how but here we have a test with a FIXME :) Related to #86727
| -rw-r--r-- | src/test/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr | 9 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs new file mode 100644 index 00000000000..299bdf562dc --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs @@ -0,0 +1,13 @@ +#![feature(type_alias_impl_trait)] +#![allow(dead_code)] + +// FIXME: this is ruled out for now but should work + +type Foo = fn() -> impl Send; +//~^ ERROR: `impl Trait` not allowed outside of function and method return types + +fn make_foo() -> Foo { + || 15 +} + +fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr new file mode 100644 index 00000000000..1c5d57d4af7 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr @@ -0,0 +1,9 @@ +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/type-alias-impl-trait-fn-type.rs:6:20 + | +LL | type Foo = fn() -> impl Send; + | ^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. |
