diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/type-alias | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/type-alias')
-rw-r--r-- | tests/ui/type-alias/issue-14933.rs | 6 | ||||
-rw-r--r-- | tests/ui/type-alias/issue-37515.rs | 8 | ||||
-rw-r--r-- | tests/ui/type-alias/issue-37515.stderr | 15 | ||||
-rw-r--r-- | tests/ui/type-alias/issue-62263-self-in-atb.rs | 8 | ||||
-rw-r--r-- | tests/ui/type-alias/issue-62263-self-in-atb.stderr | 9 | ||||
-rw-r--r-- | tests/ui/type-alias/issue-62305-self-assoc-ty.rs | 4 | ||||
-rw-r--r-- | tests/ui/type-alias/issue-62305-self-assoc-ty.stderr | 9 | ||||
-rw-r--r-- | tests/ui/type-alias/issue-62364-self-ty-arg.rs | 8 | ||||
-rw-r--r-- | tests/ui/type-alias/issue-62364-self-ty-arg.stderr | 11 |
9 files changed, 78 insertions, 0 deletions
diff --git a/tests/ui/type-alias/issue-14933.rs b/tests/ui/type-alias/issue-14933.rs new file mode 100644 index 000000000..bd95332ca --- /dev/null +++ b/tests/ui/type-alias/issue-14933.rs @@ -0,0 +1,6 @@ +// check-pass +// pretty-expanded FIXME #23616 + +pub type BigRat<T = isize> = T; + +fn main() {} diff --git a/tests/ui/type-alias/issue-37515.rs b/tests/ui/type-alias/issue-37515.rs new file mode 100644 index 000000000..b3a870d50 --- /dev/null +++ b/tests/ui/type-alias/issue-37515.rs @@ -0,0 +1,8 @@ +// check-pass + +#![warn(unused)] + +type Z = dyn for<'x> Send; +//~^ WARN type alias `Z` is never used + +fn main() {} diff --git a/tests/ui/type-alias/issue-37515.stderr b/tests/ui/type-alias/issue-37515.stderr new file mode 100644 index 000000000..f1e83ca74 --- /dev/null +++ b/tests/ui/type-alias/issue-37515.stderr @@ -0,0 +1,15 @@ +warning: type alias `Z` is never used + --> $DIR/issue-37515.rs:5:6 + | +LL | type Z = dyn for<'x> Send; + | ^ + | +note: the lint level is defined here + --> $DIR/issue-37515.rs:3:9 + | +LL | #![warn(unused)] + | ^^^^^^ + = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` + +warning: 1 warning emitted + diff --git a/tests/ui/type-alias/issue-62263-self-in-atb.rs b/tests/ui/type-alias/issue-62263-self-in-atb.rs new file mode 100644 index 000000000..91522d891 --- /dev/null +++ b/tests/ui/type-alias/issue-62263-self-in-atb.rs @@ -0,0 +1,8 @@ +pub trait Trait { + type A; +} + +pub type Alias = dyn Trait<A = Self::A>; +//~^ ERROR failed to resolve: `Self` + +fn main() {} diff --git a/tests/ui/type-alias/issue-62263-self-in-atb.stderr b/tests/ui/type-alias/issue-62263-self-in-atb.stderr new file mode 100644 index 000000000..c20074dc2 --- /dev/null +++ b/tests/ui/type-alias/issue-62263-self-in-atb.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions + --> $DIR/issue-62263-self-in-atb.rs:5:32 + | +LL | pub type Alias = dyn Trait<A = Self::A>; + | ^^^^ `Self` is only available in impls, traits, and type definitions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/type-alias/issue-62305-self-assoc-ty.rs b/tests/ui/type-alias/issue-62305-self-assoc-ty.rs new file mode 100644 index 000000000..a4d9a2854 --- /dev/null +++ b/tests/ui/type-alias/issue-62305-self-assoc-ty.rs @@ -0,0 +1,4 @@ +type Alias = Self::Target; +//~^ ERROR failed to resolve: `Self` + +fn main() {} diff --git a/tests/ui/type-alias/issue-62305-self-assoc-ty.stderr b/tests/ui/type-alias/issue-62305-self-assoc-ty.stderr new file mode 100644 index 000000000..f3da50df9 --- /dev/null +++ b/tests/ui/type-alias/issue-62305-self-assoc-ty.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions + --> $DIR/issue-62305-self-assoc-ty.rs:1:14 + | +LL | type Alias = Self::Target; + | ^^^^ `Self` is only available in impls, traits, and type definitions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/type-alias/issue-62364-self-ty-arg.rs b/tests/ui/type-alias/issue-62364-self-ty-arg.rs new file mode 100644 index 000000000..bebb4a902 --- /dev/null +++ b/tests/ui/type-alias/issue-62364-self-ty-arg.rs @@ -0,0 +1,8 @@ +struct Struct<P1> { + field: P1, +} + +type Alias<'a> = Struct<&'a Self>; +//~^ ERROR cannot find type `Self` in this scope [E0411] + +fn main() {} diff --git a/tests/ui/type-alias/issue-62364-self-ty-arg.stderr b/tests/ui/type-alias/issue-62364-self-ty-arg.stderr new file mode 100644 index 000000000..7e15e42e3 --- /dev/null +++ b/tests/ui/type-alias/issue-62364-self-ty-arg.stderr @@ -0,0 +1,11 @@ +error[E0411]: cannot find type `Self` in this scope + --> $DIR/issue-62364-self-ty-arg.rs:5:29 + | +LL | type Alias<'a> = Struct<&'a Self>; + | ----- ^^^^ `Self` is only available in impls, traits, and type definitions + | | + | `Self` not allowed in a type alias + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0411`. |