summaryrefslogtreecommitdiffstats
path: root/tests/ui/dyn-star
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /tests/ui/dyn-star
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/dyn-star')
-rw-r--r--tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.current.stderr (renamed from tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr)2
-rw-r--r--tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.next.stderr15
-rw-r--r--tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs3
-rw-r--r--tests/ui/dyn-star/param-env-infer.current.stderr18
-rw-r--r--tests/ui/dyn-star/param-env-infer.next.stderr73
-rw-r--r--tests/ui/dyn-star/param-env-infer.rs17
6 files changed, 127 insertions, 1 deletions
diff --git a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.current.stderr
index 8726fae79..ba42f619a 100644
--- a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr
+++ b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.current.stderr
@@ -1,5 +1,5 @@
error[E0277]: `&T` needs to have the same ABI as a pointer
- --> $DIR/check-size-at-cast-polymorphic-bad.rs:11:15
+ --> $DIR/check-size-at-cast-polymorphic-bad.rs:14:15
|
LL | dyn_debug(t);
| ^ `&T` needs to be a pointer-like type
diff --git a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.next.stderr b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.next.stderr
new file mode 100644
index 000000000..ba42f619a
--- /dev/null
+++ b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.next.stderr
@@ -0,0 +1,15 @@
+error[E0277]: `&T` needs to have the same ABI as a pointer
+ --> $DIR/check-size-at-cast-polymorphic-bad.rs:14:15
+ |
+LL | dyn_debug(t);
+ | ^ `&T` needs to be a pointer-like type
+ |
+ = help: the trait `PointerLike` is not implemented for `&T`
+help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
+ |
+LL | fn polymorphic<T: Debug + ?Sized>(t: &T) where &T: PointerLike {
+ | +++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs
index 913c2faac..9846f8714 100644
--- a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs
+++ b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs
@@ -1,3 +1,6 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
#![feature(dyn_star)]
#![allow(incomplete_features)]
diff --git a/tests/ui/dyn-star/param-env-infer.current.stderr b/tests/ui/dyn-star/param-env-infer.current.stderr
new file mode 100644
index 000000000..b3af7be79
--- /dev/null
+++ b/tests/ui/dyn-star/param-env-infer.current.stderr
@@ -0,0 +1,18 @@
+warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/param-env-infer.rs:5:12
+ |
+LL | #![feature(dyn_star, pointer_like_trait)]
+ | ^^^^^^^^
+ |
+ = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0282]: type annotations needed
+ --> $DIR/param-env-infer.rs:13:10
+ |
+LL | t as _
+ | ^ cannot infer type
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/dyn-star/param-env-infer.next.stderr b/tests/ui/dyn-star/param-env-infer.next.stderr
new file mode 100644
index 000000000..64d76bb04
--- /dev/null
+++ b/tests/ui/dyn-star/param-env-infer.next.stderr
@@ -0,0 +1,73 @@
+warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/param-env-infer.rs:5:12
+ |
+LL | #![feature(dyn_star, pointer_like_trait)]
+ | ^^^^^^^^
+ |
+ = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0391]: cycle detected when computing type of `make_dyn_star::{opaque#0}`
+ --> $DIR/param-env-infer.rs:11:60
+ |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: ...which requires borrow-checking `make_dyn_star`...
+ --> $DIR/param-env-infer.rs:11:1
+ |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires promoting constants in MIR for `make_dyn_star`...
+ --> $DIR/param-env-infer.rs:11:1
+ |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires preparing `make_dyn_star` for borrow checking...
+ --> $DIR/param-env-infer.rs:11:1
+ |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires unsafety-checking `make_dyn_star`...
+ --> $DIR/param-env-infer.rs:11:1
+ |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires building MIR for `make_dyn_star`...
+ --> $DIR/param-env-infer.rs:11:1
+ |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires match-checking `make_dyn_star`...
+ --> $DIR/param-env-infer.rs:11:1
+ |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires building THIR for `make_dyn_star`...
+ --> $DIR/param-env-infer.rs:11:1
+ |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires type-checking `make_dyn_star`...
+ --> $DIR/param-env-infer.rs:11:1
+ |
+LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: ...which requires computing layout of `make_dyn_star::{opaque#0}`...
+ = note: ...which requires normalizing `make_dyn_star::{opaque#0}`...
+ = note: ...which again requires computing type of `make_dyn_star::{opaque#0}`, completing the cycle
+note: cycle used when checking item types in top-level module
+ --> $DIR/param-env-infer.rs:5:1
+ |
+LL | / #![feature(dyn_star, pointer_like_trait)]
+LL | |
+LL | |
+LL | | use std::fmt::Debug;
+... |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/dyn-star/param-env-infer.rs b/tests/ui/dyn-star/param-env-infer.rs
new file mode 100644
index 000000000..1fb16d768
--- /dev/null
+++ b/tests/ui/dyn-star/param-env-infer.rs
@@ -0,0 +1,17 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+// incremental
+
+#![feature(dyn_star, pointer_like_trait)]
+//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
+
+use std::fmt::Debug;
+use std::marker::PointerLike;
+
+fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
+ //[next]~^ ERROR cycle detected when computing type of `make_dyn_star::{opaque#0}`
+ t as _
+ //[current]~^ ERROR type annotations needed
+}
+
+fn main() {}