about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.rs36
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.stderr48
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-different-args.rs36
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-different-args.stderr43
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.rs41
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.stderr140
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-wrap.rs32
7 files changed, 0 insertions, 376 deletions
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.rs b/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.rs
deleted file mode 100644
index cfc0a97989d..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Combination of `ptr-to-trait-obj-wrap.rs` and `ptr-to-trait-obj-add-auto.rs`.
-//
-// Checks that you *can't* add auto traits to trait object in pointer casts involving wrapping said
-// traits structures.
-
-trait A {}
-
-struct W<T: ?Sized>(T);
-struct X<T: ?Sized>(T);
-
-fn unwrap(a: *const W<dyn A>) -> *const (dyn A + Send) {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn unwrap_nested(a: *const W<W<dyn A>>) -> *const W<dyn A + Send> {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn rewrap(a: *const W<dyn A>) -> *const X<dyn A + Send> {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn rewrap_nested(a: *const W<W<dyn A>>) -> *const W<X<dyn A + Send>> {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn wrap(a: *const dyn A) -> *const W<dyn A + Send> {
-    a as _
-    //~^ error: cannot add auto trait `Send` to dyn bound via pointer cast
-}
-
-fn main() {}
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.stderr b/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.stderr
deleted file mode 100644
index 42cdbc34ee8..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-add-auto.stderr
+++ /dev/null
@@ -1,48 +0,0 @@
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:12:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:17:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:22:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:27:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error[E0804]: cannot add auto trait `Send` to dyn bound via pointer cast
-  --> $DIR/ptr-to-trait-obj-wrap-add-auto.rs:32:5
-   |
-LL |     a as _
-   |     ^^^^^^ unsupported cast
-   |
-   = note: this could allow UB elsewhere
-   = help: use `transmute` if you're sure this is sound
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0804`.
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.rs b/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.rs
deleted file mode 100644
index ebe7a06a7a1..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Combination of `ptr-to-trait-obj-different-args.rs` and `ptr-to-trait-obj-wrap.rs`.
-//
-// Checks that you *can't* change type arguments of trait objects in pointer casts involving
-// wrapping said traits structures.
-
-trait A<T> {}
-
-struct W<T: ?Sized>(T);
-struct X<T: ?Sized>(T);
-
-fn unwrap<F, G>(a: *const W<dyn A<F>>) -> *const dyn A<G> {
-    a as _
-    //~^ error casting `*const W<(dyn A<F> + 'static)>` as `*const dyn A<G>` is invalid
-}
-
-fn unwrap_nested<F, G>(a: *const W<W<dyn A<F>>>) -> *const W<dyn A<G>> {
-    a as _
-    //~^ error casting `*const W<W<(dyn A<F> + 'static)>>` as `*const W<dyn A<G>>` is invalid
-}
-
-fn rewrap<F, G>(a: *const W<dyn A<F>>) -> *const X<dyn A<G>> {
-    a as _
-    //~^ error: casting `*const W<(dyn A<F> + 'static)>` as `*const X<dyn A<G>>` is invalid
-}
-
-fn rewrap_nested<F, G>(a: *const W<W<dyn A<F>>>) -> *const W<X<dyn A<G>>> {
-    a as _
-    //~^ error: casting `*const W<W<(dyn A<F> + 'static)>>` as `*const W<X<dyn A<G>>>` is invalid
-}
-
-fn wrap<F, G>(a: *const dyn A<F>) -> *const W<dyn A<G>> {
-    a as _
-    //~^ error: casting `*const (dyn A<F> + 'static)` as `*const W<dyn A<G>>` is invalid
-}
-
-fn main() {}
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.stderr b/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.stderr
deleted file mode 100644
index 4f85b208d05..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-different-args.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0606]: casting `*const W<(dyn A<F> + 'static)>` as `*const dyn A<G>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:12:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error[E0606]: casting `*const W<W<(dyn A<F> + 'static)>>` as `*const W<dyn A<G>>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:17:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error[E0606]: casting `*const W<(dyn A<F> + 'static)>` as `*const X<dyn A<G>>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:22:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error[E0606]: casting `*const W<W<(dyn A<F> + 'static)>>` as `*const W<X<dyn A<G>>>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:27:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error[E0606]: casting `*const (dyn A<F> + 'static)` as `*const W<dyn A<G>>` is invalid
-  --> $DIR/ptr-to-trait-obj-wrap-different-args.rs:32:5
-   |
-LL |     a as _
-   |     ^^^^^^
-   |
-   = note: the trait objects may have different vtables
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0606`.
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.rs b/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.rs
deleted file mode 100644
index b0941277d01..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Combination of `ptr-to-trait-obj-different-regions-misc.rs` and `ptr-to-trait-obj-wrap.rs`.
-//
-// Checks that you *can't* change lifetime arguments of trait objects in pointer casts involving
-// wrapping said traits structures.
-
-trait A<'a> {}
-
-struct W<T: ?Sized>(T);
-struct X<T: ?Sized>(T);
-
-fn unwrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const dyn A<'b> {
-    a as _
-    //~^ error
-    //~| error
-}
-
-fn unwrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<dyn A<'b>> {
-    a as _
-    //~^ error
-    //~| error
-}
-
-fn rewrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const X<dyn A<'b>> {
-    a as _
-    //~^ error: lifetime may not live long enough
-    //~| error: lifetime may not live long enough
-}
-
-fn rewrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<X<dyn A<'b>>> {
-    a as _
-    //~^ error: lifetime may not live long enough
-    //~| error: lifetime may not live long enough
-}
-
-fn wrap<'a, 'b>(a: *const dyn A<'a>) -> *const W<dyn A<'b>> {
-    a as _
-    //~^ error: lifetime may not live long enough
-    //~| error: lifetime may not live long enough
-}
-
-fn main() {}
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.stderr b/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.stderr
deleted file mode 100644
index 17a0ca3c34f..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap-different-regions.stderr
+++ /dev/null
@@ -1,140 +0,0 @@
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:12:5
-   |
-LL | fn unwrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const dyn A<'b> {
-   |           --  -- lifetime `'b` defined here
-   |           |
-   |           lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:12:5
-   |
-LL | fn unwrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const dyn A<'b> {
-   |           --  -- lifetime `'b` defined here
-   |           |
-   |           lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
-   |
-   = help: consider adding the following bound: `'a: 'b`
-
-help: `'b` and `'a` must be the same: replace one with the other
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:18:5
-   |
-LL | fn unwrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<dyn A<'b>> {
-   |                  --  -- lifetime `'b` defined here
-   |                  |
-   |                  lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:18:5
-   |
-LL | fn unwrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<dyn A<'b>> {
-   |                  --  -- lifetime `'b` defined here
-   |                  |
-   |                  lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
-   |
-   = help: consider adding the following bound: `'a: 'b`
-
-help: `'b` and `'a` must be the same: replace one with the other
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:24:5
-   |
-LL | fn rewrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const X<dyn A<'b>> {
-   |           --  -- lifetime `'b` defined here
-   |           |
-   |           lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:24:5
-   |
-LL | fn rewrap<'a, 'b>(a: *const W<dyn A<'a>>) -> *const X<dyn A<'b>> {
-   |           --  -- lifetime `'b` defined here
-   |           |
-   |           lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
-   |
-   = help: consider adding the following bound: `'a: 'b`
-
-help: `'b` and `'a` must be the same: replace one with the other
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:30:5
-   |
-LL | fn rewrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<X<dyn A<'b>>> {
-   |                  --  -- lifetime `'b` defined here
-   |                  |
-   |                  lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:30:5
-   |
-LL | fn rewrap_nested<'a, 'b>(a: *const W<W<dyn A<'a>>>) -> *const W<X<dyn A<'b>>> {
-   |                  --  -- lifetime `'b` defined here
-   |                  |
-   |                  lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
-   |
-   = help: consider adding the following bound: `'a: 'b`
-
-help: `'b` and `'a` must be the same: replace one with the other
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:36:5
-   |
-LL | fn wrap<'a, 'b>(a: *const dyn A<'a>) -> *const W<dyn A<'b>> {
-   |         --  -- lifetime `'b` defined here
-   |         |
-   |         lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-wrap-different-regions.rs:36:5
-   |
-LL | fn wrap<'a, 'b>(a: *const dyn A<'a>) -> *const W<dyn A<'b>> {
-   |         --  -- lifetime `'b` defined here
-   |         |
-   |         lifetime `'a` defined here
-LL |     a as _
-   |     ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
-   |
-   = help: consider adding the following bound: `'a: 'b`
-
-help: `'b` and `'a` must be the same: replace one with the other
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: aborting due to 10 previous errors
-
diff --git a/tests/ui/cast/ptr-to-trait-obj-wrap.rs b/tests/ui/cast/ptr-to-trait-obj-wrap.rs
deleted file mode 100644
index 9809ea80f95..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-wrap.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Checks that various casts of pointers to trait objects wrapped in structures
-// work. Note that the metadata doesn't change when a DST is wrapped in a
-// structure, so these casts *are* fine.
-//
-//@ check-pass
-
-trait A {}
-
-struct W<T: ?Sized>(T);
-struct X<T: ?Sized>(T);
-
-fn unwrap(a: *const W<dyn A>) -> *const dyn A {
-    a as _
-}
-
-fn unwrap_nested(a: *const W<W<dyn A>>) -> *const W<dyn A> {
-    a as _
-}
-
-fn rewrap(a: *const W<dyn A>) -> *const X<dyn A> {
-    a as _
-}
-
-fn rewrap_nested(a: *const W<W<dyn A>>) -> *const W<X<dyn A>> {
-    a as _
-}
-
-fn wrap(a: *const dyn A) -> *const W<dyn A> {
-    a as _
-}
-
-fn main() {}