Skip to content

Commit 254f879

Browse files
committed
Auto merge of #52352 - kennytm:rollup, r=kennytm
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
2 parents fe29a4c + ea9b8dd commit 254f879

File tree

58 files changed

+239
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+239
-88
lines changed

.travis.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ sudo: required
33
dist: trusty
44
services:
55
- docker
6+
addons:
7+
apt:
8+
packages:
9+
- gdb
610

711
git:
812
depth: 2
@@ -249,6 +253,8 @@ before_script:
249253
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/run.sh";
250254
else
251255
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/docker/run.sh $IMAGE";
256+
# Enable core dump on Linux.
257+
sudo sh -c 'echo "/checkout/obj/cores/core.%p.%E" > /proc/sys/kernel/core_pattern';
252258
fi
253259
254260
# Log time information from this machine and an external machine for insight into possible
@@ -274,6 +280,8 @@ after_failure:
274280
275281
# Random attempt at debugging currently. Just poking around in here to see if
276282
# anything shows up.
283+
284+
# Dump backtrace for macOS
277285
- ls -lat $HOME/Library/Logs/DiagnosticReports/
278286
- find $HOME/Library/Logs/DiagnosticReports
279287
-type f
@@ -284,8 +292,24 @@ after_failure:
284292
-exec head -750 {} \;
285293
-exec echo travis_fold":"end:crashlog \; || true
286294

295+
# Dump backtrace for Linux
296+
- ln -s . checkout &&
297+
for CORE in obj/cores/core.*; do
298+
EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|');
299+
if [ -f "$EXE" ]; then
300+
printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE";
301+
gdb -q -c "$CORE" "$EXE"
302+
-iex 'set auto-load off'
303+
-iex 'dir src/'
304+
-iex 'set sysroot .'
305+
-ex bt
306+
-ex q;
307+
echo travis_fold":"end:crashlog;
308+
fi;
309+
done || true
310+
287311
# see #50887
288-
- head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
312+
- cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
289313

290314
# attempt to debug anything killed by the oom killer on linux, just to see if
291315
# it happened

RELEASES.md

