Sfoglia il codice sorgente

Try testing MinGW targets

Alex Crichton 7 anni fa
parent
commit
d513c92b01
2 ha cambiato i file con 35 aggiunte e 14 eliminazioni
  1. 19 2
      appveyor.yml
  2. 16 12
      examples/intrinsics.rs

+ 19 - 2
appveyor.yml

@@ -3,12 +3,29 @@ environment:
     - TARGET: i686-pc-windows-msvc
     - TARGET: x86_64-pc-windows-msvc
 
+    # Ensure MinGW works, but we need to download the 32-bit MinGW compiler from a
+    # custom location.
+    - TARGET: i686-pc-windows-gnu
+      MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
+      MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
+      MINGW_DIR: mingw32
+    - TARGET: x86_64-pc-windows-gnu
+      MSYS_BITS: 64
+
 install:
   - git submodule update --init
   - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
   - rustup-init.exe --default-host x86_64-pc-windows-msvc --default-toolchain nightly -y
-  - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
-  - if "%TARGET%"=="i686-pc-windows-msvc" ( rustup target add %TARGET% )
+  - if NOT "%TARGET%" == "x86_64-pc-windows-msvc" rustup target add %TARGET%
+
+  # Use the system msys if we can
+  - if defined MSYS_BITS set PATH=C:\msys64\mingw%MSYS_BITS%\bin;C:\msys64\usr\bin;%PATH%
+
+  # download a custom compiler otherwise
+  - if defined MINGW_URL appveyor DownloadFile %MINGW_URL%/%MINGW_ARCHIVE%
+  - if defined MINGW_URL 7z x -y %MINGW_ARCHIVE% > nul
+  - if defined MINGW_URL set PATH=C:\Python27;%CD%\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH%
+
   - rustc -Vv
   - cargo -V
 

+ 16 - 12
examples/intrinsics.rs

@@ -12,12 +12,14 @@
 #![feature(core_float)]
 #![feature(lang_items)]
 #![feature(start)]
+#![feature(panic_unwind)]
 #![feature(i128_type)]
 #![no_std]
 
 #[cfg(not(thumb))]
 extern crate alloc_system;
 extern crate compiler_builtins;
+extern crate panic_unwind;
 
 // NOTE cfg(not(thumbv6m)) means that the operation is not supported on ARMv6-M at all. Not even
 // compiler-rt provides a C/assembly implementation.
@@ -400,6 +402,20 @@ fn run() {
     bb(umodti3(bb(2), bb(2)));
     bb(divti3(bb(2), bb(2)));
     bb(modti3(bb(2), bb(2)));
+
+    something_with_a_dtor(&|| assert_eq!(bb(1), 1));
+}
+
+fn something_with_a_dtor(f: &Fn()) {
+    struct A<'a>(&'a (Fn() + 'a));
+
+    impl<'a> Drop for A<'a> {
+        fn drop(&mut self) {
+            (self.0)();
+        }
+    }
+    let _a = A(f);
+    f();
 }
 
 #[cfg(not(thumb))]
@@ -428,18 +444,6 @@ pub fn __aeabi_unwind_cpp_pr0() {}
 #[no_mangle]
 pub fn __aeabi_unwind_cpp_pr1() {}
 
-// Avoid "undefined reference to `_Unwind_Resume`" errors
-#[allow(non_snake_case)]
-#[no_mangle]
-pub fn _Unwind_Resume() {}
-
-// Lang items
-#[cfg(not(test))]
-#[lang = "eh_personality"]
-#[no_mangle]
-#[allow(private_no_mangle_fns)]
-extern "C" fn eh_personality() {}
-
 #[cfg(not(test))]
 #[lang = "panic_fmt"]
 #[no_mangle]