about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--mk/tests.mk2
-rw-r--r--src/test/auxiliary/extern-take-value.rs15
-rw-r--r--src/test/auxiliary/fn-abi.rs12
-rw-r--r--src/test/run-fail/mir_trans_calls_converging_drops.rs3
-rw-r--r--src/test/run-fail/mir_trans_calls_converging_drops_2.rs3
-rw-r--r--src/test/run-fail/mir_trans_calls_diverging_drops.rs4
-rw-r--r--src/test/run-make/execution-engine/test.rs6
-rw-r--r--src/test/run-make/extern-fn-with-union/Makefile2
-rw-r--r--src/test/run-make/extern-fn-with-union/ctest.c (renamed from src/test/run-make/extern-fn-with-union/test.c)0
-rw-r--r--src/test/run-make/extern-fn-with-union/testcrate.rs5
-rw-r--r--src/test/run-make/tools.mk5
-rw-r--r--src/test/run-pass/backtrace-debuginfo.rs16
-rw-r--r--src/test/run-pass/extern-take-value.rs13
-rw-r--r--src/test/run-pass/fn-abi.rs10
-rw-r--r--src/test/run-pass/intrinsics-math.rs111
15 files changed, 105 insertions, 102 deletions
diff --git a/mk/tests.mk b/mk/tests.mk
index b3f7278ad62..31aa2fff247 100644
--- a/mk/tests.mk
+++ b/mk/tests.mk
@@ -1030,6 +1030,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
 	export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
 $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
+	export MSVC_LIB := "$$(CFG_MSVC_LIB_$$(HOST_$(3)))"
+$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
 		$(S)src/test/run-make/%/Makefile \
 		$$(CSREQ$(1)_T_$(2)_H_$(3))
 	@rm -rf $(3)/test/run-make/$$*
diff --git a/src/test/auxiliary/extern-take-value.rs b/src/test/auxiliary/extern-take-value.rs
new file mode 100644
index 00000000000..500c455136b
--- /dev/null
+++ b/src/test/auxiliary/extern-take-value.rs
@@ -0,0 +1,15 @@
+// Copyright 2012 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.
+
+pub extern fn f() -> i32 { 1 }
+pub extern fn g() -> i32 { 2 }
+
+pub fn get_f() -> extern fn() -> i32 { f }
+pub fn get_g() -> extern fn() -> i32 { g }
diff --git a/src/test/auxiliary/fn-abi.rs b/src/test/auxiliary/fn-abi.rs
new file mode 100644
index 00000000000..5d380ea6a5a
--- /dev/null
+++ b/src/test/auxiliary/fn-abi.rs
@@ -0,0 +1,12 @@
+// Copyright 2015 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.
+
+#[no_mangle]
+pub extern fn foo() {}
diff --git a/src/test/run-fail/mir_trans_calls_converging_drops.rs b/src/test/run-fail/mir_trans_calls_converging_drops.rs
index 754f616cfd5..eb399e07d85 100644
--- a/src/test/run-fail/mir_trans_calls_converging_drops.rs
+++ b/src/test/run-fail/mir_trans_calls_converging_drops.rs
@@ -7,7 +7,10 @@
 // <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(rustc_attrs)]
+
+// ignore-msvc: FIXME(#30941)
 // error-pattern:converging_fn called
 // error-pattern:0 dropped
 // error-pattern:exit
diff --git a/src/test/run-fail/mir_trans_calls_converging_drops_2.rs b/src/test/run-fail/mir_trans_calls_converging_drops_2.rs
index 5e870be3bc6..df4ead387b9 100644
--- a/src/test/run-fail/mir_trans_calls_converging_drops_2.rs
+++ b/src/test/run-fail/mir_trans_calls_converging_drops_2.rs
@@ -7,7 +7,10 @@
 // <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(rustc_attrs)]
+
+// ignore-msvc: FIXME(#30941)
 // error-pattern:complex called
 // error-pattern:dropped
 // error-pattern:exit
diff --git a/src/test/run-fail/mir_trans_calls_diverging_drops.rs b/src/test/run-fail/mir_trans_calls_diverging_drops.rs
index ffa1ff08277..cbe8793cceb 100644
--- a/src/test/run-fail/mir_trans_calls_diverging_drops.rs
+++ b/src/test/run-fail/mir_trans_calls_diverging_drops.rs
@@ -7,9 +7,13 @@
 // <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(rustc_attrs)]
+
+// ignore-msvc: FIXME(#30941)
 // error-pattern:diverging_fn called
 // error-pattern:0 dropped
+
 use std::io::{self, Write};
 
 struct Droppable(u8);
