Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 13 pull requests #54711

Merged
merged 37 commits into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1975b8d
Document that slices cannot be larger than `isize::MAX` bytes
tbu- Aug 29, 2018
7b77508
Add `debug_assert!`s to `slice::from_raw_parts`
tbu- Sep 4, 2018
1aac00f
A slice covering exactly half the address space is not OK
tbu- Sep 10, 2018
5d9086f
Fix overflow in `from_raw_parts` size check
tbu- Sep 11, 2018
11c6318
Use more obvious calculation for slice size check
tbu- Sep 17, 2018
ebffb67
Adjust the docs of `from_raw_parts` to match the implementation
tbu- Sep 17, 2018
7cbe060
in which we include attributes in unused `extern crate` suggestion spans
zackmdavis Sep 22, 2018
e370b1c
Don't have two adjacent "see also" sentences
tbu- Sep 27, 2018
f9ff7b7
Prefer `#![feature(bind_by_move_pattern_guards)]` over `-Z disable_as…
pnkfelix Sep 28, 2018
8d10f96
Indicate how to move value out of Box in docs.
frewsxcv Sep 25, 2018
89cb411
rustc/infer: use unwrap_or(_else) where applicable
ljedrz Sep 28, 2018
9fd6fad
rustc/infer: convert single-branch matches to if-let
ljedrz Sep 28, 2018
0e84647
rustc/infer: use to_owned instead of to_string with string literals
ljedrz Sep 28, 2018
999d768
rustc/infer: improve vector allocations
ljedrz Sep 28, 2018
70eeb05
rustc/infer: readability improvements
ljedrz Sep 28, 2018
52da886
rustc/infer: miscellaneous minor code improvements
ljedrz Sep 28, 2018
54b303a
update miri
RalfJung Sep 29, 2018
0390736
Improve ux when calling associated functions with dot notation
dsciarra Sep 17, 2018
d654e3c
Improve bug! message for impossible case in Relate
phansch Sep 29, 2018
b315760
Rename sanitizer runtime libraries on OSX
alexcrichton Sep 29, 2018
af9eb4f
Correct doc for WorkQueue<T>::pop().
nieksand Sep 29, 2018
3e142b9
Added help message for `impl_trait_in_bindings` feature gate.
alexreg Sep 27, 2018
f937567
allow use of ./x.py help <cmd> ...
collin5 Oct 1, 2018
818a05d
Rollup merge of #53784 - tbu-:pr_doc_slice_isize_max, r=RalfJung
kennytm Oct 1, 2018
a1f3b0f
Rollup merge of #54308 - dsciarra:issue-22692, r=estebank
kennytm Oct 1, 2018
b188212
Rollup merge of #54488 - zackmdavis:and_the_case_of_the_unused_crate,…
kennytm Oct 1, 2018
4941670
Rollup merge of #54544 - frewsxcv:frewsxcv-deref, r=GuillaumeGomez
kennytm Oct 1, 2018
5bfd085
Rollup merge of #54623 - alexreg:impl_trait_in_bindings-help, r=estebank
kennytm Oct 1, 2018
41706ff
Rollup merge of #54641 - ljedrz:cleanup_rustc_infer, r=estebank
kennytm Oct 1, 2018
9ad783e
Rollup merge of #54656 - nieksand:workqueue_doc, r=varkor
kennytm Oct 1, 2018
23a993c
Rollup merge of #54679 - phansch:improve_bug_message, r=matthewjasper
kennytm Oct 1, 2018
7014afc
Rollup merge of #54681 - alexcrichton:san-names, r=kennytm
kennytm Oct 1, 2018
3401db0
Rollup merge of #54708 - collin5:b49475, r=Mark-Simulacrum
kennytm Oct 1, 2018
e68db04
Add nightly check for tool_lints warning
flip1995 Oct 1, 2018
94254d3
Rollup merge of #54674 - RalfJung:miri, r=oli-obk
kennytm Oct 1, 2018
4433116
Rollup merge of #54713 - flip1995:tool_lints_nightly, r=Manishearth
kennytm Oct 1, 2018
5b08200
Rollup merge of #54676 - pnkfelix:issue-15287-kill-zflag-disabling-as…
kennytm Oct 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,11 @@ def bootstrap(help_triggered):
def main():
"""Entry point for the bootstrap process"""
start_time = time()

# x.py help <cmd> ...
if len(sys.argv) > 1 and sys.argv[1] == 'help':
sys.argv = sys.argv[:1] + [sys.argv[2], '-h'] + sys.argv[3:]

help_triggered = (
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
try:
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ impl Step for StdLink {

fn copy_apple_sanitizer_dylibs(builder: &Builder, native_dir: &Path, platform: &str, into: &Path) {
for &sanitizer in &["asan", "tsan"] {
let filename = format!("libclang_rt.{}_{}_dynamic.dylib", sanitizer, platform);
let filename = format!("lib__rustc__clang_rt.{}_{}_dynamic.dylib", sanitizer, platform);
let mut src_path = native_dir.join(sanitizer);
src_path.push("build");
src_path.push("lib");
Expand Down
37 changes: 34 additions & 3 deletions src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,37 @@ pub struct NativeLibBoilerplate {
pub out_dir: PathBuf,
}

impl NativeLibBoilerplate {
/// On OSX we don't want to ship the exact filename that compiler-rt builds.
/// This conflicts with the system and ours is likely a wildly different
/// version, so they can't be substituted.
///
/// As a result, we rename it here but we need to also use
/// `install_name_tool` on OSX to rename the commands listed inside of it to
/// ensure it's linked against correctly.
pub fn fixup_sanitizer_lib_name(&self, sanitizer_name: &str) {
if env::var("TARGET").unwrap() != "x86_64-apple-darwin" {
return
}

let dir = self.out_dir.join("build/lib/darwin");
let name = format!("clang_rt.{}_osx_dynamic", sanitizer_name);
let src = dir.join(&format!("lib{}.dylib", name));
let new_name = format!("lib__rustc__{}.dylib", name);
let dst = dir.join(&new_name);

println!("{} => {}", src.display(), dst.display());
fs::rename(&src, &dst).unwrap();
let status = Command::new("install_name_tool")
.arg("-id")
.arg(format!("@rpath/{}", new_name))
.arg(&dst)
.status()
.expect("failed to execute `install_name_tool`");
assert!(status.success());
}
}

impl Drop for NativeLibBoilerplate {
fn drop(&mut self) {
if !thread::panicking() {
Expand Down Expand Up @@ -229,7 +260,7 @@ pub fn native_lib_boilerplate(
pub fn sanitizer_lib_boilerplate(sanitizer_name: &str)
-> Result<(NativeLibBoilerplate, String), ()>
{
let (link_name, search_path, dynamic) = match &*env::var("TARGET").unwrap() {
let (link_name, search_path, apple) = match &*env::var("TARGET").unwrap() {
"x86_64-unknown-linux-gnu" => (
format!("clang_rt.{}-x86_64", sanitizer_name),
"build/lib/linux",
Expand All @@ -242,8 +273,8 @@ pub fn sanitizer_lib_boilerplate(sanitizer_name: &str)
),
_ => return Err(()),
};
let to_link = if dynamic {
format!("dylib={}", link_name)
let to_link = if apple {
format!("dylib=__rustc__{}", link_name)
} else {
format!("static={}", link_name)
};
Expand Down
15 changes: 13 additions & 2 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@
//!
//! # Examples
//!
//! Creating a box:
//! Move a value from the stack to the heap by creating a [`Box`]:
//!
//! ```
//! let x = Box::new(5);
//! let val: u8 = 5;
//! let boxed: Box<u8> = Box::new(val);
//! ```
//!
//! Move a value from a [`Box`] back to the stack by [dereferencing]:
//!
//! ```
//! let boxed: Box<u8> = Box::new(5);
//! let val: u8 = *boxed;
//! ```
//!
//! Creating a recursive data structure:
Expand Down Expand Up @@ -52,6 +60,9 @@
//! elements are in the list, and so we don't know how much memory to allocate
//! for a `Cons`. By introducing a `Box`, which has a defined size, we know how
//! big `Cons` needs to be.
//!
//! [dereferencing]: ../../std/ops/trait.Deref.html
//! [`Box`]: struct.Box.html

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down
17 changes: 14 additions & 3 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use cmp::Ordering::{self, Less, Equal, Greater};
use cmp;
use fmt;
use intrinsics::assume;
use isize;
use iter::*;
use ops::{FnMut, Try, self};
use option::Option;
Expand Down Expand Up @@ -4080,6 +4081,9 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksExactMut<'a, T> {
/// them from other data. You can obtain a pointer that is usable as `data`
/// for zero-length slices using [`NonNull::dangling()`].
///
/// The total size of the slice must be no larger than `isize::MAX` **bytes**
/// in memory. See the safety documentation of [`pointer::offset`].
///
/// # Caveat
///
/// The lifetime for the returned slice is inferred from its usage. To
Expand All @@ -4101,10 +4105,13 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksExactMut<'a, T> {
/// ```
///
/// [`NonNull::dangling()`]: ../../std/ptr/struct.NonNull.html#method.dangling
/// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] {
debug_assert!(data as usize % mem::align_of::<T>() == 0, "attempt to create unaligned slice");
debug_assert!(mem::size_of::<T>().saturating_mul(len) <= isize::MAX as usize,
"attempt to create slice covering half the address space");
Repr { raw: FatPtr { data, len } }.rust
}

Expand All @@ -4114,15 +4121,19 @@ pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] {
/// This function is unsafe for the same reasons as [`from_raw_parts`], as well
/// as not being able to provide a non-aliasing guarantee of the returned
/// mutable slice. `data` must be non-null and aligned even for zero-length
/// slices as with [`from_raw_parts`]. See the documentation of
/// [`from_raw_parts`] for more details.
/// slices as with [`from_raw_parts`]. The total size of the slice must be no
/// larger than `isize::MAX` **bytes** in memory.
///
/// See the documentation of [`from_raw_parts`] for more details.
///
/// [`from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] {
debug_assert!(data as usize % mem::align_of::<T>() == 0, "attempt to create unaligned slice");
Repr { raw: FatPtr { data, len} }.rust_mut
debug_assert!(mem::size_of::<T>().saturating_mul(len) <= isize::MAX as usize,
"attempt to create slice covering half the address space");
Repr { raw: FatPtr { data, len } }.rust_mut
}

/// Converts a reference to T into a slice of length 1 (without copying).
Expand Down
Loading