about summary refs log tree commit diff
path: root/tests/run-make/wasm-unexpected-features/foo.rs
blob: 5c7aa2d61904694262efc9649ddb062e35efb8ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#![no_core]
#![crate_type = "cdylib"]
#![feature(no_core, lang_items, allocator_internals, rustc_attrs)]
#![needs_allocator]
#![allow(internal_features)]

#[rustc_std_internal_symbol]
unsafe fn __rust_alloc(_size: usize, _align: usize) -> *mut u8 {
    0 as *mut u8
}

unsafe extern "Rust" {
    #[rustc_std_internal_symbol]
    fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
}

#[used]
static mut BUF: [u8; 1024] = [0; 1024];

#[unsafe(no_mangle)]
extern "C" fn init() {
    unsafe {
        __rust_alloc_error_handler(0, 0);
    }
}

mod minicore {
    #[lang = "pointee_sized"]
    pub trait PointeeSized {}

    #[lang = "meta_sized"]
    pub trait MetaSized: PointeeSized {}

    #[lang = "sized"]
    pub trait Sized: MetaSized {}

    #[lang = "copy"]
    pub trait Copy {}
    impl Copy for u8 {}

    #[lang = "drop_in_place"]
    fn drop_in_place<T>(_: *mut T) {}
}