rust/compiler/rustc_codegen_gcc/tests/run/structs.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
604 B
Rust
Raw Normal View History

2020-05-10 10:54:30 -04:00
// Compiler:
//
// Run-time:
// status: 0
// stdout: 1
// 2
#![feature(no_core)]
2020-05-10 10:54:30 -04:00
#![no_std]
#![no_core]
#![no_main]
2020-05-10 10:54:30 -04:00
extern crate mini_core;
use mini_core::*;
2020-05-10 10:54:30 -04:00
struct Test {
field: isize,
}
struct Two {
two: isize,
}
fn one() -> isize {
1
}
#[no_mangle]
extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
2020-05-10 10:54:30 -04:00
let test = Test {
field: one(),
};
let two = Two {
two: 2,
};
unsafe {
libc::printf(b"%ld\n\0" as *const u8 as *const i8, test.field);
libc::printf(b"%ld\n\0" as *const u8 as *const i8, two.two);
}
0
}