Don't require abi of defined function to be rust or rust-call

This commit is contained in:
bjorn3 2018-09-08 14:44:32 +02:00
parent 9ede386054
commit 9f489bc8de
2 changed files with 5 additions and 8 deletions

View file

@ -9,12 +9,14 @@ extern crate mini_core;
use mini_core::*;
#[link(name = "c")]
extern "C" {}
extern "C" {
fn puts(s: *const u8);
}
unsafe extern "C" fn my_puts(s: *const u8) {
puts(s);
}
#[lang = "termination"]
trait Termination {
fn report(self) -> i32;
@ -44,7 +46,7 @@ static NUM_REF: &'static u8 = unsafe { &NUM };
fn main() {
unsafe {
let slice: &[u8] = b"Hello\0" as &[u8; 6];
if intrinsics::size_of_val(slice) as u8 != 0 {
if intrinsics::size_of_val(slice) as u8 != 6 {
panic(&("eji", "frjio", 0, 0));
};
let ptr: *const u8 = slice as *const [u8] as *const u8;

View file

@ -249,11 +249,6 @@ pub fn codegen_fn_prelude<'a, 'tcx: 'a>(
) {
let ssa_analyzed = crate::analyze::analyze(fx);
match fx.self_sig().abi {
Abi::Rust | Abi::RustCall => {}
_ => unimplemented!("declared function with non \"rust\" or \"rust-call\" abi"),
}
let ret_layout = fx.layout_of(fx.return_type());
let output_pass_mode = get_pass_mode(fx.tcx, fx.self_sig().abi, fx.return_type(), true);
let ret_param = match output_pass_mode {