summaryrefslogtreecommitdiffstats
path: root/tests/ui/associated-type-bounds
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /tests/ui/associated-type-bounds
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/associated-type-bounds')
-rw-r--r--tests/ui/associated-type-bounds/dyn-impl-trait-type.rs8
-rw-r--r--tests/ui/associated-type-bounds/dyn-rpit-and-let.rs8
-rw-r--r--tests/ui/associated-type-bounds/implied-in-supertrait.rs19
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr (renamed from tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr)12
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr48
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr11
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr29
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr11
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr29
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.rs14
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr (renamed from tests/ui/associated-type-bounds/return-type-notation/equality.stderr)4
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr17
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.rs2
-rw-r--r--tests/ui/associated-type-bounds/rpit.rs8
-rw-r--r--tests/ui/associated-type-bounds/trait-alias-impl-trait.rs8
16 files changed, 201 insertions, 29 deletions
diff --git a/tests/ui/associated-type-bounds/dyn-impl-trait-type.rs b/tests/ui/associated-type-bounds/dyn-impl-trait-type.rs
index a8d00803a..a3f471779 100644
--- a/tests/ui/associated-type-bounds/dyn-impl-trait-type.rs
+++ b/tests/ui/associated-type-bounds/dyn-impl-trait-type.rs
@@ -59,8 +59,8 @@ fn def_et4() -> Et4 {
pub fn use_et4() { assert_forall_tr2(def_et4().mk()); }
fn main() {
- let _ = use_et1();
- let _ = use_et2();
- let _ = use_et3();
- let _ = use_et4();
+ use_et1();
+ use_et2();
+ use_et3();
+ use_et4();
}
diff --git a/tests/ui/associated-type-bounds/dyn-rpit-and-let.rs b/tests/ui/associated-type-bounds/dyn-rpit-and-let.rs
index 08f965452..52199124e 100644
--- a/tests/ui/associated-type-bounds/dyn-rpit-and-let.rs
+++ b/tests/ui/associated-type-bounds/dyn-rpit-and-let.rs
@@ -66,8 +66,8 @@ fn def_et4() -> Box<dyn Tr1<As1: for<'a> Tr2<'a>>> {
pub fn use_et4() { assert_forall_tr2(def_et4().mk()); }
fn main() {
- let _ = use_et1();
- let _ = use_et2();
- let _ = use_et3();
- let _ = use_et4();
+ use_et1();
+ use_et2();
+ use_et3();
+ use_et4();
}
diff --git a/tests/ui/associated-type-bounds/implied-in-supertrait.rs b/tests/ui/associated-type-bounds/implied-in-supertrait.rs
new file mode 100644
index 000000000..ea7e7c984
--- /dev/null
+++ b/tests/ui/associated-type-bounds/implied-in-supertrait.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+#![feature(associated_type_bounds)]
+
+trait Trait: Super<Assoc: Bound> {}
+
+trait Super {
+ type Assoc;
+}
+
+trait Bound {}
+
+fn foo<T>(x: T)
+where
+ T: Trait,
+{
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr
index 95ef7d82f..b8be132e6 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr
@@ -1,11 +1,11 @@
error: return type notation uses `()` instead of `(..)` for elided arguments
- --> $DIR/bad-inputs-and-output.rs:18:24
+ --> $DIR/bad-inputs-and-output.rs:20:24
|
LL | fn baz<T: Trait<method(..): Send>>() {}
| ^^ help: remove the `..`
error[E0658]: associated type bounds are unstable
- --> $DIR/bad-inputs-and-output.rs:10:17
+ --> $DIR/bad-inputs-and-output.rs:12:17
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^^^^^^^^^^^^^
@@ -14,7 +14,7 @@ LL | fn foo<T: Trait<method(i32): Send>>() {}
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable
- --> $DIR/bad-inputs-and-output.rs:14:17
+ --> $DIR/bad-inputs-and-output.rs:16:17
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/bad-inputs-and-output.rs:3:12
+ --> $DIR/bad-inputs-and-output.rs:5:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^^^^
@@ -32,13 +32,13 @@ LL | #![feature(return_type_notation, async_fn_in_trait)]
= note: `#[warn(incomplete_features)]` on by default
error: argument types not allowed with return type notation
- --> $DIR/bad-inputs-and-output.rs:10:23
+ --> $DIR/bad-inputs-and-output.rs:12:23
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^ help: remove the input types: `()`
error: return type not allowed with return type notation
- --> $DIR/bad-inputs-and-output.rs:14:25
+ --> $DIR/bad-inputs-and-output.rs:16:25
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^ help: remove the return type
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr
new file mode 100644
index 000000000..b8be132e6
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr
@@ -0,0 +1,48 @@
+error: return type notation uses `()` instead of `(..)` for elided arguments
+ --> $DIR/bad-inputs-and-output.rs:20:24
+ |
+LL | fn baz<T: Trait<method(..): Send>>() {}
+ | ^^ help: remove the `..`
+
+error[E0658]: associated type bounds are unstable
+ --> $DIR/bad-inputs-and-output.rs:12:17
+ |
+LL | fn foo<T: Trait<method(i32): Send>>() {}
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
+ = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
+
+error[E0658]: associated type bounds are unstable
+ --> $DIR/bad-inputs-and-output.rs:16:17
+ |
+LL | fn bar<T: Trait<method() -> (): Send>>() {}
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
+ = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
+
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/bad-inputs-and-output.rs:5:12
+ |
+LL | #![feature(return_type_notation, async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: argument types not allowed with return type notation
+ --> $DIR/bad-inputs-and-output.rs:12:23
+ |
+LL | fn foo<T: Trait<method(i32): Send>>() {}
+ | ^^^^^ help: remove the input types: `()`
+
+error: return type not allowed with return type notation
+ --> $DIR/bad-inputs-and-output.rs:16:25
+ |
+LL | fn bar<T: Trait<method() -> (): Send>>() {}
+ | ^^^^^^ help: remove the return type
+
+error: aborting due to 5 previous errors; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
index 58ce41d1a..771acb6c4 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
@@ -1,4 +1,6 @@
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(return_type_notation, async_fn_in_trait)]
//~^ WARN the feature `return_type_notation` is incomplete
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr
new file mode 100644
index 000000000..98c1a2827
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr
@@ -0,0 +1,11 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/basic.rs:8:12
+ |
+LL | #![feature(return_type_notation, async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr
new file mode 100644
index 000000000..1066c420c
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr
@@ -0,0 +1,29 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/basic.rs:8:12
+ |
+LL | #![feature(return_type_notation, async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: future cannot be sent between threads safely
+ --> $DIR/basic.rs:26:13
+ |
+LL | is_send(foo::<T>());
+ | ^^^^^^^^^^ future returned by `foo` is not `Send`
+ |
+ = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
+note: future is not `Send` as it awaits another future which is not `Send`
+ --> $DIR/basic.rs:16:5
+ |
+LL | T::method().await?;
+ | ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send`
+note: required by a bound in `is_send`
+ --> $DIR/basic.rs:20:20
+ |
+LL | fn is_send(_: impl Send) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr
new file mode 100644
index 000000000..98c1a2827
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr
@@ -0,0 +1,11 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/basic.rs:8:12
+ |
+LL | #![feature(return_type_notation, async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr
new file mode 100644
index 000000000..1066c420c
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr
@@ -0,0 +1,29 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/basic.rs:8:12
+ |
+LL | #![feature(return_type_notation, async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: future cannot be sent between threads safely
+ --> $DIR/basic.rs:26:13
+ |
+LL | is_send(foo::<T>());
+ | ^^^^^^^^^^ future returned by `foo` is not `Send`
+ |
+ = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
+note: future is not `Send` as it awaits another future which is not `Send`
+ --> $DIR/basic.rs:16:5
+ |
+LL | T::method().await?;
+ | ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send`
+note: required by a bound in `is_send`
+ --> $DIR/basic.rs:20:20
+ |
+LL | fn is_send(_: impl Send) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.rs b/tests/ui/associated-type-bounds/return-type-notation/basic.rs
index edc6a8e4c..d443c9dc1 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.rs
@@ -1,6 +1,9 @@
-// revisions: with without
+// revisions: current_with current_without next_with next_without
+// [next_with] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// [next_without] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// edition: 2021
-//[with] check-pass
+// [current_with] check-pass
+// [next_with] check-pass
#![feature(return_type_notation, async_fn_in_trait)]
//~^ WARN the feature `return_type_notation` is incomplete
@@ -17,11 +20,12 @@ async fn foo<T: Foo>() -> Result<(), ()> {
fn is_send(_: impl Send) {}
fn test<
- #[cfg(with)] T: Foo<method(): Send>,
- #[cfg(without)] T: Foo,
+ #[cfg(any(current_with, next_with))] T: Foo<method(): Send>,
+ #[cfg(any(current_without, next_without))] T: Foo,
>() {
is_send(foo::<T>());
- //[without]~^ ERROR future cannot be sent between threads safely
+ //[current_without]~^ ERROR future cannot be sent between threads safely
+ //[next_without]~^^ ERROR future cannot be sent between threads safely
}
fn main() {}
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr
index 490bfdc4c..b631dd0eb 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr
@@ -1,5 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/equality.rs:3:12
+ --> $DIR/equality.rs:5:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(return_type_notation, async_fn_in_trait)]
= note: `#[warn(incomplete_features)]` on by default
error: return type notation is not allowed to use type equality
- --> $DIR/equality.rs:12:18
+ --> $DIR/equality.rs:14:18
|
LL | fn test<T: Trait<method() = Box<dyn Future<Output = ()>>>>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr
new file mode 100644
index 000000000..b631dd0eb
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr
@@ -0,0 +1,17 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/equality.rs:5:12
+ |
+LL | #![feature(return_type_notation, async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: return type notation is not allowed to use type equality
+ --> $DIR/equality.rs:14:18
+ |
+LL | fn test<T: Trait<method() = Box<dyn Future<Output = ()>>>>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.rs b/tests/ui/associated-type-bounds/return-type-notation/equality.rs
index 6884305d7..0d6545cc2 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.rs
@@ -1,4 +1,6 @@
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(return_type_notation, async_fn_in_trait)]
//~^ WARN the feature `return_type_notation` is incomplete
diff --git a/tests/ui/associated-type-bounds/rpit.rs b/tests/ui/associated-type-bounds/rpit.rs
index 47cadf331..59c7733fb 100644
--- a/tests/ui/associated-type-bounds/rpit.rs
+++ b/tests/ui/associated-type-bounds/rpit.rs
@@ -57,8 +57,8 @@ fn def_et4() -> impl Tr1<As1: for<'a> Tr2<'a>> {
pub fn use_et4() { assert_forall_tr2(def_et4().mk()); }
fn main() {
- let _ = use_et1();
- let _ = use_et2();
- let _ = use_et3();
- let _ = use_et4();
+ use_et1();
+ use_et2();
+ use_et3();
+ use_et4();
}
diff --git a/tests/ui/associated-type-bounds/trait-alias-impl-trait.rs b/tests/ui/associated-type-bounds/trait-alias-impl-trait.rs
index e223a8957..93a44c01c 100644
--- a/tests/ui/associated-type-bounds/trait-alias-impl-trait.rs
+++ b/tests/ui/associated-type-bounds/trait-alias-impl-trait.rs
@@ -89,8 +89,8 @@ pub fn use_et4() {
}
fn main() {
- let _ = use_et1();
- let _ = use_et2();
- let _ = use_et3();
- let _ = use_et4();
+ use_et1();
+ use_et2();
+ use_et3();
+ use_et4();
}