]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_codegen_ssa/back/command.rs
Suggest defining type parameter when appropriate
[rust.git] / src / librustc_codegen_ssa / back / command.rs
index b8501f0e12a70ed4abf854297612c29a37903716..30b055b3131499961da4db1de4f3a797ebb3e514 100644 (file)
@@ -7,8 +7,8 @@
 use std::mem;
 use std::process::{self, Output};
 
+use rustc_span::symbol::Symbol;
 use rustc_target::spec::LldFlavor;
-use syntax::symbol::Symbol;
 
 #[derive(Clone)]
 pub struct Command {
@@ -22,7 +22,7 @@ pub struct Command {
 enum Program {
     Normal(OsString),
     CmdBatScript(OsString),
-    Lld(OsString, LldFlavor)
+    Lld(OsString, LldFlavor),
 }
 
 impl Command {
@@ -39,12 +39,7 @@ pub fn lld<P: AsRef<OsStr>>(program: P, flavor: LldFlavor) -> Command {
     }
 
     fn _new(program: Program) -> Command {
-        Command {
-            program,
-            args: Vec::new(),
-            env: Vec::new(),
-            env_remove: Vec::new(),
-        }
+        Command { program, args: Vec::new(), env: Vec::new(), env_remove: Vec::new() }
     }
 
     pub fn arg<P: AsRef<OsStr>>(&mut self, arg: P) -> &mut Command {
@@ -72,8 +67,9 @@ fn _arg(&mut self, arg: &OsStr) {
     }
 
     pub fn env<K, V>(&mut self, key: K, value: V) -> &mut Command
-        where K: AsRef<OsStr>,
-              V: AsRef<OsStr>
+    where
+        K: AsRef<OsStr>,
+        V: AsRef<OsStr>,
     {
         self._env(key.as_ref(), value.as_ref());
         self
@@ -84,7 +80,8 @@ fn _env(&mut self, key: &OsStr, value: &OsStr) {
     }
 
     pub fn env_remove<K>(&mut self, key: K) -> &mut Command
-        where K: AsRef<OsStr>,
+    where
+        K: AsRef<OsStr>,
     {
         self._env_remove(key.as_ref());
         self
@@ -122,7 +119,7 @@ pub fn command(&self) -> process::Command {
         for k in &self.env_remove {
             ret.env_remove(k);
         }
-        return ret
+        return ret;
     }
 
     // extensions
@@ -141,14 +138,14 @@ pub 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) {
-            return false
+            return false;
         }
 
         // Right now LLD doesn't support the `@` syntax of passing an argument
         // through files, so regardless of the platform we try to go to the OS
         // on this one.
         if let Program::Lld(..) = self.program {
-            return false
+            return false;
         }
 
         // Ok so on Windows to spawn a process is 32,768 characters in its
@@ -171,11 +168,10 @@ pub fn very_likely_to_exceed_some_spawn_limit(&self) -> bool {
         // error code if we fail to spawn and automatically re-spawning the
         // linker with smaller arguments.
         //
-        // [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
-        // [2]: https://blogs.msdn.microsoft.com/oldnewthing/20031210-00/?p=41553
+        // [1]: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa
+        // [2]: https://devblogs.microsoft.com/oldnewthing/?p=41553
 
-        let estimated_command_line_len =
-            self.args.iter().map(|a| a.len()).sum::<usize>();
+        let estimated_command_line_len = self.args.iter().map(|a| a.len()).sum::<usize>();
         estimated_command_line_len > 1024 * 6
     }
 }