+23
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,29 @@ Compatibility Notes
140140
[`{Any + Send + Sync}::downcast_ref`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.downcast_ref-2
141141
[`{Any + Send + Sync}::is`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.is-2
142142

143+
Version 1.27.1 (2018-07-10)
144+
===========================
145+
146+
Security Notes
147+
--------------
148+
149+
- rustdoc would execute plugins in the /tmp/rustdoc/plugins directory
150+
when running, which enabled executing code as some other user on a
151+
given machine. This release fixes that vulnerability; you can read
152+
more about this on the [blog][rustdoc-sec]. The associated CVE is [CVE-2018-1000622].
153+
154+
Thank you to Red Hat for responsibily disclosing this vulnerability to us.
155+
156+
Compatibility Notes
157+
-------------------
158+
159+
- The borrow checker was fixed to avoid an additional potential unsoundness when using
160+
match ergonomics: [#51415][51415], [#49534][49534].
161+
162+
[51415]: https://github.com/rust-lang/rust/issues/51415
163+
[49534]: https://github.com/rust-lang/rust/issues/49534
164+
[rustdoc-sec]: https://blog.rust-lang.org/2018/07/06/security-advisory-for-rustdoc.html
165+
[CVE-2018-1000622]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=%20CVE-2018-1000622
143166

144167
Version 1.27.0 (2018-06-21)
145168
==========================

src/bootstrap/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ const LLVM_TOOLS: &[&str] = &[
206206
"llvm-objcopy", // used to transform ELFs into binary format which flashing tools consume
207207
"llvm-objdump", // used to disassemble programs
208208
"llvm-profdata", // used to inspect and merge files generated by profiles
209-
"llvm-size", // prints the size of the linker sections of a program
209+
"llvm-size", // used to prints the size of the linker sections of a program
210+
"llvm-strip", // used to discard symbols from binary files to reduce their size
210211
];
211212

212213
/// A structure representing a Rust compiler.

src/build_helper/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![deny(bare_trait_objects)]
12+
1113
use std::fs::File;
1214
use std::path::{Path, PathBuf};
1315
use std::process::{Command, Stdio};

src/ci/docker/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ objdir=$root_dir/obj
9999

100100
mkdir -p $HOME/.cargo
101101
mkdir -p $objdir/tmp
102+
mkdir $objdir/cores
102103

103104
args=
104105
if [ "$SCCACHE_BUCKET" != "" ]; then

src/ci/run.sh

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ if [ "$NO_CHANGE_USER" = "" ]; then
2424
fi
2525
fi
2626

27+
# only enable core dump on Linux
28+
if [ -f /proc/sys/kernel/core_pattern ]; then
29+
ulimit -c unlimited
30+
fi
31+
2732
ci_dir=`cd $(dirname $0) && pwd`
2833
source "$ci_dir/shared.sh"
2934

src/liballoc_jemalloc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#![no_std]
1212
#![allow(unused_attributes)]
13+
#![deny(bare_trait_objects)]
1314
#![unstable(feature = "alloc_jemalloc",
1415
reason = "implementation detail of std, does not provide any public API",
1516
issue = "0")]

src/liballoc_system/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#![no_std]
1212
#![allow(unused_attributes)]
13+
#![deny(bare_trait_objects)]
1314
#![unstable(feature = "alloc_system",
1415
reason = "this library is unlikely to be stabilized in its current \
1516
form or name",

src/libarena/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#![cfg_attr(test, feature(test))]
3131

3232
#![allow(deprecated)]
33+
#![deny(bare_trait_objects)]
3334

3435
extern crate alloc;
3536
extern crate rustc_data_structures;

src/libcore/option.rs

+27
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,33 @@ impl<T> Option<T> {
845845
pub fn take(&mut self) -> Option<T> {
846846
mem::replace(self, None)
847847
}
848+
849+
/// Replaces the actual value in the option by the value given in parameter,
850+
/// returning the old value if present,
851+
/// leaving a [`Some`] in its place without deinitializing either one.
852+
///
853+
/// [`Some`]: #variant.Some
854+
///
855+
/// # Examples
856+
///
857+
/// ```
858+
/// #![feature(option_replace)]
859+
///
860+
/// let mut x = Some(2);
861+
/// let old = x.replace(5);
862+
/// assert_eq!(x, Some(5));
863+
/// assert_eq!(old, Some(2));
864+
///
865+
/// let mut x = None;
866+
/// let old = x.replace(3);
867+
/// assert_eq!(x, Some(3));
868+
/// assert_eq!(old, None);
869+
/// ```
870+
#[inline]
871+
#[unstable(feature = "option_replace", issue = "51998")]
872+
pub fn replace(&mut self, value: T) -> Option<T> {
873+
mem::replace(self, Some(value))
874+
}
848875
}
849876

850877
impl<'a, T: Clone> Option<&'a T> {

src/libcore/task/wake.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ impl LocalWaker {
113113
/// but you otherwise shouldn't call it directly.
114114
///
115115
/// If you're working with the standard library then it's recommended to
116-
/// use the `LocalWaker::from` function instead which works with the safe
117-
/// `Rc` type and the safe `LocalWake` trait.
116+
/// use the `local_waker_from_nonlocal` or `local_waker` to convert a `Waker`
117+
/// into a `LocalWaker`.
118118
///
119119
/// For this function to be used safely, it must be sound to call `inner.wake_local()`
120120
/// on the current thread.
@@ -197,9 +197,7 @@ impl Drop for LocalWaker {
197197
/// customization.
198198
///
199199
/// When using `std`, a default implementation of the `UnsafeWake` trait is provided for
200-
/// `Arc<T>` where `T: Wake` and `Rc<T>` where `T: LocalWake`.
201-
///
202-
/// Although the methods on `UnsafeWake` take pointers rather than references,
200+
/// `Arc<T>` where `T: Wake`.
203201
pub unsafe trait UnsafeWake: Send + Sync {
204202
/// Creates a clone of this `UnsafeWake` and stores it behind a `Waker`.
205203
///

src/libcore/tests/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#![feature(reverse_bits)]
4545
#![feature(iterator_find_map)]
4646
#![feature(slice_internals)]
47+
#![feature(option_replace)]
4748

4849
extern crate core;
4950
extern crate test;

src/libcore/tests/option.rs

+15
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,18 @@ fn test_try() {
297297
}
298298
assert_eq!(try_option_err(), Err(NoneError));
299299
}
300+
301+
#[test]
302+
fn test_replace() {
303+
let mut x = Some(2);
304+
let old = x.replace(5);
305+
306+
assert_eq!(x, Some(5));
307+
assert_eq!(old, Some(2));
308+
309+
let mut x = None;
310+
let old = x.replace(3);
311+
312+
assert_eq!(x, Some(3));
313+
assert_eq!(old, None);
314+
}

src/libfmt_macros/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
//! Parsing does not happen at runtime: structures of `std::fmt::rt` are
1515
//! generated instead.
1616
17+
#![deny(bare_trait_objects)]
18+
1719
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1820
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1921
html_root_url = "https://doc.rust-lang.org/nightly/",

src/libgraphviz/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@
283283
//!
284284
//! * [DOT language](http://www.graphviz.org/doc/info/lang.html)
285285
286+
#![deny(bare_trait_objects)]
287+
286288
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
287289
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
288290
html_root_url = "https://doc.rust-lang.org/nightly/",

src/libpanic_abort/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
2222
#![panic_runtime]
2323
#![allow(unused_features)]
24+
#![deny(bare_trait_objects)]
2425

2526
#![feature(core_intrinsics)]
2627
#![feature(libc)]

src/libproc_macro/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
//! See [the book](../book/first-edition/procedural-macros.html) for more.
2323
2424
#![stable(feature = "proc_macro_lib", since = "1.15.0")]
25+
#![deny(bare_trait_objects)]
2526
#![deny(missing_docs)]
2627
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2728
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",

src/libprofiler_builtins/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
reason = "internal implementation detail of rustc right now",
1616
issue = "0")]
1717
#![allow(unused_features)]
18+
#![deny(bare_trait_objects)]
1819
#![feature(staged_api)]

src/librustc/infer/error_reporting/mod.rs

+1-21
Original file line numberDiff line numberDiff line change
@@ -193,32 +193,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
193193

194194
let scope = region.free_region_binding_scope(self);
195195
let node = self.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);
196-
let unknown;
197196
let tag = match self.hir.find(node) {
198197
Some(hir_map::NodeBlock(_)) | Some(hir_map::NodeExpr(_)) => "body",
199198
Some(hir_map::NodeItem(it)) => Self::item_scope_tag(&it),
200199
Some(hir_map::NodeTraitItem(it)) => Self::trait_item_scope_tag(&it),
201200
Some(hir_map::NodeImplItem(it)) => Self::impl_item_scope_tag(&it),
202-
203-
// this really should not happen, but it does:
204-
// FIXME(#27942)
205-
Some(_) => {
206-
unknown = format!(
207-
"unexpected node ({}) for scope {:?}. \
208-
Please report a bug.",
209-
self.hir.node_to_string(node),
210-
scope
211-
);
212-
&unknown
213-
}
214-
None => {
215-
unknown = format!(
216-
"unknown node for scope {:?}. \
217-
Please report a bug.",
218-
scope
219-
);
220-
&unknown
221-
}
201+
_ => unreachable!()
222202
};
223203
let (prefix, span) = match *region {
224204
ty::ReEarlyBound(ref br) => {

src/librustc_apfloat/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
//!
4141
//! This API is completely unstable and subject to change.
4242
43+
#![deny(bare_trait_objects)]
44+
4345
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
4446
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
4547
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_asan/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![deny(bare_trait_objects)]
12+
1113
#![sanitizer_runtime]
1214
#![feature(alloc_system)]
1315
#![feature(sanitizer_runtime)]

src/librustc_borrowck/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
html_root_url = "https://doc.rust-lang.org/nightly/")]
1414

1515
#![allow(non_camel_case_types)]
16+
#![deny(bare_trait_objects)]
1617

1718
#![feature(from_ref)]
1819
#![feature(quote)]

src/librustc_incremental/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
//! Support for serializing the dep-graph and reloading it.
1212
13+
#![deny(bare_trait_objects)]
14+
1315
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1416
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1517
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_lint/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
//!
2020
//! This API is completely unstable and subject to change.
2121
22+
#![deny(bare_trait_objects)]
23+
2224
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2325
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2426
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_lint/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
673673
return FfiUnsafe {
674674
ty: ty,
675675
reason: "this function pointer has Rust-specific calling convention",
676-
help: Some("consider using an `fn \"extern\"(...) -> ...` \
676+
help: Some("consider using an `extern fn(...) -> ...` \
677677
function pointer instead"),
678678
}
679679
}

src/librustc_llvm/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#![allow(non_camel_case_types)]
1313
#![allow(non_snake_case)]
1414
#![allow(dead_code)]
15+
#![deny(bare_trait_objects)]
1516

1617
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1718
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",

src/librustc_lsan/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![deny(bare_trait_objects)]
12+
1113
#![sanitizer_runtime]
1214
#![feature(alloc_system)]
1315
#![feature(sanitizer_runtime)]

src/librustc_mir/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
1414
1515
*/
1616

17+
#![deny(bare_trait_objects)]
18+
1719
#![feature(slice_patterns)]
1820
#![feature(slice_sort_by_cached_key)]
1921
#![feature(from_ref)]

src/librustc_msan/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![deny(bare_trait_objects)]
12+
1113
#![sanitizer_runtime]
1214
#![feature(alloc_system)]
1315
#![feature(sanitizer_runtime)]

0 commit comments

Comments
 (0)