]> git.lizzy.rs Git - rust.git/commitdiff
test: Use liblibc in lang-item-public
authorAlex Crichton <alex@alexcrichton.com>
Thu, 25 Jun 2015 16:13:30 +0000 (09:13 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 25 Jun 2015 16:33:15 +0000 (09:33 -0700)
Makes this test case more robust by using standard libraries to ensure the
binary can be built.

src/test/auxiliary/lang-item-public.rs
src/test/run-pass/lang-item-public.rs

index d195bd7e77bd8bb9ae335f9ad155f9c816abe413..4b60a370187af15bbb3ea1b05edc1c3aa11fd83f 100644 (file)
@@ -8,15 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(no_std)]
+#![feature(no_std, core, libc)]
 #![no_std]
 #![feature(lang_items)]
 
-#[lang="sized"]
-pub trait Sized { }
-
-#[lang="panic"]
-fn panic(_: &(&'static str, &'static str, usize)) -> ! { loop {} }
+extern crate core;
+extern crate libc;
 
 #[lang = "stack_exhausted"]
 extern fn stack_exhausted() {}
@@ -24,26 +21,8 @@ fn panic(_: &(&'static str, &'static str, usize)) -> ! { loop {} }
 #[lang = "eh_personality"]
 extern fn eh_personality() {}
 
-#[lang="copy"]
-pub trait Copy {
-    // Empty.
-}
-
-#[lang="rem"]
-pub trait Rem<RHS=Self> {
-    type Output = Self;
-    fn rem(self, rhs: RHS) -> Self::Output;
-}
-
-impl Rem for isize {
-    type Output = isize;
-
-    #[inline]
-    fn rem(self, other: isize) -> isize {
-        // if you use `self % other` here, as one would expect, you
-        // get back an error because of potential failure/overflow,
-        // which tries to invoke error fns that don't have the
-        // appropriate signatures anymore. So...just return 0.
-        0
-    }
+#[lang = "panic_fmt"]
+extern fn rust_begin_unwind(msg: core::fmt::Arguments, file: &'static str,
+                            line: u32) -> ! {
+    loop {}
 }
index f5b9bd4fbaa69b800f332b2e333afe0975358c90..57a32ba599f93d0aeda49e41a1bed2f166fe0dd6 100644 (file)
 // aux-build:lang-item-public.rs
 // ignore-android
 
-#![feature(lang_items, start, no_std)]
+#![feature(start, no_std)]
 #![no_std]
 
 extern crate lang_item_public as lang_lib;
 
-#[cfg(target_os = "linux")]
-#[link(name = "c")]
-extern {}
-
-#[cfg(target_os = "android")]
-#[link(name = "c")]
-extern {}
-
-#[cfg(target_os = "freebsd")]
-#[link(name = "execinfo")]
-extern {}
-
-#[cfg(target_os = "freebsd")]
-#[link(name = "c")]
-extern {}
-
-#[cfg(target_os = "dragonfly")]
-#[link(name = "c")]
-extern {}
-
-#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
-#[link(name = "c")]
-extern {}
-
-#[cfg(target_os = "macos")]
-#[link(name = "System")]
-extern {}
-
 #[start]
 fn main(_: isize, _: *const *const u8) -> isize {
     1_isize % 1_isize