Skip to content

Commit

Permalink
Auto merge of #52352 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
Rollup of 17 pull requests

Successful merges:

 - #51962 (Provide llvm-strip in llvm-tools component)
 - #52003 (Implement `Option::replace` in the core library)
 - #52156 (Update std::ascii::ASCIIExt deprecation notes)
 - #52280 (llvm-tools-preview: fix build-manifest)
 - #52290 (Deny bare trait objects in src/librustc_save_analysis)
 - #52293 (Deny bare trait objects in librustc_typeck)
 - #52299 (Deny bare trait objects in src/libserialize)
 - #52300 (Deny bare trait objects in librustc_target and libtest)
 - #52302 (Deny bare trait objects in the rest of rust)
 - #52310 (Backport 1.27.1 release notes to master)
 - #52315 (Resolve FIXME(#27942))
 - #52316 (task: remove wrong comments about non-existent LocalWake trait)
 - #52322 (Update llvm-rebuild-trigger in light of LLVM 7 upgrade)
 - #52330 (Don't silently ignore invalid data in target spec)
 - #52333 (CI: Enable core dump on Linux, and print their stack trace on segfault. )
 - #52346 (Fix typo in improper_ctypes suggestion)
 - #52350 (Bump bootstrap compiler to 1.28.0-beta.10)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jul 13, 2018
2 parents fe29a4c + ea9b8dd commit 254f879
Show file tree
Hide file tree
Showing 58 changed files with 239 additions and 88 deletions.
26 changes: 25 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ sudo: required
dist: trusty
services:
- docker
addons:
apt:
packages:
- gdb

git:
depth: 2
Expand Down Expand Up @@ -249,6 +253,8 @@ before_script:
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/run.sh";
else
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/docker/run.sh $IMAGE";
# Enable core dump on Linux.
sudo sh -c 'echo "/checkout/obj/cores/core.%p.%E" > /proc/sys/kernel/core_pattern';
fi
# Log time information from this machine and an external machine for insight into possible
Expand All @@ -274,6 +280,8 @@ after_failure:
# Random attempt at debugging currently. Just poking around in here to see if
# anything shows up.

# Dump backtrace for macOS
- ls -lat $HOME/Library/Logs/DiagnosticReports/
- find $HOME/Library/Logs/DiagnosticReports
-type f
Expand All @@ -284,8 +292,24 @@ after_failure:
-exec head -750 {} \;
-exec echo travis_fold":"end:crashlog \; || true

# Dump backtrace for Linux
- ln -s . checkout &&
for CORE in obj/cores/core.*; do
EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|');
if [ -f "$EXE" ]; then
printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE";
gdb -q -c "$CORE" "$EXE"
-iex 'set auto-load off'
-iex 'dir src/'
-iex 'set sysroot .'
-ex bt
-ex q;
echo travis_fold":"end:crashlog;
fi;
done || true

# see #50887
- head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
- cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true

