about summary refs log tree commit diff
path: root/tests/ui/codegen
diff options
context:
space:
mode:
authorJieyou Xu <jieyouxu@outlook.com>2024-12-05 07:32:05 +0000
committer许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-12-10 11:20:19 +0800
commitdd3b313b56f34e21cd79d610cdf4e501a4bb8c4e (patch)
treeb117ef5fd623ddf047c58f3e70aaf41d451ea2a9 /tests/ui/codegen
parent974ccc12e6b4fdf38407258071e3d794d383ce3a (diff)
downloadrust-dd3b313b56f34e21cd79d610cdf4e501a4bb8c4e.tar.gz
rust-dd3b313b56f34e21cd79d610cdf4e501a4bb8c4e.zip
Adjust `alias-uninit-value.rs`
- Document and tidy up `alias-uninit-value.rs`
- Move `alias-uninit-value.rs` to `tests/ui/codegen/`
Diffstat (limited to 'tests/ui/codegen')
-rw-r--r--tests/ui/codegen/alias-uninit-value.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/codegen/alias-uninit-value.rs b/tests/ui/codegen/alias-uninit-value.rs
new file mode 100644
index 00000000000..a8aa94caaf2
--- /dev/null
+++ b/tests/ui/codegen/alias-uninit-value.rs
@@ -0,0 +1,26 @@
+//! Regression test for issue #374, where previously rustc performed conditional jumps or moves that
+//! incorrectly depended on uninitialized values.
+//!
+//! Issue: <https://github.com/rust-lang/rust/issues/374>.
+
+//@ run-pass
+
+#![allow(dead_code)]
+
+enum TyS {
+    Nil,
+}
+
+struct RawT {
+    struct_: TyS,
+    cname: Option<String>,
+    hash: usize,
+}
+
+fn mk_raw_ty(st: TyS, cname: Option<String>) -> RawT {
+    return RawT { struct_: st, cname: cname, hash: 0 };
+}
+
+pub fn main() {
+    mk_raw_ty(TyS::Nil, None::<String>);
+}