]> git.lizzy.rs Git - rust.git/blob - library/std/src/sys/unsupported/common.rs
Rollup merge of #105482 - wesleywiser:fix_debuginfo_ub, r=tmiasko
[rust.git] / library / std / src / sys / unsupported / common.rs
1 use crate::io as std_io;
2
3 pub mod memchr {
4     pub use core::slice::memchr::{memchr, memrchr};
5 }
6
7 // SAFETY: must be called only once during runtime initialization.
8 // NOTE: this is not guaranteed to run, for example when Rust code is called externally.
9 pub unsafe fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
10
11 // SAFETY: must be called only once during runtime cleanup.
12 // NOTE: this is not guaranteed to run, for example when the program aborts.
13 pub unsafe fn cleanup() {}
14
15 pub fn unsupported<T>() -> std_io::Result<T> {
16     Err(unsupported_err())
17 }
18
19 pub fn unsupported_err() -> std_io::Error {
20     std_io::const_io_error!(
21         std_io::ErrorKind::Unsupported,
22         "operation not supported on this platform",
23     )
24 }
25
26 pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind {
27     crate::io::ErrorKind::Uncategorized
28 }
29
30 pub fn abort_internal() -> ! {
31     core::intrinsics::abort();
32 }
33
34 pub fn hashmap_random_keys() -> (u64, u64) {
35     (1, 2)
36 }