about summary refs log tree commit diff
path: root/src/test/ui/impl-trait
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-09-06 17:16:08 +0000
committerMichael Goulet <michael@errs.io>2022-09-09 01:31:46 +0000
commit55df9201fe5d8d67102ea8a8b70415d0312ab813 (patch)
treef96dab4eab356366b01570ab703850892aacd450 /src/test/ui/impl-trait
parent05812df603ab5940c1dffe6514b25c665dccfcf1 (diff)
downloadrust-55df9201fe5d8d67102ea8a8b70415d0312ab813.tar.gz
rust-55df9201fe5d8d67102ea8a8b70415d0312ab813.zip
Tweak feature error, add test
Diffstat (limited to 'src/test/ui/impl-trait')
-rw-r--r--src/test/ui/impl-trait/in-trait/reveal.rs18
-rw-r--r--src/test/ui/impl-trait/where-allowed.stderr6
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/in-trait/reveal.rs b/src/test/ui/impl-trait/in-trait/reveal.rs
new file mode 100644
index 00000000000..d6ede1cc495
--- /dev/null
+++ b/src/test/ui/impl-trait/in-trait/reveal.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+#![feature(return_position_impl_trait_in_trait)]
+#![allow(incomplete_features)]
+
+trait Foo {
+    fn f() -> Box<impl Sized>;
+}
+
+impl Foo for () {
+    fn f() -> Box<String> {
+        Box::new(String::new())
+    }
+}
+
+fn main() {
+    let x: Box<String> = <() as Foo>::f();
+}
diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr
index 58a2f79efb4..9b346387d61 100644
--- a/src/test/ui/impl-trait/where-allowed.stderr
+++ b/src/test/ui/impl-trait/where-allowed.stderr
@@ -162,12 +162,18 @@ error[E0562]: `impl Trait` only allowed in function and inherent method return t
    |
 LL |     fn in_return() -> impl Debug;
    |                       ^^^^^^^^^^
+   |
+   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+   = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
 
 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return
   --> $DIR/where-allowed.rs:125:34
    |
 LL |     fn in_trait_impl_return() -> impl Debug { () }
    |                                  ^^^^^^^^^^
+   |
+   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+   = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
 
 error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` param
   --> $DIR/where-allowed.rs:138:33