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-ok.rs5
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-ok.stderr24
2 files changed, 1 insertions, 28 deletions
diff --git a/tests/ui/cast/ptr-to-trait-obj-ok.rs b/tests/ui/cast/ptr-to-trait-obj-ok.rs
index f30472667b7..dbeee9d2944 100644
--- a/tests/ui/cast/ptr-to-trait-obj-ok.rs
+++ b/tests/ui/cast/ptr-to-trait-obj-ok.rs
@@ -1,4 +1,4 @@
-//@ check-fail
+//@ check-pass
 
 trait Trait<'a> {}
 
@@ -37,9 +37,6 @@ fn cast_inherent_lt_wrap<'a, 'b>(
 
 fn cast_away_higher_ranked_wrap<'a>(x: *mut dyn for<'b> Trait<'b>) -> *mut Wrapper<dyn Trait<'a>> {
     x as _
-    //~^ error: lifetime may not live long enough
-    //~| error: mismatched types
-    //~| one type is more general than the other
 }
 
 fn unprincipled_wrap<'a, 'b>(x: *mut (dyn Send + 'a)) -> *mut Wrapper<dyn Sync + 'b> {
diff --git a/tests/ui/cast/ptr-to-trait-obj-ok.stderr b/tests/ui/cast/ptr-to-trait-obj-ok.stderr
deleted file mode 100644
index 8de07691c21..00000000000
--- a/tests/ui/cast/ptr-to-trait-obj-ok.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error: lifetime may not live long enough
-  --> $DIR/ptr-to-trait-obj-ok.rs:39:5
-   |
-LL | fn cast_away_higher_ranked_wrap<'a>(x: *mut dyn for<'b> Trait<'b>) -> *mut Wrapper<dyn Trait<'a>> {
-   |                                 -- lifetime `'a` defined here
-LL |     x as _
-   |     ^^^^^^ returning this value requires that `'a` must outlive `'static`
-   |
-   = note: requirement occurs because of a mutable pointer to `Wrapper<dyn Trait<'_>>`
-   = note: mutable pointers are invariant over their type parameter
-   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
-
-error[E0308]: mismatched types
-  --> $DIR/ptr-to-trait-obj-ok.rs:39:5
-   |
-LL |     x as _
-   |     ^^^^^^ one type is more general than the other
-   |
-   = note: expected trait object `dyn for<'b> Trait<'b>`
-              found trait object `dyn Trait<'_>`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.