Skip to content

Commit e950a60

Browse files
authored
Rollup merge of rust-lang#147594 - vexide:vexos-exit-impl, r=joboet
std: implement `pal::os::exit` for VEXos This PR provides a more "proper" implementation of process exiting in VEXos programs by going through `vexSystemExitRequest` rather than calling `intrinsics::abort`, which exits using an undefined instruction trap. This matches the existing implementation of `rt::abort_internal` and therefore makes `std::process::exit` have the same behavior as returning from main on VEXos targets.
2 parents 8c04cf0 + 04da682 commit e950a60

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

library/std/src/sys/pal/vexos/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#[path = "../unsupported/os.rs"]
21
pub mod os;
32
#[path = "../unsupported/pipe.rs"]
43
pub mod pipe;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#[expect(dead_code)]
2+
#[path = "../unsupported/os.rs"]
3+
mod unsupported_os;
4+
pub use unsupported_os::{
5+
JoinPathsError, SplitPaths, chdir, current_exe, errno, error_string, getcwd, getpid, home_dir,
6+
join_paths, split_paths, temp_dir,
7+
};
8+
9+
pub use super::unsupported;
10+
11+
pub fn exit(_code: i32) -> ! {
12+
unsafe {
13+
vex_sdk::vexSystemExitRequest();
14+
15+
loop {
16+
vex_sdk::vexTasksRun();
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)