# attempt to debug anything killed by the oom killer on linux, just to see if
# it happened
Expand Down
23 changes: 23 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,29 @@ Compatibility Notes
[`{Any + Send + Sync}::downcast_ref`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.downcast_ref-2
[`{Any + Send + Sync}::is`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.is-2

Version 1.27.1 (2018-07-10)
===========================

Security Notes
--------------

- rustdoc would execute plugins in the /tmp/rustdoc/plugins directory
when running, which enabled executing code as some other user on a
given machine. This release fixes that vulnerability; you can read
more about this on the [blog][rustdoc-sec]. The associated CVE is [CVE-2018-1000622].

Thank you to Red Hat for responsibily disclosing this vulnerability to us.

Compatibility Notes
-------------------

- The borrow checker was fixed to avoid an additional potential unsoundness when using
match ergonomics: [#51415][51415], [#49534][49534].

[51415]: https://github.com/rust-lang/rust/issues/51415
[49534]: https://github.com/rust-lang/rust/issues/49534
[rustdoc-sec]: https://blog.rust-lang.org/2018/07/06/security-advisory-for-rustdoc.html
[CVE-2018-1000622]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=%20CVE-2018-1000622

Version 1.27.0 (2018-06-21)
==========================
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ const LLVM_TOOLS: &[&str] = &[
"llvm-objcopy", // used to transform ELFs into binary format which flashing tools consume
"llvm-objdump", // used to disassemble programs
"llvm-profdata", // used to inspect and merge files generated by profiles
"llvm-size", // prints the size of the linker sections of a program
"llvm-size", // used to prints the size of the linker sections of a program
"llvm-strip", // used to discard symbols from binary files to reduce their size
];

/// A structure representing a Rust compiler.
Expand Down
2 changes: 2 additions & 0 deletions src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(bare_trait_objects)]

use std::fs::File;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ objdir=$root_dir/obj

mkdir -p $HOME/.cargo
mkdir -p $objdir/tmp
mkdir $objdir/cores

args=
if [ "$SCCACHE_BUCKET" != "" ]; then
Expand Down
5 changes: 5 additions & 0 deletions src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ if [ "$NO_CHANGE_USER" = "" ]; then
fi
fi

# only enable core dump on Linux
if [ -f /proc/sys/kernel/core_pattern ]; then
ulimit -c unlimited
fi

ci_dir=`cd $(dirname $0) && pwd`
source "$ci_dir/shared.sh"

Expand Down
1 change: 1 addition & 0 deletions src/liballoc_jemalloc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#![no_std]
#![allow(unused_attributes)]
#![deny(bare_trait_objects)]
#![unstable(feature = "alloc_jemalloc",
reason = "implementation detail of std, does not provide any public API",
issue = "0")]
Expand Down
1 change: 1 addition & 0 deletions src/liballoc_system/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#![no_std]
#![allow(unused_attributes)]
#![deny(bare_trait_objects)]
#![unstable(feature = "alloc_system",
reason = "this library is unlikely to be stabilized in its current \
form or name",
Expand Down
1 change: 1 addition & 0 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#![cfg_attr(test, feature(test))]

#![allow(deprecated)]
#![deny(bare_trait_objects)]

extern crate alloc;
extern crate rustc_data_structures;
Expand Down
27 changes: 27 additions & 0 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,33 @@ impl<T> Option<T> {
pub fn take(&mut self) -> Option<T> {
mem::replace(self, None)
}

/// Replaces the actual value in the option by the value given in parameter,
/// returning the old value if present,
/// leaving a [`Some`] in its place without deinitializing either one.
///
/// [`Some`]: #variant.Some
///
/// # Examples
///
/// ```
/// #![feature(option_replace)]
///
/// let mut x = Some(2);
/// let old = x.replace(5);
/// assert_eq!(x, Some(5));
/// assert_eq!(old, Some(2));
///
/// let mut x = None;
/// let old = x.replace(3);
/// assert_eq!(x, Some(3));
/// assert_eq!(old, None);
/// ```
#[inline]
#[unstable(feature = "option_replace", issue = "51998")]
pub fn replace(&mut self, value: T) -> Option<T> {
mem::replace(self, Some(value))
}
}

