about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2017-01-05 02:33:09 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2017-01-05 02:33:09 +0200
commit8f84e955e006dd9e116f69eaba6efbbcd2e3ca8a (patch)
treefdbde6930700b2db5ebbda95a2617503668a6ba1 /src/test
parent05f4a75ebaccdf3646fbea4b560a3a0dfc1be9e2 (diff)
downloadrust-8f84e955e006dd9e116f69eaba6efbbcd2e3ca8a.tar.gz
rust-8f84e955e006dd9e116f69eaba6efbbcd2e3ca8a.zip
Allow projections to be promoted to constants in MIR.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/issue-38074.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-38074.rs b/src/test/run-pass/issue-38074.rs
new file mode 100644
index 00000000000..5c9a63b8616
--- /dev/null
+++ b/src/test/run-pass/issue-38074.rs
@@ -0,0 +1,27 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(platform_intrinsics, repr_simd)]
+
+extern "platform-intrinsic" {
+    fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
+}
+
+#[repr(simd)]
+#[derive(Clone, Copy)]
+#[allow(non_camel_case_types)]
+struct u64x2(u64, u64);
+
+fn main() {
+    let a = u64x2(1, 2);
+    let r: u64x2 = unsafe { simd_shuffle2(a, a, [0-0, 0-0]) };
+    assert_eq!(r.0, 1);
+    assert_eq!(r.1, 1);
+}