Skip to content

Commit

Permalink
Auto merge of #59695 - Centril:rollup-88qffc2, r=Centril
Browse files Browse the repository at this point in the history
Rollup of 8 pull requests

Successful merges:

 - #59470 (Document std::fs::File close behavior ignoring errors)
 - #59555 (update miri)
 - #59556 (update stdsimd)
 - #59596 (Forward formatter settings to bounds of `Range<T>` in `fmt::Debug` impl)
 - #59639 (Never return uninhabited values at all)
 - #59671 (Make some of lexer's API private)
 - #59685 (Add description for -Os and -Oz in rustc.1)
 - #59686 (Temporarily disable stack probing for gnux32.)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Apr 4, 2019
2 parents 2d06571 + 31c2f5d commit 52980d0
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 43 deletions.
24 changes: 1 addition & 23 deletions Cargo.lock
Expand Up @@ -2054,18 +2054,6 @@ dependencies = [
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "rand"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "rand"
version = "0.6.1"
Expand Down Expand Up @@ -2093,14 +2081,6 @@ dependencies = [
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "rand_core"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "rand_core"
version = "0.3.0"
Expand Down Expand Up @@ -2560,7 +2540,7 @@ version = "1.0.0"
dependencies = [
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -4206,10 +4186,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
"checksum racer 2.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "37c88638777cc178684cf648ca0e1dad56646ce105b8593dfe665c436300adc3"
"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
"checksum rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a"
"checksum rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a"
"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372"
"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db"
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
Expand Down
2 changes: 1 addition & 1 deletion src/doc/man/rustc.1
Expand Up @@ -261,7 +261,7 @@ full debug info with variable and type information.
.RE
.TP
\fBopt\-level\fR=\fIVAL\fR
Optimize with possible levels 0\[en]3
Optimize with possible levels 0\[en]3, s (optimize for size), or z (for minimal size)

.SH ENVIRONMENT

Expand Down
22 changes: 17 additions & 5 deletions src/libcore/ops/range.rs
Expand Up @@ -85,7 +85,10 @@ pub struct Range<Idx> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{:?}..{:?}", self.start, self.end)
self.start.fmt(fmt)?;
write!(fmt, "..")?;
self.end.fmt(fmt)?;
Ok(())
}
}

Expand Down Expand Up @@ -184,7 +187,9 @@ pub struct RangeFrom<Idx> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{:?}..", self.start)
self.start.fmt(fmt)?;
write!(fmt, "..")?;
Ok(())
}
}

Expand Down Expand Up @@ -266,7 +271,9 @@ pub struct RangeTo<Idx> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "..{:?}", self.end)
write!(fmt, "..")?;
self.end.fmt(fmt)?;
Ok(())
}
}

Expand Down Expand Up @@ -467,7 +474,10 @@ impl<Idx> RangeInclusive<Idx> {
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx: fmt::Debug> fmt::Debug for RangeInclusive<Idx> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{:?}..={:?}", self.start, self.end)
self.start.fmt(fmt)?;
write!(fmt, "..=")?;
self.end.fmt(fmt)?;
Ok(())
}
}

