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.rs35
-rw-r--r--src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr20
-rw-r--r--src/test/ui/generic-associated-types/bugs/hrtb-implied-2.rs40
-rw-r--r--src/test/ui/generic-associated-types/bugs/hrtb-implied-2.stderr22
-rw-r--r--src/test/ui/generic-associated-types/bugs/hrtb-implied-3.rs23
-rw-r--r--src/test/ui/generic-associated-types/bugs/hrtb-implied-3.stderr22
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-80626.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-80626.stderr4
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-86218.rs1
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-86218.stderr6
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87735.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87735.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87748.rs23
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87748.stderr20
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87755.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87755.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87803.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87803.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88382.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88382.stderr4
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88460.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88460.stderr8
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88526.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88526.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-89008.rs1
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-89008.stderr4
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-91762.rs29
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-91762.stderr14
28 files changed, 223 insertions, 75 deletions
diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.rs b/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.rs
new file mode 100644
index 000000000..719d1bd5a
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.rs
@@ -0,0 +1,35 @@
+// check-fail
+// known-bug
+
+// This gives us problems because `for<'a> I::Item<'a>: Debug` should mean "for
+// all 'a where I::Item<'a> is WF", but really means "for all 'a possible"
+
+use std::fmt::Debug;
+
+pub trait LendingIterator {
+ type Item<'this>
+ where
+ Self: 'this;
+}
+
+pub struct WindowsMut<'x> {
+ slice: &'x (),
+}
+
+impl<'y> LendingIterator for WindowsMut<'y> {
+ type Item<'this> = &'this mut () where 'y: 'this;
+}
+
+fn print_items<I>(_iter: I)
+where
+ I: LendingIterator,
+ for<'a> I::Item<'a>: Debug,
+{
+}
+
+fn main() {
+ let slice = &mut ();
+ //~^ temporary value dropped while borrowed
+ let windows = WindowsMut { slice };
+ print_items::<WindowsMut<'_>>(windows);
+}
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
new file mode 100644
index 000000000..414999881
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr
@@ -0,0 +1,20 @@
+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
+...
+LL | print_items::<WindowsMut<'_>>(windows);
+ | -------------------------------------- argument requires that borrow lasts for `'static`
+LL | }
+ | - temporary value is freed at the end of this statement
+ |
+note: due to current limitations in the borrow checker, this implies a `'static` lifetime
+ --> $DIR/hrtb-implied-1.rs:26:26
+ |
+LL | for<'a> I::Item<'a>: Debug,
+ | ^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.rs b/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.rs
new file mode 100644
index 000000000..8e6c5348e
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.rs
@@ -0,0 +1,40 @@
+// check-fail
+// known-bug
+
+// This gives us problems because `for<'a> I::Item<'a>: Debug` should mean "for
+// all 'a where I::Item<'a> is WF", but really means "for all 'a possible"
+
+trait LendingIterator: Sized {
+ type Item<'a>
+ where
+ Self: 'a;
+ fn next(&mut self) -> Self::Item<'_>;
+}
+fn fails<I: LendingIterator, F>(iter: &mut I, f: F) -> bool
+where
+ F: FnMut(I::Item<'_>),
+{
+ let mut iter2 = Eat(iter, f);
+ let _next = iter2.next();
+ //~^ borrowed data escapes
+ true
+}
+impl<I: LendingIterator> LendingIterator for &mut I {
+ type Item<'a> = I::Item<'a> where Self:'a;
+ fn next(&mut self) -> Self::Item<'_> {
+ (**self).next()
+ }
+}
+
+struct Eat<I, F>(I, F);
+impl<I: LendingIterator, F> Iterator for Eat<I, F>
+where
+ F: FnMut(I::Item<'_>),
+{
+ type Item = ();
+ fn next(&mut self) -> Option<Self::Item> {
+ None
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.stderr b/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.stderr
new file mode 100644
index 000000000..1ee270398
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.stderr
@@ -0,0 +1,22 @@
+error[E0521]: borrowed data escapes outside of function
+ --> $DIR/hrtb-implied-2.rs:18:17
+ |
+LL | fn fails<I: LendingIterator, F>(iter: &mut I, f: F) -> bool
+ | ---- - let's call the lifetime of this reference `'1`
+ | |
+ | `iter` is a reference that is only valid in the function body
+...
+LL | let _next = iter2.next();
+ | ^^^^^^^^^^^^
+ | |
+ | `iter` escapes the function body here
+ | argument requires that `'1` must outlive `'static`
+ |
+ = note: requirement occurs because of a mutable reference to `Eat<&mut I, F>`
+ = note: mutable references are invariant over their type parameter
+ = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
+ = note: due to current limitations in the borrow checker, this implies a `'static` lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0521`.
diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.rs b/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.rs
new file mode 100644
index 000000000..bc9e6c8ae
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.rs
@@ -0,0 +1,23 @@
+trait LendingIterator {
+ type Item<'a>
+ where
+ Self: 'a;
+}
+
+impl LendingIterator for &str {
+ type Item<'a> = () where Self:'a;
+}
+
+fn trivial_bound<I>(_: I)
+where
+ I: LendingIterator,
+ for<'a> I::Item<'a>: Sized,
+{
+}
+
+fn fails(iter: &str) {
+ trivial_bound(iter);
+ //~^ borrowed data escapes
+}
+
+fn main() {}
diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.stderr b/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.stderr
new file mode 100644
index 000000000..c67e02437
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.stderr
@@ -0,0 +1,22 @@
+error[E0521]: borrowed data escapes outside of function
+ --> $DIR/hrtb-implied-3.rs:19:5
+ |
+LL | fn fails(iter: &str) {
+ | ---- - let's call the lifetime of this reference `'1`
+ | |
+ | `iter` is a reference that is only valid in the function body
+LL | trivial_bound(iter);
+ | ^^^^^^^^^^^^^^^^^^^
+ | |
+ | `iter` escapes the function body here
+ | argument requires that `'1` must outlive `'static`
+ |
+note: due to current limitations in the borrow checker, this implies a `'static` lifetime
+ --> $DIR/hrtb-implied-3.rs:14:26
+ |
+LL | for<'a> I::Item<'a>: Sized,
+ | ^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0521`.
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 14f27aff1..f6aa6b36e 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-80626.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-80626.rs
@@ -3,8 +3,6 @@
// This should pass, but it requires `Sized` to be coinductive.
-#![feature(generic_associated_types)]
-
trait Allocator {
type Allocated<T>;
}
diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr
index 487b83dfa..9a0f332ed 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr
@@ -1,11 +1,11 @@
error[E0275]: overflow evaluating the requirement `LinkedList<A>: Sized`
- --> $DIR/issue-80626.rs:14:10
+ --> $DIR/issue-80626.rs:12:10
|
LL | Next(A::Allocated<Self>)
| ^^^^^^^^^^^^^^^^^^
|
note: required by a bound in `Allocator::Allocated`
- --> $DIR/issue-80626.rs:9:20
+ --> $DIR/issue-80626.rs:7:20
|
LL | type Allocated<T>;
| ^ required by this bound in `Allocator::Allocated`
diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.rs b/src/test/ui/generic-associated-types/bugs/issue-86218.rs
index fb62c10a9..3a2d758e7 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-86218.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-86218.rs
@@ -3,7 +3,6 @@
// This should pass, but seems to run into a TAIT issue.
-#![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)]
pub trait Stream {
diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.stderr b/src/test/ui/generic-associated-types/bugs/issue-86218.stderr
index fbf1c8f95..de1b464a4 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-86218.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-86218.stderr
@@ -1,17 +1,17 @@
error[E0477]: the type `<() as Yay<&'a ()>>::InnerStream<'s>` does not fulfill the required lifetime
- --> $DIR/issue-86218.rs:23:28
+ --> $DIR/issue-86218.rs:22:28
|
LL | type InnerStream<'s> = impl Stream<Item = i32> + 's;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: type must outlive the lifetime `'s` as defined here as required by this binding
- --> $DIR/issue-86218.rs:23:22
+ --> $DIR/issue-86218.rs:22:22
|
LL | type InnerStream<'s> = impl Stream<Item = i32> + 's;
| ^^
error: unconstrained opaque type
- --> $DIR/issue-86218.rs:23:28
+ --> $DIR/issue-86218.rs:22:28
|
LL | type InnerStream<'s> = impl Stream<Item = i32> + 's;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87735.rs b/src/test/ui/generic-associated-types/bugs/issue-87735.rs
index 0844d84c3..80737a798 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87735.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-87735.rs
@@ -3,8 +3,6 @@
// This should pass, but we need an extension of implied bounds (probably).
-#![feature(generic_associated_types)]
-
pub trait AsRef2 {
type Output<'a> where Self: 'a;
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87735.stderr b/src/test/ui/generic-associated-types/bugs/issue-87735.stderr
index 0a18b5f0c..ebe2054ce 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87735.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-87735.stderr
@@ -1,5 +1,5 @@
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
- --> $DIR/issue-87735.rs:27:13
+ --> $DIR/issue-87735.rs:25:13
|
LL | impl<'b, T, U> AsRef2 for Foo<T>
| ^ unconstrained type parameter
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87748.rs b/src/test/ui/generic-associated-types/bugs/issue-87748.rs
deleted file mode 100644
index a3d00ee03..000000000
--- a/src/test/ui/generic-associated-types/bugs/issue-87748.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// check-fail
-// known-bug: #87748
-
-// This should pass, but unnormalized input args aren't treated as implied.
-
-#![feature(generic_associated_types)]
-
-trait MyTrait {
- type Assoc<'a, 'b> where 'b: 'a;
- fn do_sth(arg: Self::Assoc<'_, '_>);
-}
-
-struct Foo;
-
-impl MyTrait for Foo {
- type Assoc<'a, 'b> = u32 where 'b: 'a;
-
- fn do_sth(_: u32) {}
- // fn do_sth(_: Self::Assoc<'static, 'static>) {}
- // fn do_sth(_: Self::Assoc<'_, '_>) {}
-}
-
-fn main() {}
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87748.stderr b/src/test/ui/generic-associated-types/bugs/issue-87748.stderr
deleted file mode 100644
index ac197dfe6..000000000
--- a/src/test/ui/generic-associated-types/bugs/issue-87748.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0478]: lifetime bound not satisfied
- --> $DIR/issue-87748.rs:18:5
- |
-LL | fn do_sth(_: u32) {}
- | ^^^^^^^^^^^^^^^^^
- |
-note: lifetime parameter instantiated with the anonymous lifetime as defined here
- --> $DIR/issue-87748.rs:18:5
- |
-LL | fn do_sth(_: u32) {}
- | ^^^^^^^^^^^^^^^^^
-note: but lifetime parameter must outlive the anonymous lifetime as defined here
- --> $DIR/issue-87748.rs:18:5
- |
-LL | fn do_sth(_: u32) {}
- | ^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0478`.
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87755.rs b/src/test/ui/generic-associated-types/bugs/issue-87755.rs
index efa487d62..cda722d2f 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87755.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-87755.rs
@@ -3,8 +3,6 @@
// This should pass.
-#![feature(generic_associated_types)]
-
use std::fmt::Debug;
trait Foo {
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87755.stderr b/src/test/ui/generic-associated-types/bugs/issue-87755.stderr
index 5d1aff011..5e94db9b0 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87755.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-87755.stderr
@@ -1,5 +1,5 @@
error[E0275]: overflow evaluating the requirement `<Bar as Foo>::Ass == _`
- --> $DIR/issue-87755.rs:18:16
+ --> $DIR/issue-87755.rs:16:16
|
LL | type Ass = Bar;
| ^^^
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87803.rs b/src/test/ui/generic-associated-types/bugs/issue-87803.rs
index a8a111c99..56237e387 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87803.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-87803.rs
@@ -4,8 +4,6 @@
// This should pass, but using a type alias vs a reference directly
// changes late-bound -> early-bound.
-#![feature(generic_associated_types)]
-
trait Scanner {
type Input<'a>;
type Token<'a>;
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87803.stderr b/src/test/ui/generic-associated-types/bugs/issue-87803.stderr
index c81c051d3..fe2abdedb 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87803.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-87803.stderr
@@ -1,5 +1,5 @@
error[E0195]: lifetime parameters or bounds on method `scan` do not match the trait declaration
- --> $DIR/issue-87803.rs:22:12
+ --> $DIR/issue-87803.rs:20:12
|
LL | fn scan<'a>(&mut self, i : Self::Input<'a>) -> Self::Token<'a>;
| ---- lifetimes in impl do not match this method in trait
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.rs b/src/test/ui/generic-associated-types/bugs/issue-88382.rs
index 5493b9b93..8f8cc4523 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88382.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-88382.rs
@@ -3,8 +3,6 @@
// This should pass, but has a missed normalization due to HRTB.
-#![feature(generic_associated_types)]
-
trait Iterable {
type Iterator<'a> where Self: 'a;
fn iter(&self) -> Self::Iterator<'_>;
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.stderr b/src/test/ui/generic-associated-types/bugs/issue-88382.stderr
index 7210895b7..c5fd58096 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88382.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-88382.stderr
@@ -1,5 +1,5 @@
error[E0631]: type mismatch in function arguments
- --> $DIR/issue-88382.rs:28:40
+ --> $DIR/issue-88382.rs:26:40
|
LL | do_something(SomeImplementation(), test);
| ------------ ^^^^ expected due to this
@@ -12,7 +12,7 @@ LL | fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {}
= note: expected function signature `for<'r> fn(&'r mut std::iter::Empty<usize>) -> _`
found function signature `for<'a, 'r> fn(&'r mut <_ as Iterable>::Iterator<'a>) -> _`
note: required by a bound in `do_something`
- --> $DIR/issue-88382.rs:22:48
+ --> $DIR/issue-88382.rs:20:48
|
LL | fn do_something<I: Iterable>(i: I, mut f: impl for<'a> Fn(&mut I::Iterator<'a>)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `do_something`
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.rs b/src/test/ui/generic-associated-types/bugs/issue-88460.rs
index f1c3b2269..224e696ad 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88460.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-88460.rs
@@ -3,8 +3,6 @@
// This should pass, but has a missed normalization due to HRTB.
-#![feature(generic_associated_types)]
-
pub trait Marker {}
pub trait Trait {
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr
index 98c304cc9..6612c4b49 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr
@@ -1,12 +1,14 @@
error[E0277]: the trait bound `for<'a> <_ as Trait>::Assoc<'a>: Marker` is not satisfied
- --> $DIR/issue-88460.rs:30:5
+ --> $DIR/issue-88460.rs:28:10
|
LL | test(Foo);
- | ^^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>`
+ | ---- ^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Marker` is implemented for `()`
note: required by a bound in `test`
- --> $DIR/issue-88460.rs:17:27
+ --> $DIR/issue-88460.rs:15:27
|
LL | fn test<T>(value: T)
| ---- required by a bound in this
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88526.rs b/src/test/ui/generic-associated-types/bugs/issue-88526.rs
index 15363ad04..99397744f 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88526.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-88526.rs
@@ -3,8 +3,6 @@
// This should pass, but requires more logic.
-#![feature(generic_associated_types)]
-
trait A {
type I<'a>;
}
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88526.stderr b/src/test/ui/generic-associated-types/bugs/issue-88526.stderr
index 127c889bf..56857c655 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88526.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-88526.stderr
@@ -1,5 +1,5 @@
error[E0207]: the type parameter `I` is not constrained by the impl trait, self type, or predicates
- --> $DIR/issue-88526.rs:27:13
+ --> $DIR/issue-88526.rs:25:13
|
LL | impl<'q, Q, I, F> A for TestB<Q, F>
| ^ unconstrained type parameter
diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.rs b/src/test/ui/generic-associated-types/bugs/issue-89008.rs
index 79c28b0d2..012aa8df2 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-89008.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-89008.rs
@@ -5,7 +5,6 @@
// This should pass, but seems to run into a TAIT bug.
#![feature(type_alias_impl_trait)]
-#![feature(generic_associated_types)]
use std::future::Future;
diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr b/src/test/ui/generic-associated-types/bugs/issue-89008.stderr
index 50844fdc1..3f72734ef 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-89008.stderr
@@ -1,5 +1,5 @@
error[E0271]: type mismatch resolving `<Empty<_> as Stream>::Item == Repr`
- --> $DIR/issue-89008.rs:39:43
+ --> $DIR/issue-89008.rs:38:43
|
LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
| ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Empty<_> as Stream>::Item == Repr`
@@ -7,7 +7,7 @@ LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
| this type parameter
|
note: expected this to be `()`
- --> $DIR/issue-89008.rs:18:17
+ --> $DIR/issue-89008.rs:17:17
|
LL | type Item = ();
| ^^
diff --git a/src/test/ui/generic-associated-types/bugs/issue-91762.rs b/src/test/ui/generic-associated-types/bugs/issue-91762.rs
new file mode 100644
index 000000000..796935cc0
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/issue-91762.rs
@@ -0,0 +1,29 @@
+// check-fail
+// known-bug
+
+// We almost certaintly want this to pass, but
+// it's particularly difficult currently, because we need a way of specifying
+// that `<Self::Base as Functor>::With<T> = Self` without using that when we have
+// a `U`. See `https://github.com/rust-lang/rust/pull/92728` for a (hacky)
+// solution. This might be better to just wait for Chalk.
+
+pub trait Functor {
+ type With<T>;
+
+ fn fmap<T, U>(this: Self::With<T>) -> Self::With<U>;
+}
+
+pub trait FunctorExt<T>: Sized {
+ type Base: Functor<With<T> = Self>;
+
+ fn fmap<U>(self) {
+ let arg: <Self::Base as Functor>::With<T>;
+ let ret: <Self::Base as Functor>::With<U>;
+
+ arg = self;
+ ret = <Self::Base as Functor>::fmap(arg);
+ //~^ type annotations needed
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/generic-associated-types/bugs/issue-91762.stderr b/src/test/ui/generic-associated-types/bugs/issue-91762.stderr
new file mode 100644
index 000000000..1272c8b8a
--- /dev/null
+++ b/src/test/ui/generic-associated-types/bugs/issue-91762.stderr
@@ -0,0 +1,14 @@
+error[E0282]: type annotations needed
+ --> $DIR/issue-91762.rs:24:15
+ |
+LL | ret = <Self::Base as Functor>::fmap(arg);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the associated function `fmap`
+ |
+help: consider specifying the generic arguments
+ |
+LL | ret = <Self::Base as Functor>::fmap::<T, U>(arg);
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.