impl<'a, T: Clone> Option<&'a T> {
Expand Down
8 changes: 3 additions & 5 deletions src/libcore/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ impl LocalWaker {
/// but you otherwise shouldn't call it directly.
///
/// If you're working with the standard library then it's recommended to
/// use the `LocalWaker::from` function instead which works with the safe
/// `Rc` type and the safe `LocalWake` trait.
/// use the `local_waker_from_nonlocal` or `local_waker` to convert a `Waker`
/// into a `LocalWaker`.
///
/// For this function to be used safely, it must be sound to call `inner.wake_local()`
/// on the current thread.
Expand Down Expand Up @@ -197,9 +197,7 @@ impl Drop for LocalWaker {
/// customization.
///
/// When using `std`, a default implementation of the `UnsafeWake` trait is provided for
/// `Arc<T>` where `T: Wake` and `Rc<T>` where `T: LocalWake`.
///
/// Although the methods on `UnsafeWake` take pointers rather than references,
/// `Arc<T>` where `T: Wake`.
pub unsafe trait UnsafeWake: Send + Sync {
/// Creates a clone of this `UnsafeWake` and stores it behind a `Waker`.
///
Expand Down
1 change: 1 addition & 0 deletions src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#![feature(reverse_bits)]
#![feature(iterator_find_map)]
#![feature(slice_internals)]
#![feature(option_replace)]

extern crate core;
extern crate test;
Expand Down
15 changes: 15 additions & 0 deletions src/libcore/tests/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,18 @@ fn test_try() {
}
assert_eq!(try_option_err(), Err(NoneError));
}

#[test]
fn test_replace() {
let mut x = Some(2);
let old = x.replace(5);

assert_eq!(x, Some(5));
assert_eq!(old, Some(2));

let mut x = None;
let old = x.replace(3);

assert_eq!(x, Some(3));
assert_eq!(old, None);
}
2 changes: 2 additions & 0 deletions src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
//! Parsing does not happen at runtime: structures of `std::fmt::rt` are
//! generated instead.

#![deny(bare_trait_objects)]

#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
Expand Down
2 changes: 2 additions & 0 deletions src/libgraphviz/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@
//!
//! * [DOT language](http://www.graphviz.org/doc/info/lang.html)

#![deny(bare_trait_objects)]

#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
Expand Down
1 change: 1 addition & 0 deletions src/libpanic_abort/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
#![panic_runtime]
#![allow(unused_features)]
#![deny(bare_trait_objects)]

#![feature(core_intrinsics)]
#![feature(libc)]
Expand Down
1 change: 1 addition & 0 deletions src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//! See [the book](../book/first-edition/procedural-macros.html) for more.

#![stable(feature = "proc_macro_lib", since = "1.15.0")]
#![deny(bare_trait_objects)]
#![deny(missing_docs)]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
Expand Down
1 change: 1 addition & 0 deletions src/libprofiler_builtins/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
reason = "internal implementation detail of rustc right now",
issue = "0")]
#![allow(unused_features)]
#![deny(bare_trait_objects)]
#![feature(staged_api)]
22 changes: 1 addition & 21 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,32 +193,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

let scope = region.free_region_binding_scope(self);
let node = self.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);
let unknown;
let tag = match self.hir.find(node) {
Some(hir_map::NodeBlock(_)) | Some(hir_map::NodeExpr(_)) => "body",
Some(hir_map::NodeItem(it)) => Self::item_scope_tag(&it),
Some(hir_map::NodeTraitItem(it)) => Self::trait_item_scope_tag(&it),
Some(hir_map::NodeImplItem(it)) => Self::impl_item_scope_tag(&it),

// this really should not happen, but it does:
// FIXME(#27942)
Some(_) => {
unknown = format!(
"unexpected node ({}) for scope {:?}. \
Please report a bug.",
self.hir.node_to_string(node),
scope
);
&unknown
}
None => {
unknown = format!(
"unknown node for scope {:?}. \
Please report a bug.",
scope
);
&unknown
}
_ => unreachable!()
};
let (prefix, span) = match *region {
ty::ReEarlyBound(ref br) => {
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_apfloat/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
//!
//! This API is completely unstable and subject to change.

#![deny(bare_trait_objects)]

#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_asan/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(bare_trait_objects)]

#![sanitizer_runtime]
#![feature(alloc_system)]
#![feature(sanitizer_runtime)]
Expand Down
1 change: 1 addition & 0 deletions src/librustc_borrowck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]

#![allow(non_camel_case_types)]
#![deny(bare_trait_objects)]

#![feature(from_ref)]
#![feature(quote)]
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_incremental/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

//! Support for serializing the dep-graph and reloading it.

#![deny(bare_trait_objects)]

#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
//!
//! This API is completely unstable and subject to change.

#![deny(bare_trait_objects)]

#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
return FfiUnsafe {
ty: ty,
reason: "this function pointer has Rust-specific calling convention",
help: Some("consider using an `fn \"extern\"(...) -> ...` \
help: Some("consider using an `extern fn(...) -> ...` \
function pointer instead"),
}
}
Expand Down
1 change: 1 addition & 0 deletions src/librustc_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![deny(bare_trait_objects)]

#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_lsan/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(bare_trait_objects)]

#![sanitizer_runtime]
#![feature(alloc_system)]
#![feature(sanitizer_runtime)]
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
*/

#![deny(bare_trait_objects)]

#![feature(slice_patterns)]
#![feature(slice_sort_by_cached_key)]
#![feature(from_ref)]
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_msan/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(bare_trait_objects)]

#![sanitizer_runtime]
#![feature(alloc_system)]
#![feature(sanitizer_runtime)]
Expand Down
Loading

0 comments on commit 254f879

Please sign in to comment.