aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-3174.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/issue-3174.rs')
-rw-r--r--gcc/testsuite/rust/compile/issue-3174.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-3174.rs b/gcc/testsuite/rust/compile/issue-3174.rs
new file mode 100644
index 0000000..87588e1
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-3174.rs
@@ -0,0 +1,28 @@
+extern "C" {
+ fn printf(s: *const i8, ...);
+}
+
+enum Option {
+ Some(i32),
+ None,
+}
+
+impl Option {
+ fn add(&mut self) {
+ match *self {
+ Option::Some(ref mut a) => *a += 1,
+ Option::None => {}
+ }
+ }
+}
+
+fn main() {
+ unsafe {
+ let mut a = Option::None;
+ a.add();
+ let _s = "%d\n\0";
+ let _s = _s as *const str;
+ let s = _s as *const i8;
+ printf(s, a);
+ }
+}