3 //! The `rt` module provides a narrow set of runtime services,
4 //! including the global heap (exported in `heap`) and unwinding and
5 //! backtrace support. The APIs in this module are highly unstable,
6 //! and should be considered as private implementation details for the
11 reason = "this public module should not exist and is highly likely \
17 // Re-export some of our utilities which are expected by other crates.
18 pub use crate::panicking::{begin_panic, begin_panic_fmt, panic_count};
20 // To reduce the generated code of the new `lang_start`, this function is doing
23 fn lang_start_internal(
24 main: &(dyn Fn() -> i32 + Sync + crate::panic::RefUnwindSafe),
26 argv: *const *const u8,
29 use crate::sys_common;
31 // SAFETY: Only called once during runtime initialization.
32 unsafe { sys_common::rt::init(argc, argv) };
34 let exit_code = panic::catch_unwind(main);
36 sys_common::rt::cleanup();
38 exit_code.unwrap_or(101) as isize
43 fn lang_start<T: crate::process::Termination + 'static>(
46 argv: *const *const u8,
49 &move || crate::sys_common::backtrace::__rust_begin_short_backtrace(main).report(),