diff --git a/src/test/run-make/execution-engine/test.rs b/src/test/run-make/execution-engine/test.rs
index fe6a5faf932..c4d28223c1a 100644
--- a/src/test/run-make/execution-engine/test.rs
+++ b/src/test/run-make/execution-engine/test.rs
@@ -42,6 +42,12 @@ use syntax::diagnostics::registry::Registry;
 use syntax::parse::token;
 
 fn main() {
+    // Currently trips an assertion on i686-msvc, presumably because the support
+    // in LLVM is a little young.
+    if cfg!(target_env = "msvc") && cfg!(target_arch = "x86") {
+        return
+    }
+
     let program = r#"
     #[no_mangle]
     pub static TEST_STATIC: i32 = 42;
diff --git a/src/test/run-make/extern-fn-with-union/Makefile b/src/test/run-make/extern-fn-with-union/Makefile
index cf897dba1f2..71a5407e882 100644
--- a/src/test/run-make/extern-fn-with-union/Makefile
+++ b/src/test/run-make/extern-fn-with-union/Makefile
@@ -1,6 +1,6 @@
 -include ../tools.mk
 
-all: $(call NATIVE_STATICLIB,test)
+all: $(call NATIVE_STATICLIB,ctest)
 	$(RUSTC) testcrate.rs
 	$(RUSTC) test.rs
 	$(call RUN,test) || exit 1
diff --git a/src/test/run-make/extern-fn-with-union/test.c b/src/test/run-make/extern-fn-with-union/ctest.c
index 8c87c230693..8c87c230693 100644
--- a/src/test/run-make/extern-fn-with-union/test.c
+++ b/src/test/run-make/extern-fn-with-union/ctest.c
diff --git a/src/test/run-make/extern-fn-with-union/testcrate.rs b/src/test/run-make/extern-fn-with-union/testcrate.rs
index ebd62d902df..66978c38511 100644
--- a/src/test/run-make/extern-fn-with-union/testcrate.rs
+++ b/src/test/run-make/extern-fn-with-union/testcrate.rs
@@ -10,11 +10,12 @@
 
 #![crate_type = "lib"]
 
+#[repr(C)]
 pub struct TestUnion {
-    val: u64
+    _val: u64
 }
 
-#[link(name = "test", kind = "static")]
+#[link(name = "ctest", kind = "static")]
 extern {
     pub fn give_back(tu: TestUnion) -> u64;
 }
diff --git a/src/test/run-make/tools.mk b/src/test/run-make/tools.mk
index efaf1197fbd..8be34ce4274 100644
--- a/src/test/run-make/tools.mk
+++ b/src/test/run-make/tools.mk
@@ -100,8 +100,13 @@ REMOVE_RLIBS      = rm $(TMPDIR)/$(call RLIB_GLOB,$(1))
 
 %.a: %.o
 	ar crus $@ $<
+ifdef IS_MSVC
+%.lib: lib%.o
+	$(MSVC_LIB) -out:`cygpath -w $@` $<
+else
 %.lib: lib%.o
 	ar crus $@ $<
+endif
 %.dylib: %.o
 	$(CC) -dynamiclib -Wl,-dylib -o $@ $<
 %.so: %.o
diff --git a/src/test/run-pass/backtrace-debuginfo.rs b/src/test/run-pass/backtrace-debuginfo.rs
index b6400c68f53..a8eade34cbc 100644
--- a/src/test/run-pass/backtrace-debuginfo.rs
+++ b/src/test/run-pass/backtrace-debuginfo.rs
@@ -27,12 +27,11 @@ macro_rules! pos {
     () => ((file!(), line!()))
 }
 
-#[cfg(any(all(unix,
-              not(target_os = "macos"),
-              not(target_os = "ios"),
-              not(target_os = "android"),
-              not(all(target_os = "linux", target_arch = "arm"))),
-          all(windows, not(target_arch = "x86"))))]
+#[cfg(all(unix,
+          not(target_os = "macos"),
+          not(target_os = "ios"),
+          not(target_os = "android"),
+          not(all(target_os = "linux", target_arch = "arm"))))]
 macro_rules! dump_and_die {
     ($($pos:expr),*) => ({
         // FIXME(#18285): we cannot include the current position because
@@ -43,12 +42,11 @@ macro_rules! dump_and_die {
 }
 
 // this does not work on Windows, Android, OSX or iOS
-#[cfg(not(any(all(unix,
+#[cfg(not(all(unix,
               not(target_os = "macos"),
               not(target_os = "ios"),
               not(target_os = "android"),
-              not(all(target_os = "linux", target_arch = "arm"))),
-          all(windows, not(target_arch = "x86")))))]
+              not(all(target_os = "linux", target_arch = "arm")))))]
 macro_rules! dump_and_die {
     ($($pos:expr),*) => ({ let _ = [$($pos),*]; })
 }
