summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generic-associated-types/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/generic-associated-types/bugs')
-rw-r--r--src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-100013.rs39
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-100013.stderr82
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-80626.rs7
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-80626.stderr15
5 files changed, 124 insertions, 21 deletions
diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr b/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr
index 414999881..1c9abc4e8 100644
--- a/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr
+++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/hrtb-implied-1.rs:31:22
|
LL | let slice = &mut ();
- | ^^ creates a temporary which is freed while still in use
+ | ^^ creates a temporary value which is freed while still in use
...
LL | print_items::<WindowsMut<'_>>(windows);
| -------------------------------------- argument requires that borrow lasts for `'static`
diff --git a/src/test/ui/generic-associated-types/bugs/issue-100013.rs b/src/test/ui/generic-associated-types/bugs/issue-100013.rs
new file mode 100644
index 000000000..fc4e47a3b
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/issue-100013.rs
@@ -0,0 +1,39 @@
+// check-fail
+// known-bug
+// edition: 2021
+
+// We really should accept this, but we need implied bounds between the regions
+// in a generator interior.
+
+pub trait FutureIterator {
+ type Future<'s, 'cx>: Send
+ where
+ 's: 'cx;
+}
+
+fn call<I: FutureIterator>() -> impl Send {
+ async { // a generator checked for autotrait impl `Send`
+ //~^ lifetime bound not satisfied
+ let x = None::<I::Future<'_, '_>>; // a type referencing GAT
+ async {}.await; // a yield point
+ }
+}
+
+fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
+ async { // a generator checked for autotrait impl `Send`
+ //~^ lifetime bound not satisfied
+ let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
+ //~^ lifetime may not live long enough
+ async {}.await; // a yield point
+ }
+}
+
+fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
+ async { // a generator checked for autotrait impl `Send`
+ //~^ lifetime bound not satisfied
+ let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
+ async {}.await; // a yield point
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/generic-associated-types/bugs/issue-100013.stderr b/src/test/ui/generic-associated-types/bugs/issue-100013.stderr
new file mode 100644
index 000000000..72ae288dc
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/issue-100013.stderr
@@ -0,0 +1,82 @@
+error: lifetime bound not satisfied
+ --> $DIR/issue-100013.rs:15:5
+ |
+LL | / async { // a generator checked for autotrait impl `Send`
+LL | |
+LL | | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
+LL | | async {}.await; // a yield point
+LL | | }
+ | |_____^
+ |
+note: the lifetime defined here...
+ --> $DIR/issue-100013.rs:17:38
+ |
+LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
+ | ^^
+note: ...must outlive the lifetime defined here
+ --> $DIR/issue-100013.rs:17:34
+ |
+LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
+ | ^^
+ = note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
+
+error: lifetime bound not satisfied
+ --> $DIR/issue-100013.rs:23:5
+ |
+LL | / async { // a generator checked for autotrait impl `Send`
+LL | |
+LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
+LL | |
+LL | | async {}.await; // a yield point
+LL | | }
+ | |_____^
+ |
+note: the lifetime defined here...
+ --> $DIR/issue-100013.rs:22:14
+ |
+LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
+ | ^^
+note: ...must outlive the lifetime defined here
+ --> $DIR/issue-100013.rs:22:10
+ |
+LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
+ | ^^
+ = note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
+
+error: lifetime may not live long enough
+ --> $DIR/issue-100013.rs:25:17
+ |
+LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+...
+LL | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'b`
+ |
+ = help: consider adding the following bound: `'a: 'b`
+
+error: lifetime bound not satisfied
+ --> $DIR/issue-100013.rs:32:5
+ |
+LL | / async { // a generator checked for autotrait impl `Send`
+LL | |
+LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
+LL | | async {}.await; // a yield point
+LL | | }
+ | |_____^
+ |
+note: the lifetime defined here...
+ --> $DIR/issue-100013.rs:31:18
+ |
+LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
+ | ^^
+note: ...must outlive the lifetime defined here
+ --> $DIR/issue-100013.rs:31:10
+ |
+LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
+ | ^^
+ = note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.rs b/src/test/ui/generic-associated-types/bugs/issue-80626.rs
index f6aa6b36e..d6e18010f 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-80626.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-80626.rs
@@ -1,7 +1,4 @@
-// check-fail
-// known-bug: #80626
-
-// This should pass, but it requires `Sized` to be coinductive.
+// check-pass
trait Allocator {
type Allocated<T>;
@@ -9,7 +6,7 @@ trait Allocator {
enum LinkedList<A: Allocator> {
Head,
- Next(A::Allocated<Self>)
+ Next(A::Allocated<Self>),
}
fn main() {}
diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr
deleted file mode 100644
index 9a0f332ed..000000000
--- a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0275]: overflow evaluating the requirement `LinkedList<A>: Sized`
- --> $DIR/issue-80626.rs:12:10
- |
-LL | Next(A::Allocated<Self>)
- | ^^^^^^^^^^^^^^^^^^
- |
-note: required by a bound in `Allocator::Allocated`
- --> $DIR/issue-80626.rs:7:20
- |
-LL | type Allocated<T>;
- | ^ required by this bound in `Allocator::Allocated`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0275`.