diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:12:43 +0000 |
commit | cf94bdc0742c13e2a0cac864c478b8626b266e1b (patch) | |
tree | 044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /src/test/ui/generic-associated-types | |
parent | Adding debian version 1.65.0+dfsg1-2. (diff) | |
download | rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/generic-associated-types')
-rw-r--r-- | src/test/ui/generic-associated-types/bugs/issue-86218.stderr | 23 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/bugs/issue-88382.stderr | 4 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/bugs/issue-89008.stderr | 19 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/bugs/issue-91762.rs | 2 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/issue-102114.rs | 16 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/issue-102114.stderr | 12 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/issue-86218-2.rs | 23 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/issue-86218.rs (renamed from src/test/ui/generic-associated-types/bugs/issue-86218.rs) | 8 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/issue-87258_a.stderr | 2 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/issue-87429-specialization.stderr | 2 | ||||
-rw-r--r-- | src/test/ui/generic-associated-types/issue-89008.rs (renamed from src/test/ui/generic-associated-types/bugs/issue-89008.rs) | 28 |
11 files changed, 70 insertions, 69 deletions
diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.stderr b/src/test/ui/generic-associated-types/bugs/issue-86218.stderr deleted file mode 100644 index de1b464a4..000000000 --- a/src/test/ui/generic-associated-types/bugs/issue-86218.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0477]: the type `<() as Yay<&'a ()>>::InnerStream<'s>` does not fulfill the required lifetime - --> $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:22:22 - | -LL | type InnerStream<'s> = impl Stream<Item = i32> + 's; - | ^^ - -error: unconstrained opaque type - --> $DIR/issue-86218.rs:22:28 - | -LL | type InnerStream<'s> = impl Stream<Item = i32> + 's; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `InnerStream` must be used in combination with a concrete type within the same module - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0477`. 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 c5fd58096..a9a70bb71 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88382.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-88382.stderr @@ -9,8 +9,8 @@ LL | do_something(SomeImplementation(), test); LL | fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {} | ------------------------------------------------- found signature defined here | - = 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: expected function signature `for<'a> fn(&'a mut std::iter::Empty<usize>) -> _` + found function signature `for<'a, 'b> fn(&'b mut <_ as Iterable>::Iterator<'a>) -> _` note: required by a bound in `do_something` --> $DIR/issue-88382.rs:20:48 | diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr b/src/test/ui/generic-associated-types/bugs/issue-89008.stderr deleted file mode 100644 index 3f72734ef..000000000 --- a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0271]: type mismatch resolving `<Empty<_> as Stream>::Item == Repr` - --> $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` - | | - | this type parameter - | -note: expected this to be `()` - --> $DIR/issue-89008.rs:17:17 - | -LL | type Item = (); - | ^^ - = note: expected unit type `()` - found type parameter `Repr` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/generic-associated-types/bugs/issue-91762.rs b/src/test/ui/generic-associated-types/bugs/issue-91762.rs index 796935cc0..dec668bec 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-91762.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-91762.rs @@ -1,7 +1,7 @@ // check-fail // known-bug -// We almost certaintly want this to pass, but +// We almost certainly 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) diff --git a/src/test/ui/generic-associated-types/issue-102114.rs b/src/test/ui/generic-associated-types/issue-102114.rs new file mode 100644 index 000000000..de31737ef --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-102114.rs @@ -0,0 +1,16 @@ +trait A { + type B<'b>; + fn a() -> Self::B<'static>; +} + +struct C; + +struct Wrapper<T>(T); + +impl A for C { + type B<T> = Wrapper<T>; + //~^ ERROR type `B` has 1 type parameter but its trait declaration has 0 type parameters + fn a() -> Self::B<'static> {} +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-102114.stderr b/src/test/ui/generic-associated-types/issue-102114.stderr new file mode 100644 index 000000000..8e41dee54 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-102114.stderr @@ -0,0 +1,12 @@ +error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/issue-102114.rs:11:12 + | +LL | type B<'b>; + | -- expected 0 type parameters +... +LL | type B<T> = Wrapper<T>; + | ^ found 1 type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0049`. diff --git a/src/test/ui/generic-associated-types/issue-86218-2.rs b/src/test/ui/generic-associated-types/issue-86218-2.rs new file mode 100644 index 000000000..63c839ea8 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-86218-2.rs @@ -0,0 +1,23 @@ +// check-pass + +#![feature(type_alias_impl_trait)] + +pub trait Stream { + type Item; +} + +impl Stream for () { + type Item = i32; +} + +trait Yay<AdditionalValue> { + type InnerStream<'s>: Stream<Item = i32> + 's; + fn foo<'s>() -> Self::InnerStream<'s>; +} + +impl<T> Yay<T> for () { + type InnerStream<'s> = impl Stream<Item = i32> + 's; + fn foo<'s>() -> Self::InnerStream<'s> { () } +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.rs b/src/test/ui/generic-associated-types/issue-86218.rs index 3a2d758e7..b2c3071f0 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-86218.rs +++ b/src/test/ui/generic-associated-types/issue-86218.rs @@ -1,7 +1,4 @@ -// check-fail -// known-bug: #86218 - -// This should pass, but seems to run into a TAIT issue. +// check-pass #![feature(type_alias_impl_trait)] @@ -20,7 +17,8 @@ trait Yay<AdditionalValue> { impl<'a> Yay<&'a ()> for () { type InnerStream<'s> = impl Stream<Item = i32> + 's; - fn foo<'s>() -> Self::InnerStream<'s> { todo!() } + //^ ERROR does not fulfill the required lifetime + fn foo<'s>() -> Self::InnerStream<'s> { () } } fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-87258_a.stderr b/src/test/ui/generic-associated-types/issue-87258_a.stderr index fa0748a28..eae9bd9b1 100644 --- a/src/test/ui/generic-associated-types/issue-87258_a.stderr +++ b/src/test/ui/generic-associated-types/issue-87258_a.stderr @@ -4,7 +4,7 @@ error: unconstrained opaque type LL | type FooFuture<'a> = impl Trait1; | ^^^^^^^^^^^ | - = note: `FooFuture` must be used in combination with a concrete type within the same module + = note: `FooFuture` must be used in combination with a concrete type within the same impl error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-87429-specialization.stderr b/src/test/ui/generic-associated-types/issue-87429-specialization.stderr index d8e889aec..11c4ebf60 100644 --- a/src/test/ui/generic-associated-types/issue-87429-specialization.stderr +++ b/src/test/ui/generic-associated-types/issue-87429-specialization.stderr @@ -4,9 +4,9 @@ warning: the feature `specialization` is incomplete and may not be safe to use a LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default error[E0277]: can't compare `Foo` with `Foo` --> $DIR/issue-87429-specialization.rs:20:31 diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.rs b/src/test/ui/generic-associated-types/issue-89008.rs index 012aa8df2..669dbafb5 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-89008.rs +++ b/src/test/ui/generic-associated-types/issue-89008.rs @@ -1,42 +1,36 @@ -// check-fail +// check-pass // edition:2021 -// known-bug: #88908 - -// This should pass, but seems to run into a TAIT bug. #![feature(type_alias_impl_trait)] use std::future::Future; +use std::marker::PhantomData; trait Stream { type Item; } -struct Empty<T>(T); -impl<T> Stream for Empty<T> { - type Item = (); +struct Empty<T> { + _phantom: PhantomData<T>, } -fn empty<T>() -> Empty<T> { - todo!() + +impl<T> Stream for Empty<T> { + type Item = T; } trait X { type LineStream<'a, Repr>: Stream<Item = Repr> where Self: 'a; - - type LineStreamFut<'a,Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a; - - fn line_stream<'a,Repr>(&'a self) -> Self::LineStreamFut<'a,Repr>; + type LineStreamFut<'a, Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a; + fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr>; } struct Y; impl X for Y { type LineStream<'a, Repr> = impl Stream<Item = Repr>; - - type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>> ; - + type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>; fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { - async {empty()} + async { Empty { _phantom: PhantomData } } } } |