Skip to content

Commit 10271ea

Browse files
committed
Auto merge of #38466 - sanxiyn:rollup, r=sanxiyn
Rollup of 9 pull requests - Successful merges: #38334, #38397, #38413, #38421, #38422, #38433, #38438, #38445, #38459 - Failed merges:
2 parents e70415b + 05be48b commit 10271ea

File tree

13 files changed

+448
-363
lines changed

13 files changed

+448
-363
lines changed

src/bootstrap/bin/rustc.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern crate bootstrap;
3030
use std::env;
3131
use std::ffi::OsString;
3232
use std::path::PathBuf;
33-
use std::process::Command;
33+
use std::process::{Command, ExitStatus};
3434

3535
fn main() {
3636
let args = env::args_os().skip(1).collect::<Vec<_>>();
@@ -180,8 +180,19 @@ fn main() {
180180
}
181181

182182
// Actually run the compiler!
183-
std::process::exit(match cmd.status() {
184-
Ok(s) => s.code().unwrap_or(1),
183+
std::process::exit(match exec_cmd(&mut cmd) {
184+
Ok(s) => s.code().unwrap_or(0xfe),
185185
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
186186
})
187187
}
188+
189+
#[cfg(unix)]
190+
fn exec_cmd(cmd: &mut Command) -> ::std::io::Result<ExitStatus> {
191+
use std::os::unix::process::CommandExt;
192+
Err(cmd.exec())
193+
}
194+
195+
#[cfg(not(unix))]
196+
fn exec_cmd(cmd: &mut Command) -> ::std::io::Result<ExitStatus> {
197+
cmd.status()
198+
}

src/libcore/hash/mod.rs

+37-3
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,44 @@ pub trait BuildHasher {
255255
fn build_hasher(&self) -> Self::Hasher;
256256
}
257257

258-
/// A structure which implements `BuildHasher` for all `Hasher` types which also
259-
/// implement `Default`.
258+
/// The `BuildHasherDefault` structure is used in scenarios where one has a
259+
/// type that implements [`Hasher`] and [`Default`], but needs that type to
260+
/// implement [`BuildHasher`].
260261
///
261-
/// This struct is 0-sized and does not need construction.
262+
/// This structure is zero-sized and does not need construction.
263+
///
264+
/// # Examples
265+
///
266+
/// Using `BuildHasherDefault` to specify a custom [`BuildHasher`] for
267+
/// [`HashMap`]:
268+
///
269+
/// ```
270+
/// use std::collections::HashMap;
271+
/// use std::hash::{BuildHasherDefault, Hasher};
272+
///
273+
/// #[derive(Default)]
274+
/// struct MyHasher;
275+
///
276+
/// impl Hasher for MyHasher {
277+
/// fn write(&mut self, bytes: &[u8]) {
278+
/// // Your hashing algorithm goes here!
279+
/// unimplemented!()
280+
/// }
281+
///
282+
/// fn finish(&self) -> u64 {
283+
/// // Your hashing algorithm goes here!
284+
/// unimplemented!()
285+
/// }
286+
/// }
287+
///
288+
/// type MyBuildHasher = BuildHasherDefault<MyHasher>;
289+
///
290+
/// let hash_map = HashMap::<u32, u32, MyBuildHasher>::default();
291+
/// ```
292+
///
293+
/// [`BuildHasher`]: trait.BuildHasher.html
294+
/// [`Default`]: ../default/trait.Default.html
295+
/// [`Hasher`]: trait.Hasher.html
262296
#[stable(since = "1.7.0", feature = "build_hasher")]
263297
pub struct BuildHasherDefault<H>(marker::PhantomData<H>);
264298

src/librustc_back/target/aarch64_linux_android.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
use target::{Target, TargetOptions, TargetResult};
1212

13+
// See https://developer.android.com/ndk/guides/abis.html#arm64-v8a
14+
// for target ABI requirements.
15+
1316
pub fn target() -> TargetResult {
1417
let mut base = super::android_base::opts();
1518
base.max_atomic_width = Some(128);

src/librustc_back/target/armv7_linux_androideabi.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -10,9 +10,12 @@
1010

1111
use target::{Target, TargetOptions, TargetResult};
1212

13+
// See https://developer.android.com/ndk/guides/abis.html#v7a
14+
// for target ABI requirements.
15+
1316
pub fn target() -> TargetResult {
1417
let mut base = super::android_base::opts();
15-
base.features = "+v7,+thumb2,+vfp3,+d16".to_string();
18+
base.features = "+v7,+thumb2,+vfp3,+d16,-neon".to_string();
1619
base.max_atomic_width = Some(64);
1720

1821
Ok(Target {

src/librustc_back/target/i686_linux_android.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
use target::{Target, TargetResult};
1212

13+
// See https://developer.android.com/ndk/guides/abis.html#x86
14+
// for target ABI requirements.
15+
1316
pub fn target() -> TargetResult {
1417
let mut base = super::android_base::opts();
1518

src/libstd/process.rs

+17
Original file line numberDiff line numberDiff line change
@@ -828,13 +828,30 @@ impl Child {
828828
/// this function at a known point where there are no more destructors left
829829
/// to run.
830830
///
831+
/// ## Platform-specific behavior
832+
///
833+
/// **Unix**: On Unix-like platforms, it is unlikely that all 32 bits of `exit`
834+
/// will be visible to a parent process inspecting the exit code. On most
835+
/// Unix-like platforms, only the eight least-significant bits are considered.
836+
///
831837
/// # Examples
832838
///
833839
/// ```
834840
/// use std::process;
835841
///
836842
/// process::exit(0);
837843
/// ```
844+
///
845+
/// Due to [platform-specific behavior], the exit code for this example will be
846+
/// `0` on Linux, but `256` on Windows:
847+
///
848+
/// ```no_run
849+
/// use std::process;
850+
///
851+
/// process::exit(0x0f00);
852+
/// ```
853+
///
854+
/// [platform-specific behavior]: #platform-specific-behavior
838855
#[stable(feature = "rust1", since = "1.0.0")]
839856
pub fn exit(code: i32) -> ! {
840857
::sys_common::cleanup();

0 commit comments

Comments
 (0)