Change:
When confusing a Fn-like struct with a regular struct in an pattern, the output leaves a lot to be desired: <details<summary<a href=""Current output</a</summary</detailsWe should probably collect all these errors into a single diagnostic error: Even better if there was only one diagnostic.

Discussion:
<del> Subproject commit 56444a4545bd71430d64b86b8a71714cfdbe9f5d </del> <ins> Subproject commit 8bed48a751562c1c396b361bb6940c677268e997 </ins>

} let (ours, theirs) = self.setup_io(default, needs_stdin)?; <ins> if let Some(ret) = self.posix_spawn(&theirs, envp.as_ref())? { return Ok((ret, ours)) } </ins> let (input, output) = sys::pipe::anon_pipe()?; let pid = unsafe {

libc::execvp(self.get_argv()[0], self.get_argv().as_ptr()); io::Error::last_os_error() } <ins> #[cfg(not(any(target_os = "macos", target_os = "freebsd")))] fn posix_spawn(&mut self, _stdio: &ChildPipes, _envp: Option<&CStringArray>) -> io::Result<Option<Process>> { Ok(None) } #[cfg(any(target_os = "macos", target_os = "freebsd"))] fn posix_spawn(&mut self, stdio: &ChildPipes, envp: Option<&CStringArray>) -> io::Result<Option<Process>> { use mem; use sys; if self.get_cwd().is_some() || self.get_gid().is_some() || self.get_uid().is_some() || self.get_closures().len() != 0 { return Ok(None) } let mut p = Process { pid: 0, status: None }; struct PosixSpawnFileActions(libc::posix_spawn_file_actions_t); impl Drop for PosixSpawnFileActions { fn drop(&mut self) { unsafe { libc::posix_spawn_file_actions_destroy(&mut self.0); } } } struct PosixSpawnattr(libc::posix_spawnattr_t); impl Drop for PosixSpawnattr { fn drop(&mut self) { unsafe { libc::posix_spawnattr_destroy(&mut self.0); } } } unsafe { let mut file_actions = PosixSpawnFileActions(mem::uninitialized()); let mut attrs = PosixSpawnattr(mem::uninitialized()); libc::posix_spawnattr_init(&mut attrs.0); libc::posix_spawn_file_actions_init(&mut file_actions.0); if let Some(fd) = stdio.stdin.fd() { cvt(libc::posix_spawn_file_actions_adddup2(&mut file_actions.0, fd, libc::STDIN_FILENO))?; } if let Some(fd) = stdio.stdout.fd() { cvt(libc::posix_spawn_file_actions_adddup2(&mut file_actions.0, fd, libc::STDOUT_FILENO))?; } if let Some(fd) = stdio.stderr.fd() { cvt(libc::posix_spawn_file_actions_adddup2(&mut file_actions.0, fd, libc::STDERR_FILENO))?; } let mut set: libc::sigset_t = mem::uninitialized(); cvt(libc::sigemptyset(&mut set))?; cvt(libc::posix_spawnattr_setsigmask(&mut attrs.0, &set))?; cvt(libc::sigaddset(&mut set, libc::SIGPIPE))?; cvt(libc::posix_spawnattr_setsigdefault(&mut attrs.0, &set))?; let flags = libc::POSIX_SPAWN_SETSIGDEF | libc::POSIX_SPAWN_SETSIGMASK; cvt(libc::posix_spawnattr_setflags(&mut attrs.0, flags as _))?; let envp = envp.map(|c| c.as_ptr()) .unwrap_or(*sys::os::environ() as *const _); let ret = libc::posix_spawnp( &mut p.pid, self.get_argv()[0], &file_actions.0, &attrs.0, self.get_argv().as_ptr() as *const _, envp as *const _, ); if ret == 0 { Ok(Some(p)) } else { Err(io::Error::from_raw_os_error(ret)) } } } </ins> } ////////////////////////////////////////////////////////////////////////////////

<ins> // Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-cloudabi no processes // ignore-emscripten no processes use std::io::ErrorKind; use std::process::Command; fn main() { assert_eq!(Command::new("nonexistent") .spawn() .unwrap_err() .kind(), ErrorKind::NotFound); } </ins>