]> git.lizzy.rs Git - rust.git/commitdiff
rustup
authorRalf Jung <post@ralfj.de>
Wed, 20 Apr 2022 21:41:09 +0000 (17:41 -0400)
committerRalf Jung <post@ralfj.de>
Wed, 20 Apr 2022 21:46:31 +0000 (17:46 -0400)
rust-version
tests/compile-fail/never_transmute_void.rs
tests/run-pass/async-fn.rs

index fa9ce8aca882e5502b8552cbcb5d6b4b600a9e6f..7cc913cf8679b4c89ea6aaf100549756b4cea6f3 100644 (file)
@@ -1 +1 @@
-27af5175497936ea3413bef5816e7c0172514b9c
+51ea9bb29b07d76c5a7167d054b54f4eb7f5b44e
index 5e9e2ac204ea1a9077ce1daa3ffa96f9c3bd4539..e5aa04dfec1af9f42043842fe6c8584cb61e3f52 100644 (file)
@@ -4,15 +4,18 @@
 #![feature(never_type)]
 #![allow(unused, invalid_value)]
 
-enum Void {}
+mod m {
+    enum VoidI {}
+    pub struct Void(VoidI);
 
-fn f(v: Void) -> ! {
-    match v {} //~ ERROR entering unreachable code
+    pub fn f(v: Void) -> ! {
+        match v.0 {} //~ ERROR entering unreachable code
+    }
 }
 
 fn main() {
-    let v: Void = unsafe {
-        std::mem::transmute::<(), Void>(())
+    let v = unsafe {
+        std::mem::transmute::<(), m::Void>(())
     };
-    f(v); //~ inside `main`
+    m::f(v); //~ inside `main`
 }
index 1602b5638e903eb22b7717529f3d6af1c7be71a3..1d5d9a27cc8a5cae6fd6a11b149e71f8cdce6467 100644 (file)
@@ -29,7 +29,7 @@ fn never() -> Never {
 }
 
 async fn includes_never(crash: bool, x: u32) -> u32 {
-    let mut result = async { x * x }.await;
+    let result = async { x * x }.await;
     if !crash {
         return result;
     }