Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC: Implement runtime support for unwinding #26569

Merged
merged 4 commits into from
Jun 27, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: Use liblibc in lang-item-public
Makes this test case more robust by using standard libraries to ensure the
binary can be built.
alexcrichton committed Jun 25, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 759a7f1f66490191a6f809c9709151d6d27cea87
35 changes: 7 additions & 28 deletions src/test/auxiliary/lang-item-public.rs
Original file line number Diff line number Diff line change
@@ -8,42 +8,21 @@
// 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() {}

#[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 {}
}
30 changes: 1 addition & 29 deletions src/test/run-pass/lang-item-public.rs
Original file line number Diff line number Diff line change
@@ -11,39 +11,11 @@
// 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