diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-09-05 15:16:55 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-09-17 16:24:33 +1000 |
| commit | bdacdfe95f17188f5b047e0330e3e47f993a2016 (patch) | |
| tree | 51283687db7ad3db2a6add79e1196b83b9aee629 /compiler/rustc_codegen_ssa/src/back/command.rs | |
| parent | 04a318787b39732e306faf5ef6dc584990f4f417 (diff) | |
| download | rust-bdacdfe95f17188f5b047e0330e3e47f993a2016.tar.gz rust-bdacdfe95f17188f5b047e0330e3e47f993a2016.zip | |
Minimize visibilities.
This makes it much clearer which things are used outside the crate.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back/command.rs')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/command.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/command.rs b/compiler/rustc_codegen_ssa/src/back/command.rs index 95c4af2e59e..b3c5b86ccf4 100644 --- a/compiler/rustc_codegen_ssa/src/back/command.rs +++ b/compiler/rustc_codegen_ssa/src/back/command.rs @@ -8,7 +8,7 @@ use std::{fmt, io, mem}; use rustc_target::spec::LldFlavor; #[derive(Clone)] -pub struct Command { +pub(crate) struct Command { program: Program, args: Vec<OsString>, env: Vec<(OsString, OsString)>, @@ -23,15 +23,15 @@ enum Program { } impl Command { - pub fn new<P: AsRef<OsStr>>(program: P) -> Command { + pub(crate) fn new<P: AsRef<OsStr>>(program: P) -> Command { Command::_new(Program::Normal(program.as_ref().to_owned())) } - pub fn bat_script<P: AsRef<OsStr>>(program: P) -> Command { + pub(crate) fn bat_script<P: AsRef<OsStr>>(program: P) -> Command { Command::_new(Program::CmdBatScript(program.as_ref().to_owned())) } - pub fn lld<P: AsRef<OsStr>>(program: P, flavor: LldFlavor) -> Command { + pub(crate) fn lld<P: AsRef<OsStr>>(program: P, flavor: LldFlavor) -> Command { Command::_new(Program::Lld(program.as_ref().to_owned(), flavor)) } @@ -39,12 +39,12 @@ impl Command { Command { program, args: Vec::new(), env: Vec::new(), env_remove: Vec::new() } } - pub fn arg<P: AsRef<OsStr>>(&mut self, arg: P) -> &mut Command { + pub(crate) fn arg<P: AsRef<OsStr>>(&mut self, arg: P) -> &mut Command { self._arg(arg.as_ref()); self } - pub fn args<I>(&mut self, args: I) -> &mut Command + pub(crate) fn args<I>(&mut self, args: I) -> &mut Command where I: IntoIterator<Item: AsRef<OsStr>>, { @@ -58,7 +58,7 @@ impl Command { self.args.push(arg.to_owned()); } - pub fn env<K, V>(&mut self, key: K, value: V) -> &mut Command + pub(crate) fn env<K, V>(&mut self, key: K, value: V) -> &mut Command where K: AsRef<OsStr>, V: AsRef<OsStr>, @@ -71,7 +71,7 @@ impl Command { self.env.push((key.to_owned(), value.to_owned())); } - pub fn env_remove<K>(&mut self, key: K) -> &mut Command + pub(crate) fn env_remove<K>(&mut self, key: K) -> &mut Command where K: AsRef<OsStr>, { @@ -83,11 +83,11 @@ impl Command { self.env_remove.push(key.to_owned()); } - pub fn output(&mut self) -> io::Result<Output> { + pub(crate) fn output(&mut self) -> io::Result<Output> { self.command().output() } - pub fn command(&self) -> process::Command { + pub(crate) fn command(&self) -> process::Command { let mut ret = match self.program { Program::Normal(ref p) => process::Command::new(p), Program::CmdBatScript(ref p) => { @@ -111,17 +111,17 @@ impl Command { // extensions - pub fn get_args(&self) -> &[OsString] { + pub(crate) fn get_args(&self) -> &[OsString] { &self.args } - pub fn take_args(&mut self) -> Vec<OsString> { + pub(crate) fn take_args(&mut self) -> Vec<OsString> { mem::take(&mut self.args) } /// Returns a `true` if we're pretty sure that this'll blow OS spawn limits, /// or `false` if we should attempt to spawn and see what the OS says. - pub fn very_likely_to_exceed_some_spawn_limit(&self) -> bool { + pub(crate) fn very_likely_to_exceed_some_spawn_limit(&self) -> bool { // We mostly only care about Windows in this method, on Unix the limits // can be gargantuan anyway so we're pretty unlikely to hit them if cfg!(unix) { |