Expand Down Expand Up @@ -602,7 +612,9 @@ pub struct RangeToInclusive<Idx> {
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx: fmt::Debug> fmt::Debug for RangeToInclusive<Idx> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "..={:?}", self.end)
write!(fmt, "..=")?;
self.end.fmt(fmt)?;
Ok(())
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/librustc_codegen_ssa/mir/block.rs
Expand Up @@ -238,6 +238,13 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}
}
}
if self.fn_ty.ret.layout.abi.is_uninhabited() {
// Functions with uninhabited return values are marked `noreturn`,
// so we should make sure that we never actually do.
bx.abort();
bx.unreachable();
return;
}
let llval = match self.fn_ty.ret.mode {
PassMode::Ignore(IgnoreMode::Zst) | PassMode::Indirect(..) => {
bx.ret_void();
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_target/spec/x86_64_unknown_linux_gnux32.rs
Expand Up @@ -5,7 +5,8 @@ pub fn target() -> TargetResult {
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mx32".to_string());
base.stack_probes = true;
// BUG: temporarily workaround #59674
base.stack_probes = false;
base.has_elf_tls = false;
// BUG(GabrielMajeri): disabling the PLT on x86_64 Linux with x32 ABI
// breaks code gen. See LLVM bug 36743
Expand Down
11 changes: 9 additions & 2 deletions src/libstd/fs.rs
Expand Up @@ -21,7 +21,9 @@ use crate::time::SystemTime;
/// it was opened with. Files also implement [`Seek`] to alter the logical cursor
/// that the file contains internally.
///
/// Files are automatically closed when they go out of scope.
/// Files are automatically closed when they go out of scope. Errors detected
/// on closing are ignored by the implementation of `Drop`. Use the method
/// [`sync_all`] if these errors must be manually handled.
///
/// # Examples
///
Expand Down Expand Up @@ -84,6 +86,7 @@ use crate::time::SystemTime;
/// [`Read`]: ../io/trait.Read.html
/// [`Write`]: ../io/trait.Write.html
/// [`BufReader<R>`]: ../io/struct.BufReader.html
/// [`sync_all`]: struct.File.html#method.sync_all
#[stable(feature = "rust1", since = "1.0.0")]
pub struct File {
inner: fs_imp::File,
Expand Down Expand Up @@ -391,9 +394,13 @@ impl File {

/// Attempts to sync all OS-internal metadata to disk.
///
/// This function will attempt to ensure that all in-core data reaches the
/// This function will attempt to ensure that all in-memory data reaches the
/// filesystem before returning.
///
/// This can be used to handle errors that would otherwise only be caught
/// when the `File` is closed. Dropping a file will ignore errors in
/// synchronizing this in-memory data.
///
/// # Examples
///
/// ```no_run
Expand Down
16 changes: 8 additions & 8 deletions src/libsyntax/parse/lexer/mod.rs
Expand Up @@ -43,16 +43,16 @@ pub struct UnmatchedBrace {
}

pub struct StringReader<'a> {
pub sess: &'a ParseSess,
crate sess: &'a ParseSess,
/// The absolute offset within the source_map of the next character to read
pub next_pos: BytePos,
crate next_pos: BytePos,
/// The absolute offset within the source_map of the current character
pub pos: BytePos,
crate pos: BytePos,
/// The current character (which has been read from self.pos)
pub ch: Option<char>,
pub source_file: Lrc<syntax_pos::SourceFile>,
crate ch: Option<char>,
crate source_file: Lrc<syntax_pos::SourceFile>,
/// Stop reading src at this index.
pub end_src_index: usize,
crate end_src_index: usize,
// cached:
peek_tok: token::Token,
peek_span: Span,
Expand Down Expand Up @@ -126,7 +126,7 @@ impl<'a> StringReader<'a> {
}

/// Immutably extract string if found at current position with given delimiters
pub fn peek_delimited(&self, from_ch: char, to_ch: char) -> Option<String> {
fn peek_delimited(&self, from_ch: char, to_ch: char) -> Option<String> {
let mut pos = self.pos;
let mut idx = self.src_index(pos);
let mut ch = char_at(&self.src, idx);
Expand Down Expand Up @@ -191,7 +191,7 @@ impl<'a> StringReader<'a> {
self.fatal_span(self.peek_span, m)
}

pub fn emit_fatal_errors(&mut self) {
crate fn emit_fatal_errors(&mut self) {
for err in &mut self.fatal_errs {
err.emit();
}
Expand Down
2 changes: 1 addition & 1 deletion src/stdsimd
32 changes: 32 additions & 0 deletions src/test/codegen/noreturn-uninhabited.rs
@@ -0,0 +1,32 @@
// compile-flags: -g -C no-prepopulate-passes
// ignore-tidy-linelength

#![crate_type = "lib"]

#[derive(Clone, Copy)]
pub enum EmptyEnum {}

#[no_mangle]
pub fn empty(x: &EmptyEnum) -> EmptyEnum {
// CHECK: @empty({{.*}}) unnamed_addr #0
// CHECK-NOT: ret void
// CHECK: call void @llvm.trap()
// CHECK: unreachable
*x
}

pub struct Foo(String, EmptyEnum);

#[no_mangle]
pub fn foo(x: String, y: &EmptyEnum) -> Foo {
// CHECK: @foo({{.*}}) unnamed_addr #0
// CHECK-NOT: ret %Foo
// CHECK: call void @llvm.trap()
// CHECK: unreachable
Foo(x, *y)
}

// CHECK: attributes #0 = {{{.*}} noreturn {{.*}}}

// CHECK: DISubprogram(name: "empty", {{.*}} DIFlagNoReturn
// CHECK: DISubprogram(name: "foo", {{.*}} DIFlagNoReturn
2 changes: 1 addition & 1 deletion src/tools/miri
2 changes: 1 addition & 1 deletion src/tools/rustc-workspace-hack/Cargo.toml
Expand Up @@ -57,7 +57,7 @@ features = [
[dependencies]
curl-sys = { version = "0.4.13", features = ["http2", "libnghttp2-sys"], optional = true }
parking_lot = { version = "0.7", features = ['nightly'] }
rand = { version = "0.5.5", features = ["i128_support"] }
rand = { version = "0.6.1", features = ["i128_support"] }
serde = { version = "1.0.82", features = ['derive'] }
serde_json = { version = "1.0.31", features = ["raw_value"] }
smallvec = { version = "0.6", features = ['union', 'may_dangle'] }
Expand Down

0 comments on commit 52980d0

Please sign in to comment.