Skip to content

Commit 759a7f1

Browse files
committed
test: Use liblibc in lang-item-public
Makes this test case more robust by using standard libraries to ensure the binary can be built.
1 parent 9e3cb64 commit 759a7f1

File tree

2 files changed

+8
-57
lines changed

2 files changed

+8
-57
lines changed

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

+7-28
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,21 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(no_std)]
11+
#![feature(no_std, core, libc)]
1212
#![no_std]
1313
#![feature(lang_items)]
1414

15-
#[lang="sized"]
16-
pub trait Sized { }
17-
18-
#[lang="panic"]
19-
fn panic(_: &(&'static str, &'static str, usize)) -> ! { loop {} }
15+
extern crate core;
16+
extern crate libc;
2017

2118
#[lang = "stack_exhausted"]
2219
extern fn stack_exhausted() {}
2320

2421
#[lang = "eh_personality"]
2522
extern fn eh_personality() {}
2623

27-
#[lang="copy"]
28-
pub trait Copy {
29-
// Empty.
30-
}
31-
32-
#[lang="rem"]
33-
pub trait Rem<RHS=Self> {
34-
type Output = Self;
35-
fn rem(self, rhs: RHS) -> Self::Output;
36-
}
37-
38-
impl Rem for isize {
39-
type Output = isize;
40-
41-
#[inline]
42-
fn rem(self, other: isize) -> isize {
43-
// if you use `self % other` here, as one would expect, you
44-
// get back an error because of potential failure/overflow,
45-
// which tries to invoke error fns that don't have the
46-
// appropriate signatures anymore. So...just return 0.
47-
0
48-
}
24+
#[lang = "panic_fmt"]
25+
extern fn rust_begin_unwind(msg: core::fmt::Arguments, file: &'static str,
26+
line: u32) -> ! {
27+
loop {}
4928
}

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

+1-29
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,11 @@
1111
// aux-build:lang-item-public.rs
1212
// ignore-android
1313

14-
#![feature(lang_items, start, no_std)]
14+
#![feature(start, no_std)]
1515
#![no_std]
1616

1717
extern crate lang_item_public as lang_lib;
1818

19-
#[cfg(target_os = "linux")]
20-
#[link(name = "c")]
21-
extern {}
22-
23-
#[cfg(target_os = "android")]
24-
#[link(name = "c")]
25-
extern {}
26-
27-
#[cfg(target_os = "freebsd")]
28-
#[link(name = "execinfo")]
29-
extern {}
30-
31-
#[cfg(target_os = "freebsd")]
32-
#[link(name = "c")]
33-
extern {}
34-
35-
#[cfg(target_os = "dragonfly")]
36-
#[link(name = "c")]
37-
extern {}
38-
39-
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
40-
#[link(name = "c")]
41-
extern {}
42-
43-
#[cfg(target_os = "macos")]
44-
#[link(name = "System")]
45-
extern {}
46-
4719
#[start]
4820
fn main(_: isize, _: *const *const u8) -> isize {
4921
1_isize % 1_isize

0 commit comments

Comments
 (0)