about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/generator/clone-impl-async.rs71
-rw-r--r--src/test/ui/generator/clone-impl-async.stderr171
-rw-r--r--src/test/ui/generator/clone-impl-static.rs17
-rw-r--r--src/test/ui/generator/clone-impl-static.stderr31
-rw-r--r--src/test/ui/generator/clone-impl.rs73
-rw-r--r--src/test/ui/generator/clone-impl.stderr142
-rw-r--r--src/test/ui/impl-trait/in-trait/encode.rs9
7 files changed, 514 insertions, 0 deletions
diff --git a/src/test/ui/generator/clone-impl-async.rs b/src/test/ui/generator/clone-impl-async.rs
new file mode 100644
index 00000000000..83c51526b7b
--- /dev/null
+++ b/src/test/ui/generator/clone-impl-async.rs
@@ -0,0 +1,71 @@
+// edition:2021
+// gate-test-generator_clone
+// Verifies that feature(generator_clone) doesn't allow async blocks to be cloned/copied.
+
+#![feature(generators, generator_clone)]
+
+use std::future::ready;
+
+struct NonClone;
+
+fn main() {
+    let inner_non_clone = async {
+        let non_clone = NonClone;
+        let () = ready(()).await;
+        drop(non_clone);
+    };
+    check_copy(&inner_non_clone);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+    check_clone(&inner_non_clone);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+
+    let non_clone = NonClone;
+    let outer_non_clone = async move {
+        drop(non_clone);
+    };
+    check_copy(&outer_non_clone);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+    check_clone(&outer_non_clone);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+
+    let maybe_copy_clone = async move {};
+    check_copy(&maybe_copy_clone);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+    check_clone(&maybe_copy_clone);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+
+    let inner_non_clone_fn = the_inner_non_clone_fn();
+    check_copy(&inner_non_clone_fn);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+    check_clone(&inner_non_clone_fn);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+
+    let outer_non_clone_fn = the_outer_non_clone_fn(NonClone);
+    check_copy(&outer_non_clone_fn);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+    check_clone(&outer_non_clone_fn);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+
+    let maybe_copy_clone_fn = the_maybe_copy_clone_fn();
+    check_copy(&maybe_copy_clone_fn);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+    check_clone(&maybe_copy_clone_fn);
+    //~^ ERROR the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+}
+
+async fn the_inner_non_clone_fn() {
+    let non_clone = NonClone;
+    let () = ready(()).await;
+    drop(non_clone);
+}
+
+async fn the_outer_non_clone_fn(non_clone: NonClone) {
+    let () = ready(()).await;
+    drop(non_clone);
+}
+
+async fn the_maybe_copy_clone_fn() {
+}
+
+fn check_copy<T: Copy>(_x: &T) {}
+fn check_clone<T: Clone>(_x: &T) {}
diff --git a/src/test/ui/generator/clone-impl-async.stderr b/src/test/ui/generator/clone-impl-async.stderr
new file mode 100644
index 00000000000..cbb58d2af18
--- /dev/null
+++ b/src/test/ui/generator/clone-impl-async.stderr
@@ -0,0 +1,171 @@
+error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+  --> $DIR/clone-impl-async.rs:17:16
+   |
+LL |     check_copy(&inner_non_clone);
+   |     ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl-async.rs:70:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+  --> $DIR/clone-impl-async.rs:19:17
+   |
+LL |     check_clone(&inner_non_clone);
+   |     ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_clone`
+  --> $DIR/clone-impl-async.rs:71:19
+   |
+LL | fn check_clone<T: Clone>(_x: &T) {}
+   |                   ^^^^^ required by this bound in `check_clone`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+  --> $DIR/clone-impl-async.rs:26:16
+   |
+LL |     check_copy(&outer_non_clone);
+   |     ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl-async.rs:70:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+  --> $DIR/clone-impl-async.rs:28:17
+   |
+LL |     check_clone(&outer_non_clone);
+   |     ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_clone`
+  --> $DIR/clone-impl-async.rs:71:19
+   |
+LL | fn check_clone<T: Clone>(_x: &T) {}
+   |                   ^^^^^ required by this bound in `check_clone`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+  --> $DIR/clone-impl-async.rs:32:16
+   |
+LL |     check_copy(&maybe_copy_clone);
+   |     ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl-async.rs:70:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+  --> $DIR/clone-impl-async.rs:34:17
+   |
+LL |     check_clone(&maybe_copy_clone);
+   |     ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_clone`
+  --> $DIR/clone-impl-async.rs:71:19
+   |
+LL | fn check_clone<T: Clone>(_x: &T) {}
+   |                   ^^^^^ required by this bound in `check_clone`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+  --> $DIR/clone-impl-async.rs:38:16
+   |
+LL |     check_copy(&inner_non_clone_fn);
+   |     ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl-async.rs:70:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+  --> $DIR/clone-impl-async.rs:40:17
+   |
+LL |     check_clone(&inner_non_clone_fn);
+   |     ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_clone`
+  --> $DIR/clone-impl-async.rs:71:19
+   |
+LL | fn check_clone<T: Clone>(_x: &T) {}
+   |                   ^^^^^ required by this bound in `check_clone`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+  --> $DIR/clone-impl-async.rs:44:16
+   |
+LL |     check_copy(&outer_non_clone_fn);
+   |     ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl-async.rs:70:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+  --> $DIR/clone-impl-async.rs:46:17
+   |
+LL |     check_clone(&outer_non_clone_fn);
+   |     ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_clone`
+  --> $DIR/clone-impl-async.rs:71:19
+   |
+LL | fn check_clone<T: Clone>(_x: &T) {}
+   |                   ^^^^^ required by this bound in `check_clone`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied
+  --> $DIR/clone-impl-async.rs:50:16
+   |
+LL |     check_copy(&maybe_copy_clone_fn);
+   |     ---------- ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl-async.rs:70:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied
+  --> $DIR/clone-impl-async.rs:52:17
+   |
+LL |     check_clone(&maybe_copy_clone_fn);
+   |     ----------- ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_clone`
+  --> $DIR/clone-impl-async.rs:71:19
+   |
+LL | fn check_clone<T: Clone>(_x: &T) {}
+   |                   ^^^^^ required by this bound in `check_clone`
+
+error: aborting due to 12 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/generator/clone-impl-static.rs b/src/test/ui/generator/clone-impl-static.rs
new file mode 100644
index 00000000000..55ed0f281e0
--- /dev/null
+++ b/src/test/ui/generator/clone-impl-static.rs
@@ -0,0 +1,17 @@
+// gate-test-generator_clone
+// Verifies that static generators cannot be cloned/copied.
+
+#![feature(generators, generator_clone)]
+
+fn main() {
+    let gen = static move || {
+        yield;
+    };
+    check_copy(&gen);
+    //~^ ERROR Copy` is not satisfied
+    check_clone(&gen);
+    //~^ ERROR Clone` is not satisfied
+}
+
+fn check_copy<T: Copy>(_x: &T) {}
+fn check_clone<T: Clone>(_x: &T) {}
diff --git a/src/test/ui/generator/clone-impl-static.stderr b/src/test/ui/generator/clone-impl-static.stderr
new file mode 100644
index 00000000000..cbadf6f156a
--- /dev/null
+++ b/src/test/ui/generator/clone-impl-static.stderr
@@ -0,0 +1,31 @@
+error[E0277]: the trait bound `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]: Copy` is not satisfied
+  --> $DIR/clone-impl-static.rs:10:16
+   |
+LL |     check_copy(&gen);
+   |     ---------- ^^^^ the trait `Copy` is not implemented for `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl-static.rs:16:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]: Clone` is not satisfied
+  --> $DIR/clone-impl-static.rs:12:17
+   |
+LL |     check_clone(&gen);
+   |     ----------- ^^^^ the trait `Clone` is not implemented for `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `check_clone`
+  --> $DIR/clone-impl-static.rs:17:19
+   |
+LL | fn check_clone<T: Clone>(_x: &T) {}
+   |                   ^^^^^ required by this bound in `check_clone`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/generator/clone-impl.rs b/src/test/ui/generator/clone-impl.rs
new file mode 100644
index 00000000000..cbfd65a5309
--- /dev/null
+++ b/src/test/ui/generator/clone-impl.rs
@@ -0,0 +1,73 @@
+// gate-test-generator_clone
+// Verifies that non-static generators can be cloned/copied if all their upvars and locals held
+// across awaits can be cloned/copied.
+
+#![feature(generators, generator_clone)]
+
+struct NonClone;
+
+fn main() {
+    let copyable: u32 = 123;
+    let clonable_0: Vec<u32> = Vec::new();
+    let clonable_1: Vec<u32> = Vec::new();
+    let non_clonable: NonClone = NonClone;
+
+    let gen_copy_0 = move || {
+        yield;
+        drop(copyable);
+    };
+    check_copy(&gen_copy_0);
+    check_clone(&gen_copy_0);
+    let gen_copy_1 = move || {
+        /*
+        let v = vec!['a'];
+        let n = NonClone;
+        drop(v);
+        drop(n);
+        */
+        yield;
+        let v = vec!['a'];
+        let n = NonClone;
+        drop(n);
+        drop(copyable);
+    };
+    check_copy(&gen_copy_1);
+    check_clone(&gen_copy_1);
+    let gen_clone_0 = move || {
+        let v = vec!['a'];
+        yield;
+        drop(v);
+        drop(clonable_0);
+    };
+    check_copy(&gen_clone_0);
+    //~^ ERROR the trait bound `Vec<u32>: Copy` is not satisfied
+    //~| ERROR the trait bound `Vec<char>: Copy` is not satisfied
+    check_clone(&gen_clone_0);
+    let gen_clone_1 = move || {
+        let v = vec!['a'];
+        /*
+        let n = NonClone;
+        drop(n);
+        */
+        yield;
+        let n = NonClone;
+        drop(n);
+        drop(v);
+        drop(clonable_1);
+    };
+    check_copy(&gen_clone_1);
+    //~^ ERROR the trait bound `Vec<u32>: Copy` is not satisfied
+    //~| ERROR the trait bound `Vec<char>: Copy` is not satisfied
+    check_clone(&gen_clone_1);
+    let gen_non_clone = move || {
+        yield;
+        drop(non_clonable);
+    };
+    check_copy(&gen_non_clone);
+    //~^ ERROR the trait bound `NonClone: Copy` is not satisfied
+    check_clone(&gen_non_clone);
+    //~^ ERROR the trait bound `NonClone: Clone` is not satisfied
+}
+
+fn check_copy<T: Copy>(_x: &T) {}
+fn check_clone<T: Clone>(_x: &T) {}
diff --git a/src/test/ui/generator/clone-impl.stderr b/src/test/ui/generator/clone-impl.stderr
new file mode 100644
index 00000000000..a92646b198c
--- /dev/null
+++ b/src/test/ui/generator/clone-impl.stderr
@@ -0,0 +1,142 @@
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
+  --> $DIR/clone-impl.rs:42:16
+   |
+LL |     let gen_clone_0 = move || {
+   |                       ------- within this `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
+...
+LL |     check_copy(&gen_clone_0);
+   |                ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:36:23: 36:30]`, the trait `Copy` is not implemented for `Vec<u32>`
+   |
+note: captured value does not implement `Copy`
+  --> $DIR/clone-impl.rs:40:14
+   |
+LL |         drop(clonable_0);
+   |              ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy`
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl.rs:72:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
+  --> $DIR/clone-impl.rs:42:16
+   |
+LL |     let gen_clone_0 = move || {
+   |                       ------- within this `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
+...
+LL |     check_copy(&gen_clone_0);
+   |                ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:36:23: 36:30]`, the trait `Copy` is not implemented for `Vec<char>`
+   |
+note: generator does not implement `Copy` as this value is used across a yield
+  --> $DIR/clone-impl.rs:38:9
+   |
+LL |         let v = vec!['a'];
+   |             - has type `Vec<char>` which does not implement `Copy`
+LL |         yield;
+   |         ^^^^^ yield occurs here, with `v` maybe used later
+...
+LL |     };
+   |     - `v` is later dropped here
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl.rs:72:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
+  --> $DIR/clone-impl.rs:58:16
+   |
+LL |     let gen_clone_1 = move || {
+   |                       ------- within this `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
+...
+LL |     check_copy(&gen_clone_1);
+   |                ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:46:23: 46:30]`, the trait `Copy` is not implemented for `Vec<u32>`
+   |
+note: captured value does not implement `Copy`
+  --> $DIR/clone-impl.rs:56:14
+   |
+LL |         drop(clonable_1);
+   |              ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy`
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl.rs:72:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
+  --> $DIR/clone-impl.rs:58:16
+   |
+LL |     let gen_clone_1 = move || {
+   |                       ------- within this `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
+...
+LL |     check_copy(&gen_clone_1);
+   |                ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:46:23: 46:30]`, the trait `Copy` is not implemented for `Vec<char>`
+   |
+note: generator does not implement `Copy` as this value is used across a yield
+  --> $DIR/clone-impl.rs:52:9
+   |
+LL |         let v = vec!['a'];
+   |             - has type `Vec<char>` which does not implement `Copy`
+...
+LL |         yield;
+   |         ^^^^^ yield occurs here, with `v` maybe used later
+...
+LL |     };
+   |     - `v` is later dropped here
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl.rs:72:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+
+error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
+  --> $DIR/clone-impl.rs:66:16
+   |
+LL |     let gen_non_clone = move || {
+   |                         ------- within this `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
+...
+LL |     check_copy(&gen_non_clone);
+   |                ^^^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:62:25: 62:32]`, the trait `Copy` is not implemented for `NonClone`
+   |
+note: captured value does not implement `Copy`
+  --> $DIR/clone-impl.rs:64:14
+   |
+LL |         drop(non_clonable);
+   |              ^^^^^^^^^^^^ has type `NonClone` which does not implement `Copy`
+note: required by a bound in `check_copy`
+  --> $DIR/clone-impl.rs:72:18
+   |
+LL | fn check_copy<T: Copy>(_x: &T) {}
+   |                  ^^^^ required by this bound in `check_copy`
+help: consider annotating `NonClone` with `#[derive(Copy)]`
+   |
+LL | #[derive(Copy)]
+   |
+
+error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
+  --> $DIR/clone-impl.rs:68:17
+   |
+LL |     let gen_non_clone = move || {
+   |                         ------- within this `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
+...
+LL |     check_clone(&gen_non_clone);
+   |                 ^^^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:62:25: 62:32]`, the trait `Clone` is not implemented for `NonClone`
+   |
+note: captured value does not implement `Clone`
+  --> $DIR/clone-impl.rs:64:14
+   |
+LL |         drop(non_clonable);
+   |              ^^^^^^^^^^^^ has type `NonClone` which does not implement `Clone`
+note: required by a bound in `check_clone`
+  --> $DIR/clone-impl.rs:73:19
+   |
+LL | fn check_clone<T: Clone>(_x: &T) {}
+   |                   ^^^^^ required by this bound in `check_clone`
+help: consider annotating `NonClone` with `#[derive(Clone)]`
+   |
+LL | #[derive(Clone)]
+   |
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/impl-trait/in-trait/encode.rs b/src/test/ui/impl-trait/in-trait/encode.rs
new file mode 100644
index 00000000000..efb9f6498ba
--- /dev/null
+++ b/src/test/ui/impl-trait/in-trait/encode.rs
@@ -0,0 +1,9 @@
+// build-pass
+// compile-flags: --crate-type=lib
+
+#![feature(return_position_impl_trait_in_trait)]
+#![allow(incomplete_features)]
+
+trait Foo {
+    fn bar() -> impl Sized;
+}