]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/cast/fat-ptr-cast.rs
New upstream version 1.61.0+dfsg1
[rustc.git] / src / test / ui / cast / fat-ptr-cast.rs
index a0fad583a1645a069f3fbbf0be75dd329ac0a648..b5276dc619bfb4c1835ff99ffae403b9fec0afdc 100644 (file)
@@ -19,6 +19,15 @@ fn main() {
     q as *const [i32]; //~ ERROR cannot cast
 
     // #21397
-    let t: *mut (dyn Trait + 'static) = 0 as *mut _; //~ ERROR casting
-    let mut fail: *const str = 0 as *const str; //~ ERROR casting
+    let t: *mut (dyn Trait + 'static) = 0 as *mut _;
+    //~^ ERROR cannot cast `usize` to a pointer that is wide
+    let mut fail: *const str = 0 as *const str;
+    //~^ ERROR cannot cast `usize` to a pointer that is wide
+    let mut fail2: *const str = 0isize as *const str;
+    //~^ ERROR cannot cast `isize` to a pointer that is wide
+}
+
+fn foo<T: ?Sized>() {
+    let s = 0 as *const T;
+    //~^ ERROR cannot cast `usize` to a pointer that may be wide
 }