Skip to content

Commit dcedbe7

Browse files
committed
Adjust alias-uninit-value.rs
- Document and tidy up `alias-uninit-value.rs` - Move `alias-uninit-value.rs` to `tests/ui/codegen/`
1 parent 974ccc1 commit dcedbe7

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

tests/ui/alias-uninit-value.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! Regression test for issue #374, where previously rustc performed conditional jumps or moves that
2+
//! incorrectly depended on uninitialized values.
3+
//!
4+
//! Issue: <https://github.com/rust-lang/rust/issues/374>.
5+
6+
//@ run-pass
7+
8+
#![allow(non_camel_case_types)]
9+
#![allow(dead_code)]
10+
11+
enum sty {
12+
ty_nil,
13+
}
14+
15+
struct RawT {
16+
struct_: sty,
17+
cname: Option<String>,
18+
hash: usize,
19+
}
20+
21+
fn mk_raw_ty(st: sty, cname: Option<String>) -> RawT {
22+
return RawT { struct_: st, cname: cname, hash: 0 };
23+
}
24+
25+
pub fn main() {
26+
mk_raw_ty(sty::ty_nil, None::<String>);
27+
}

0 commit comments

Comments
 (0)