about summary refs log tree commit diff
path: root/tests/mir-opt/building/enum_cast.unsigny.built.after.mir
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2023-05-14 22:29:26 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2023-05-18 10:28:36 -0700
commit400866b7ab74cb9a4e705e0c4536a8b8130eb59e (patch)
treed6135528b235d767d0b317fc8ce57c46941f29b0 /tests/mir-opt/building/enum_cast.unsigny.built.after.mir
parentc2ccc855e74aec03e434405eca3c247ee2432e53 (diff)
downloadrust-400866b7ab74cb9a4e705e0c4536a8b8130eb59e.tar.gz
rust-400866b7ab74cb9a4e705e0c4536a8b8130eb59e.zip
Also assume wrap-around discriminants in `as` MIR building
Resolves this FIXME:

https://github.com/rust-lang/rust/blob/8d18c32b61476ed16dd15074e71be3970368d6d7/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs#L231
Diffstat (limited to 'tests/mir-opt/building/enum_cast.unsigny.built.after.mir')
-rw-r--r--tests/mir-opt/building/enum_cast.unsigny.built.after.mir17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/mir-opt/building/enum_cast.unsigny.built.after.mir b/tests/mir-opt/building/enum_cast.unsigny.built.after.mir
new file mode 100644
index 00000000000..7ca147b1596
--- /dev/null
+++ b/tests/mir-opt/building/enum_cast.unsigny.built.after.mir
@@ -0,0 +1,17 @@
+// MIR for `unsigny` after built
+
+fn unsigny(_1: UnsignedAroundZero) -> u16 {
+    debug x => _1;                       // in scope 0 at $DIR/enum_cast.rs:+0:12: +0:13
+    let mut _0: u16;                     // return place in scope 0 at $DIR/enum_cast.rs:+0:38: +0:41
+    let _2: UnsignedAroundZero;          // in scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
+    let mut _3: u16;                     // in scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
+
+    bb0: {
+        StorageLive(_2);                 // scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
+        _2 = move _1;                    // scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
+        _3 = discriminant(_2);           // scope 0 at $DIR/enum_cast.rs:+2:5: +2:13
+        _0 = move _3 as u16 (IntToInt);  // scope 0 at $DIR/enum_cast.rs:+2:5: +2:13
+        StorageDead(_2);                 // scope 0 at $DIR/enum_cast.rs:+2:12: +2:13
+        return;                          // scope 0 at $DIR/enum_cast.rs:+3:2: +3:2
+    }
+}