From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- ...associated-types-project-from-hrtb-in-struct.rs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs (limited to 'src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs') diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs new file mode 100644 index 000000000..ed30d86cb --- /dev/null +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs @@ -0,0 +1,39 @@ +// Check projection of an associated type out of a higher-ranked trait-bound +// in the context of a struct definition. + +pub trait Foo { + type A; + + fn get(&self, t: T) -> Self::A; +} + +struct SomeStruct Foo<&'x isize>> { + field: I::A + //~^ ERROR cannot use the associated type of a trait with uninferred generic parameters +} + +enum SomeEnum<'b, I: for<'a> Foo<&'a isize>> { + TupleVariant(I::A), + //~^ ERROR cannot use the associated type of a trait with uninferred generic parameters + StructVariant { field: I::A }, + //~^ ERROR cannot use the associated type of a trait with uninferred generic parameters + OkVariant(&'b usize), +} + +// FIXME(eddyb) This one doesn't even compile because of the unsupported syntax. + +// struct AnotherStruct Foo<&'x isize>> { +// field: Foo<&'y isize>>::A +// } + +struct YetAnotherStruct<'a, I: for<'x> Foo<&'x isize>> { + field: >::A, +} + +struct Why<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x, + 'y, 'z, 'aa, I: for<'l, 'm> Foo<&'l &'m isize>> { + field: I::A, + //~^ ERROR cannot use the associated type of a trait with uninferred generic parameters +} + +pub fn main() {} -- cgit v1.2.3