diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/suggestions/suggest-move-types.rs | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/suggestions/suggest-move-types.rs')
-rw-r--r-- | tests/ui/suggestions/suggest-move-types.rs | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/tests/ui/suggestions/suggest-move-types.rs b/tests/ui/suggestions/suggest-move-types.rs new file mode 100644 index 000000000..27930626a --- /dev/null +++ b/tests/ui/suggestions/suggest-move-types.rs @@ -0,0 +1,91 @@ +#![allow(warnings)] + +// This test verifies that the suggestion to move types before associated type bindings +// is correct. + +trait One<T> { + type A; +} + +trait OneWithLifetime<'a, T> { + type A; +} + +trait Three<T, U, V> { + type A; + type B; + type C; +} + +trait ThreeWithLifetime<'a, 'b, 'c, T, U, V> { + type A; + type B; + type C; +} + +struct A<T, M: One<A=(), T>> { +//~^ ERROR generic arguments must come before the first constraint + m: M, + t: T, +} + + +struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> { +//~^ ERROR generic arguments must come before the first constraint +//~^^ ERROR type provided when a lifetime was expected + m: M, + t: &'a T, +} + +struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> { +//~^ ERROR generic arguments must come before the first constraint + m: M, + t: T, + u: U, + v: V, +} + +struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> { +//~^ ERROR generic arguments must come before the first constraint +//~^^ ERROR type provided when a lifetime was expected + m: M, + t: &'a T, + u: &'b U, + v: &'c V, +} + +struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> { +//~^ ERROR generic arguments must come before the first constraint + m: M, + t: T, + u: U, + v: V, +} + +struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=(), U, 'b, V, 'c>> { +//~^ ERROR generic arguments must come before the first constraint +//~^^ ERROR lifetime provided when a type was expected + m: M, + t: &'a T, + u: &'b U, + v: &'c V, +} + +struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> { +//~^ ERROR generic arguments must come before the first constraint + m: M, + t: T, + u: U, + v: V, +} + +struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> { +//~^ ERROR generic arguments must come before the first constraint +//~^^ ERROR lifetime provided when a type was expected + m: M, + t: &'a T, + u: &'b U, + v: &'c V, +} + +fn main() {} |