mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Narrow use of unsafe in roc_run_native
`roc_run_native_fast` is actually the only unsafe part of the function, so we probably don't need everything to be wrapped in an `unsafe` block.
This commit is contained in:
parent
7e609bfdbf
commit
1f0303cf53
1 changed files with 17 additions and 19 deletions
|
@ -1099,7 +1099,6 @@ fn roc_run_native<I: IntoIterator<Item = S>, S: AsRef<OsStr>>(
|
||||||
) -> std::io::Result<i32> {
|
) -> std::io::Result<i32> {
|
||||||
use bumpalo::collections::CollectIn;
|
use bumpalo::collections::CollectIn;
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let executable = roc_run_executable_file_path(binary_bytes)?;
|
let executable = roc_run_executable_file_path(binary_bytes)?;
|
||||||
let (argv_cstrings, envp_cstrings) = make_argv_envp(arena, &executable, args);
|
let (argv_cstrings, envp_cstrings) = make_argv_envp(arena, &executable, args);
|
||||||
|
|
||||||
|
@ -1117,10 +1116,9 @@ fn roc_run_native<I: IntoIterator<Item = S>, S: AsRef<OsStr>>(
|
||||||
|
|
||||||
match opt_level {
|
match opt_level {
|
||||||
OptLevel::Development => roc_dev_native(arena, executable, argv, envp, expect_metadata),
|
OptLevel::Development => roc_dev_native(arena, executable, argv, envp, expect_metadata),
|
||||||
OptLevel::Normal | OptLevel::Size | OptLevel::Optimize => {
|
OptLevel::Normal | OptLevel::Size | OptLevel::Optimize => unsafe {
|
||||||
roc_run_native_fast(executable, &argv, &envp);
|
roc_run_native_fast(executable, &argv, &envp);
|
||||||
}
|
},
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(1)
|
Ok(1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue