Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] make before_exec an unsafe fn #56129

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ dependencies = [
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ignore 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"jobserver 0.1.11 (git+https://github.com/RalfJung/jobserver-rs)",
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -1024,7 +1024,7 @@ dependencies = [
[[package]]
name = "jobserver"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/RalfJung/jobserver-rs#3de40df347fcaeb0591dab77af47d3071ffa7b3b"
dependencies = [
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -1919,7 +1919,7 @@ dependencies = [
"flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fmt_macros 0.0.0",
"graphviz 0.0.0",
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"jobserver 0.1.11 (git+https://github.com/RalfJung/jobserver-rs)",
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -3309,7 +3309,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "bfc62c8e50e381768ce8ee0428ee53741929f7ebd73e4d83f669bcf7693e00ae"
"checksum jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "60af5f849e1981434e4a31d3d782c4774ae9b434ce55b101a96ecfd09147e8be"
"checksum jobserver 0.1.11 (git+https://github.com/RalfJung/jobserver-rs)" = "<none>"
"checksum json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad0485404155f45cce53a40d4b2d6ac356418300daed05273d9e26f91c390be"
"checksum jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ddf83704f4e79979a424d1082dd2c1e52683058056c9280efa19ac5f6bc9033c"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
Expand Down
1 change: 1 addition & 0 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ cargo = { path = "tools/cargo" }
# that we're shipping as well (to ensure that the rustfmt in RLS and the
# `rustfmt` executable are the same exact version).
rustfmt-nightly = { path = "tools/rustfmt" }
jobserver = { git = 'https://github.com/RalfJung/jobserver-rs' }

# See comments in `tools/rustc-workspace-hack/README.md` for what's going on
# here
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/sys/redox/ext/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub trait CommandExt {
/// working directory have successfully been changed, so output to these
/// locations may not appear where intended.
#[stable(feature = "process_exec", since = "1.15.0")]
fn before_exec<F>(&mut self, f: F) -> &mut process::Command
unsafe fn before_exec<F>(&mut self, f: F) -> &mut process::Command
where F: FnMut() -> io::Result<()> + Send + Sync + 'static;

/// Performs all the required setup by this `Command`, followed by calling
Expand Down Expand Up @@ -97,7 +97,7 @@ impl CommandExt for process::Command {
self
}

fn before_exec<F>(&mut self, f: F) -> &mut process::Command
unsafe fn before_exec<F>(&mut self, f: F) -> &mut process::Command
where F: FnMut() -> io::Result<()> + Send + Sync + 'static
{
self.as_inner_mut().before_exec(Box::new(f));
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/redox/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Command {
self.gid = Some(id);
}

pub fn before_exec(&mut self,
pub unsafe fn before_exec(&mut self,
f: Box<dyn FnMut() -> io::Result<()> + Send + Sync>) {
self.closures.push(f);
}
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/sys/unix/ext/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub trait CommandExt {
/// working directory have successfully been changed, so output to these
/// locations may not appear where intended.
#[stable(feature = "process_exec", since = "1.15.0")]
fn before_exec<F>(&mut self, f: F) -> &mut process::Command
unsafe fn before_exec<F>(&mut self, f: F) -> &mut process::Command
where F: FnMut() -> io::Result<()> + Send + Sync + 'static;

/// Performs all the required setup by this `Command`, followed by calling
Expand Down Expand Up @@ -107,7 +107,7 @@ impl CommandExt for process::Command {
self
}

fn before_exec<F>(&mut self, f: F) -> &mut process::Command
unsafe fn before_exec<F>(&mut self, f: F) -> &mut process::Command
where F: FnMut() -> io::Result<()> + Send + Sync + 'static
{
self.as_inner_mut().before_exec(Box::new(f));
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/unix/process/process_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl Command {
&mut self.closures
}

pub fn before_exec(&mut self,
pub unsafe fn before_exec(&mut self,
f: Box<dyn FnMut() -> io::Result<()> + Send + Sync>) {
self.closures.push(f);
}
Expand Down