diff --git a/src/test/run-pass/extern-take-value.rs b/src/test/run-pass/extern-take-value.rs
index 7ef87b9409d..f535e45e6cf 100644
--- a/src/test/run-pass/extern-take-value.rs
+++ b/src/test/run-pass/extern-take-value.rs
@@ -8,17 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// aux-build:extern-take-value.rs
 
-extern fn f() {
-}
-
-extern fn g() {
-}
+extern crate extern_take_value;
 
 pub fn main() {
-    let a: extern "C" fn() = f;
-    let b: extern "C" fn() = f;
-    let c: extern "C" fn() = g;
+    let a: extern "C" fn() -> i32 = extern_take_value::get_f();
+    let b: extern "C" fn() -> i32 = extern_take_value::get_f();
+    let c: extern "C" fn() -> i32 = extern_take_value::get_g();
 
     assert!(a == b);
     assert!(a != c);
diff --git a/src/test/run-pass/fn-abi.rs b/src/test/run-pass/fn-abi.rs
index 521ed6db65b..0e3005a2aaa 100644
--- a/src/test/run-pass/fn-abi.rs
+++ b/src/test/run-pass/fn-abi.rs
@@ -12,12 +12,16 @@
 // ABI (#9309).
 
 // pretty-expanded FIXME #23616
+// aux-build:fn-abi.rs
+
+extern crate fn_abi;
 
 extern {
-    fn printf();
+    fn foo();
 }
 
 pub fn main() {
-    // Will only type check if the type of _p and the decl of printf use the same ABI
-    let _p: unsafe extern fn() = printf;
+    // Will only type check if the type of _p and the decl of foo use the
+    // same ABI
+    let _p: unsafe extern fn() = foo;
 }
diff --git a/src/test/run-pass/intrinsics-math.rs b/src/test/run-pass/intrinsics-math.rs
index f547519b671..a2c55634749 100644
--- a/src/test/run-pass/intrinsics-math.rs
+++ b/src/test/run-pass/intrinsics-math.rs
@@ -8,9 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-#![feature(intrinsics, core)]
-
 macro_rules! assert_approx_eq {
     ($a:expr, $b:expr) => ({
         let (a, b) = (&$a, &$b);
@@ -19,96 +16,52 @@ macro_rules! assert_approx_eq {
     })
 }
 
-mod rusti {
-    extern "rust-intrinsic" {
-        pub fn sqrtf32(x: f32) -> f32;
-        pub fn sqrtf64(x: f64) -> f64;
-        pub fn powif32(a: f32, x: i32) -> f32;
-        pub fn powif64(a: f64, x: i32) -> f64;
-        pub fn sinf32(x: f32) -> f32;
-        pub fn sinf64(x: f64) -> f64;
-        pub fn cosf32(x: f32) -> f32;
-        pub fn cosf64(x: f64) -> f64;
-        pub fn powf32(a: f32, x: f32) -> f32;
-        pub fn powf64(a: f64, x: f64) -> f64;
-        pub fn expf32(x: f32) -> f32;
-        pub fn expf64(x: f64) -> f64;
-        pub fn exp2f32(x: f32) -> f32;
-        pub fn exp2f64(x: f64) -> f64;
-        pub fn logf32(x: f32) -> f32;
-        pub fn logf64(x: f64) -> f64;
-        pub fn log10f32(x: f32) -> f32;
-        pub fn log10f64(x: f64) -> f64;
-        pub fn log2f32(x: f32) -> f32;
-        pub fn log2f64(x: f64) -> f64;
-        pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
-        pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
-        pub fn fabsf32(x: f32) -> f32;
-        pub fn fabsf64(x: f64) -> f64;
-        pub fn floorf32(x: f32) -> f32;
-        pub fn floorf64(x: f64) -> f64;
-        pub fn ceilf32(x: f32) -> f32;
-        pub fn ceilf64(x: f64) -> f64;
-        pub fn truncf32(x: f32) -> f32;
-        pub fn truncf64(x: f64) -> f64;
-    }
-}
-
 pub fn main() {
-    unsafe {
-        use rusti::*;
-
-        use std::f32;
-        use std::f64;
-
-        assert_approx_eq!(sqrtf32(64f32), 8f32);
-        assert_approx_eq!(sqrtf64(64f64), 8f64);
+    use std::f32;
+    use std::f64;
 
-        assert_approx_eq!(powif32(25f32, -2), 0.0016f32);
-        assert_approx_eq!(powif64(23.2f64, 2), 538.24f64);
+    assert_approx_eq!(64f32.sqrt(), 8f32);
+    assert_approx_eq!(64f64.sqrt(), 8f64);
 
-        assert_approx_eq!(sinf32(0f32), 0f32);
-        assert_approx_eq!(sinf64(f64::consts::PI / 2f64), 1f64);
+    assert_approx_eq!(25f32.powi(-2), 0.0016f32);
+    assert_approx_eq!(23.2f64.powi(2), 538.24f64);
 
-        assert_approx_eq!(cosf32(0f32), 1f32);
-        assert_approx_eq!(cosf64(f64::consts::PI * 2f64), 1f64);
+    assert_approx_eq!(0f32.sin(), 0f32);
+    assert_approx_eq!((f64::consts::PI / 2f64).sin(), 1f64);
 
-        assert_approx_eq!(powf32(25f32, -2f32), 0.0016f32);
-        assert_approx_eq!(powf64(400f64, 0.5f64), 20f64);
+    assert_approx_eq!(0f32.cos(), 1f32);
+    assert_approx_eq!((f64::consts::PI * 2f64).cos(), 1f64);
 
-        assert_approx_eq!(fabsf32(expf32(1f32) - f32::consts::E), 0f32);
-        assert_approx_eq!(expf64(1f64), f64::consts::E);
+    assert_approx_eq!(25f32.powf(-2f32), 0.0016f32);
+    assert_approx_eq!(400f64.powf(0.5f64), 20f64);
 
-        assert_approx_eq!(exp2f32(10f32), 1024f32);
-        assert_approx_eq!(exp2f64(50f64), 1125899906842624f64);
+    assert_approx_eq!((1f32.exp() - f32::consts::E).abs(), 0f32);
+    assert_approx_eq!(1f64.exp(), f64::consts::E);
 
-        assert_approx_eq!(fabsf32(logf32(f32::consts::E) - 1f32), 0f32);
-        assert_approx_eq!(logf64(1f64), 0f64);
+    assert_approx_eq!(10f32.exp2(), 1024f32);
+    assert_approx_eq!(50f64.exp2(), 1125899906842624f64);
 
-        assert_approx_eq!(log10f32(10f32), 1f32);
-        assert_approx_eq!(log10f64(f64::consts::E), f64::consts::LOG10_E);
+    assert_approx_eq!((f32::consts::E.ln() - 1f32).abs(), 0f32);
+    assert_approx_eq!(1f64.ln(), 0f64);
 
-        assert_approx_eq!(log2f32(8f32), 3f32);
-        assert_approx_eq!(log2f64(f64::consts::E), f64::consts::LOG2_E);
+    assert_approx_eq!(10f32.log10(), 1f32);
+    assert_approx_eq!(f64::consts::E.log10(), f64::consts::LOG10_E);
 
-        assert_approx_eq!(fmaf32(1.0f32, 2.0f32, 5.0f32), 7.0f32);
-        assert_approx_eq!(fmaf64(0.0f64, -2.0f64, f64::consts::E), f64::consts::E);
+    assert_approx_eq!(8f32.log2(), 3f32);
+    assert_approx_eq!(f64::consts::E.log2(), f64::consts::LOG2_E);
 
-        assert_approx_eq!(fabsf32(-1.0f32), 1.0f32);
-        assert_approx_eq!(fabsf64(34.2f64), 34.2f64);
+    assert_approx_eq!(1.0f32.mul_add(2.0f32, 5.0f32), 7.0f32);
+    assert_approx_eq!(0.0f64.mul_add(-2.0f64, f64::consts::E), f64::consts::E);
 
-        assert_approx_eq!(floorf32(3.8f32), 3.0f32);
-        assert_approx_eq!(floorf64(-1.1f64), -2.0f64);
+    assert_approx_eq!((-1.0f32).abs(), 1.0f32);
+    assert_approx_eq!(34.2f64.abs(), 34.2f64);
 
-        // Causes linker error
-        // undefined reference to llvm.ceil.f32/64
-        //assert_eq!(ceilf32(-2.3f32), -2.0f32);
-        //assert_eq!(ceilf64(3.8f64), 4.0f64);
+    assert_approx_eq!(3.8f32.floor(), 3.0f32);
+    assert_approx_eq!((-1.1f64).floor(), -2.0f64);
 
-        // Causes linker error
-        // undefined reference to llvm.trunc.f32/64
-        //assert_eq!(truncf32(0.1f32), 0.0f32);
-        //assert_eq!(truncf64(-0.1f64), 0.0f64);
-    }
+    assert_approx_eq!((-2.3f32).ceil(), -2.0f32);
+    assert_approx_eq!(3.8f64.ceil(), 4.0f64);
 
+    assert_approx_eq!(0.1f32.trunc(), 0.0f32);
+    assert_approx_eq!((-0.1f64).trunc(), 0.0f64);
 }