xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/no_std/lib.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1 #![no_std]
2 // These features are needed to support no_std + alloc
3 #![feature(lang_items)]
4 #![feature(alloc_error_handler)]
5 #![feature(core_intrinsics)]
6 #![allow(unused_imports)]
7 use custom_alloc;
8 
9 #[cfg(all(not(feature = "std"), not(test)))]
10 mod no_std;
11 
12 #[cfg(not(feature = "std"))]
13 #[no_mangle]
return_5_in_no_std() -> i3214 pub extern "C" fn return_5_in_no_std() -> i32 {
15     5
16 }
17 
18 #[cfg(feature = "std")]
19 #[no_mangle]
return_5_in_no_std() -> i3220 pub extern "C" fn return_5_in_no_std() -> i32 {
21     6
22 }
23