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 #35945

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fe34c03
Implement `read_offset` and `write_offset`
tbu- Aug 15, 2016
7a92d0a
Move `flock.rs` from librustdoc to librustc_data_structures.
michaelwoerister Aug 12, 2016
0c44405
Clarify `read_offset` and `write_offset` documentation
tbu- Aug 17, 2016
a2ff0e2
Add some features to flock.
michaelwoerister Aug 15, 2016
d1d8258
Implement copy-on-write scheme for managing the incremental compilati…
michaelwoerister Aug 11, 2016
ef6aab2
Reduce duplication in std::sys::unix::rand.
habnabit Jul 29, 2016
0a70944
Use the kernel arc4rand for FreeBSD OsRng.
habnabit Aug 14, 2016
b40754f
modify fds-are-cloexec test to open a file that exists
Aug 21, 2016
1802011
Add tests for `std::fs::File::{read,write}_offset`
tbu- Aug 22, 2016
95d3cf3
incr.comp.: Move lock files out of directory being locked
michaelwoerister Aug 22, 2016
0f9cb1b
Change a weird line break in `core::str`
tbu- Aug 23, 2016
f863ea3
Update rust-installer. Fixes #35840
brson Aug 23, 2016
66a2578
Mark panicking tests as `should_panic` instead of `no_run`.
frewsxcv Aug 23, 2016
6b95606
rustc_trans: do not generate allocas for unused locals.
eddyb Aug 23, 2016
4e48924
Rename `{read,write}_offset` to `{read,write}_at`, add a tracking issue
tbu- Aug 23, 2016
dfe660e
Add E0478 error explanation
GuillaumeGomez Aug 23, 2016
012fb89
Add error code test checkup
GuillaumeGomez Aug 23, 2016
9747fa4
Add new error code tests
GuillaumeGomez Aug 23, 2016
2cad78d
replace `Div` example with something more evocative of division
matthew-piziak Aug 23, 2016
ebbf92d
Disable old trans access via -Z orbit, #[rustc_no_mir] or --disable-o…
eddyb Aug 16, 2016
8b0d3bb
rustc_trans: remove the bulk of old trans and most of its support code.
eddyb Aug 16, 2016
6bef6d5
Remove drop flags from structs and enums implementing Drop.
eddyb Aug 23, 2016
9a9cd63
Remove AST from metadata except for consts and const fns.
eddyb Aug 17, 2016
5ec6f39
Update E0195 to new error format
creativcoder Aug 10, 2016
702ea71
typeck: use NoExpectation to check return type of diverging fn
Aug 21, 2016
462ed98
Rollup merge of #35704 - tbu-:pr_pread_pwrite, r=sfackler
eddyb Aug 23, 2016
df1eee8
Rollup merge of #35718 - michaelwoerister:incr-comp-dir-locking, r=ni…
eddyb Aug 23, 2016
0cbc01f
Rollup merge of #35764 - eddyb:byegone, r=nikomatsakis
eddyb Aug 23, 2016
3837314
Rollup merge of #35883 - durka:gh35849, r=eddyb
eddyb Aug 23, 2016
55ffd92
Rollup merge of #35884 - habnabit:freebsd-arc4rand, r=alexcrichton
eddyb Aug 23, 2016
ddbc9c4
Rollup merge of #35885 - durka:gh35753, r=nagisa
eddyb Aug 23, 2016
e38e535
Rollup merge of #35910 - tbu-:pr_weird_linebreak, r=alexcrichton
eddyb Aug 23, 2016
97422c5
Rollup merge of #35912 - brson:rust-installer, r=alexcrichton
eddyb Aug 23, 2016
3357b0b
Rollup merge of #35913 - frewsxcv:panic, r=steveklabnik
eddyb Aug 23, 2016
c9cf66a
Rollup merge of #35916 - eddyb:mir-no-dead-allocas, r=Aatch
eddyb Aug 23, 2016
c506e16
Rollup merge of #35920 - GuillaumeGomez:err_codes, r=jonathandturner
eddyb Aug 23, 2016
f11f807
Rollup merge of #35936 - matthew-piziak:div-rational-example, r=Guill…
eddyb Aug 23, 2016
d7b694f
Rollup merge of #35939 - creativcoder:e0195, r=jonathandturner
eddyb Aug 23, 2016
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
3 changes: 0 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@ opt dist-host-only 0 "only install bins for the host architecture"
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
opt llvm-version-check 1 "check if the LLVM version is supported, build anyway"
opt rustbuild 0 "use the rust and cargo based build system"
opt orbit 1 "get MIR where it belongs - everywhere; most importantly, in orbit"
opt codegen-tests 1 "run the src/test/codegen tests"
opt option-checking 1 "complain about unrecognized options in this configure script"
opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)"
Expand Down Expand Up @@ -733,8 +732,6 @@ if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTION
if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi
if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi

if [ -n "$CFG_DISABLE_ORBIT" ]; then putvar CFG_DISABLE_ORBIT; fi

step_msg "looking for build programs"

probe_need CFG_CURL curl
Expand Down
7 changes: 3 additions & 4 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ DEPS_rustc := syntax fmt_macros flate arena serialize getopts rbml \
rustc_const_math syntax_pos rustc_errors
DEPS_rustc_back := std syntax flate log libc
DEPS_rustc_borrowck := rustc log graphviz syntax syntax_pos rustc_errors rustc_mir
DEPS_rustc_data_structures := std log serialize
DEPS_rustc_data_structures := std log serialize libc
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \
rustc_trans rustc_privacy rustc_lint rustc_plugin \
Expand All @@ -137,9 +137,8 @@ DEPS_rustc_save_analysis := rustc log syntax syntax_pos serialize
DEPS_rustc_typeck := rustc syntax syntax_pos rustc_platform_intrinsics rustc_const_math \
rustc_const_eval rustc_errors

DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
test rustc_lint rustc_const_eval syntax_pos

DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts test \
rustc_lint rustc_const_eval syntax_pos rustc_data_structures

TOOL_DEPS_compiletest := test getopts log serialize
TOOL_DEPS_rustdoc := rustdoc
Expand Down
6 changes: 0 additions & 6 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,6 @@ ifdef CFG_ENABLE_DEBUGINFO
CFG_RUSTC_FLAGS += -g
endif

ifdef CFG_DISABLE_ORBIT
$(info cfg: HOLD HOLD HOLD (CFG_DISABLE_ORBIT))
RUSTFLAGS_STAGE1 += -Z orbit=off
RUSTFLAGS_STAGE2 += -Z orbit=off
endif

ifdef SAVE_TEMPS
CFG_RUSTC_FLAGS += -C save-temps
endif
Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ Here are some common macros you’ll see in Rust code.
This macro causes the current thread to panic. You can give it a message
to panic with:

```rust,no_run
```rust,should_panic
panic!("oh no!");
```

Expand All @@ -688,7 +688,7 @@ These two macros are used in tests. `assert!` takes a boolean. `assert_eq!`
takes two values and checks them for equality. `true` passes, `false` `panic!`s.
Like this:

```rust,no_run
```rust,should_panic
// A-ok!

assert!(true);
Expand Down
19 changes: 2 additions & 17 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
/// }
/// ```

#[unsafe_no_drop_flag]
#[cfg_attr(stage0, unsafe_no_drop_flag)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Arc<T: ?Sized> {
ptr: Shared<ArcInner<T>>,
Expand All @@ -147,7 +147,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
/// nodes behind strong `Arc<T>` pointers, and then storing the parent pointers
/// as `Weak<T>` pointers.

#[unsafe_no_drop_flag]
#[cfg_attr(stage0, unsafe_no_drop_flag)]
#[stable(feature = "arc_weak", since = "1.4.0")]
pub struct Weak<T: ?Sized> {
ptr: Shared<ArcInner<T>>,
Expand Down Expand Up @@ -559,15 +559,6 @@ impl<T: ?Sized> Drop for Arc<T> {
#[unsafe_destructor_blind_to_params]
#[inline]
fn drop(&mut self) {
// This structure has #[unsafe_no_drop_flag], so this drop glue may run
// more than once (but it is guaranteed to be zeroed after the first if
// it's run more than once)
let thin = *self.ptr as *const ();

if thin as usize == mem::POST_DROP_USIZE {
return;
}

// Because `fetch_sub` is already atomic, we do not need to synchronize
// with other threads unless we are going to delete the object. This
// same logic applies to the below `fetch_sub` to the `weak` count.
Expand Down Expand Up @@ -755,12 +746,6 @@ impl<T: ?Sized> Drop for Weak<T> {
/// ```
fn drop(&mut self) {
let ptr = *self.ptr;
let thin = ptr as *const ();

// see comments above for why this check is here
if thin as usize == mem::POST_DROP_USIZE {
return;
}

// If we find out that we were the last weak pointer, then its time to
// deallocate the data entirely. See the discussion in Arc::drop() about
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
#![feature(staged_api)]
#![feature(unboxed_closures)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag, filling_drop)]
#![cfg_attr(stage0, feature(unsafe_no_drop_flag))]
#![feature(unsize)]

#![cfg_attr(not(test), feature(fused, raw, fn_traits, placement_new_protocol))]
Expand Down
11 changes: 2 additions & 9 deletions src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use core::cmp;
/// `shrink_to_fit`, and `from_box` will actually set RawVec's private capacity
/// field. This allows zero-sized types to not be special-cased by consumers of
/// this type.
#[unsafe_no_drop_flag]
#[cfg_attr(stage0, unsafe_no_drop_flag)]
pub struct RawVec<T> {
ptr: Unique<T>,
cap: usize,
Expand Down Expand Up @@ -546,21 +546,14 @@ impl<T> RawVec<T> {
mem::forget(self);
output
}

/// This is a stupid name in the hopes that someone will find this in the
/// not too distant future and remove it with the rest of
/// #[unsafe_no_drop_flag]
pub fn unsafe_no_drop_flag_needs_drop(&self) -> bool {
self.cap != mem::POST_DROP_USIZE
}
}

impl<T> Drop for RawVec<T> {
#[unsafe_destructor_blind_to_params]
/// Frees the memory owned by the RawVec *without* trying to Drop its contents.
fn drop(&mut self) {
let elem_size = mem::size_of::<T>();
if elem_size != 0 && self.cap != 0 && self.unsafe_no_drop_flag_needs_drop() {
if elem_size != 0 && self.cap != 0 {
let align = mem::align_of::<T>();

let num_bytes = elem_size * self.cap;
Expand Down
38 changes: 16 additions & 22 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ struct RcBox<T: ?Sized> {
/// A reference-counted pointer type over an immutable value.
///
/// See the [module level documentation](./index.html) for more details.
#[unsafe_no_drop_flag]
#[cfg_attr(stage0, unsafe_no_drop_flag)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Rc<T: ?Sized> {
ptr: Shared<RcBox<T>>,
Expand Down Expand Up @@ -466,21 +466,18 @@ impl<T: ?Sized> Drop for Rc<T> {
fn drop(&mut self) {
unsafe {
let ptr = *self.ptr;
let thin = ptr as *const ();

if thin as usize != mem::POST_DROP_USIZE {
self.dec_strong();
if self.strong() == 0 {
// destroy the contained object
ptr::drop_in_place(&mut (*ptr).value);
self.dec_strong();
if self.strong() == 0 {
// destroy the contained object
ptr::drop_in_place(&mut (*ptr).value);

// remove the implicit "strong weak" pointer now that we've
// destroyed the contents.
self.dec_weak();
// remove the implicit "strong weak" pointer now that we've
// destroyed the contents.
self.dec_weak();

if self.weak() == 0 {
deallocate(ptr as *mut u8, size_of_val(&*ptr), align_of_val(&*ptr))
}
if self.weak() == 0 {
deallocate(ptr as *mut u8, size_of_val(&*ptr), align_of_val(&*ptr))
}
}
}
Expand Down Expand Up @@ -724,7 +721,7 @@ impl<T> From<T> for Rc<T> {
/// dropped.
///
/// See the [module level documentation](./index.html) for more.
#[unsafe_no_drop_flag]
#[cfg_attr(stage0, unsafe_no_drop_flag)]
#[stable(feature = "rc_weak", since = "1.4.0")]
pub struct Weak<T: ?Sized> {
ptr: Shared<RcBox<T>>,
Expand Down Expand Up @@ -825,15 +822,12 @@ impl<T: ?Sized> Drop for Weak<T> {
fn drop(&mut self) {
unsafe {
let ptr = *self.ptr;
let thin = ptr as *const ();

if thin as usize != mem::POST_DROP_USIZE {
self.dec_weak();
// the weak count starts at 1, and will only go to zero if all
// the strong pointers have disappeared.
if self.weak() == 0 {
deallocate(ptr as *mut u8, size_of_val(&*ptr), align_of_val(&*ptr))
}
self.dec_weak();
// the weak count starts at 1, and will only go to zero if all
// the strong pointers have disappeared.
if self.weak() == 0 {
deallocate(ptr as *mut u8, size_of_val(&*ptr), align_of_val(&*ptr))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#![feature(step_by)]
#![feature(unicode)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag)]
#![cfg_attr(stage0, feature(unsafe_no_drop_flag))]
#![cfg_attr(test, feature(rand, test))]

#![no_std]
Expand Down
10 changes: 4 additions & 6 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ use super::range::RangeArgument;
/// Vec does not currently guarantee the order in which elements are dropped
/// (the order has changed in the past, and may change again).
///
#[unsafe_no_drop_flag]
#[cfg_attr(stage0, unsafe_no_drop_flag)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Vec<T> {
buf: RawVec<T>,
Expand Down Expand Up @@ -1600,11 +1600,9 @@ impl<T: Ord> Ord for Vec<T> {
impl<T> Drop for Vec<T> {
#[unsafe_destructor_blind_to_params]
fn drop(&mut self) {
if self.buf.unsafe_no_drop_flag_needs_drop() {
unsafe {
// use drop for [T]
ptr::drop_in_place(&mut self[..]);
}
unsafe {
// use drop for [T]
ptr::drop_in_place(&mut self[..]);
}
// RawVec handles deallocation
}
Expand Down
13 changes: 0 additions & 13 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,6 @@ extern "rust-intrinsic" {
/// crate it is invoked in.
pub fn type_id<T: ?Sized + 'static>() -> u64;

/// Creates a value initialized to so that its drop flag,
/// if any, says that it has been dropped.
///
/// `init_dropped` is unsafe because it returns a datum with all
/// of its bytes set to the drop flag, which generally does not
/// correspond to a valid value.
///
/// This intrinsic is likely to be deprecated in the future when
/// Rust moves to non-zeroing dynamic drop (and thus removes the
/// embedded drop flags that are being established by this
/// intrinsic).
pub fn init_dropped<T>() -> T;

/// Creates a value initialized to zero.
///
/// `init` is unsafe because it returns a zeroed-out datum,
Expand Down
71 changes: 0 additions & 71 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,27 +241,6 @@ pub unsafe fn zeroed<T>() -> T {
intrinsics::init()
}

/// Creates a value initialized to an unspecified series of bytes.
///
/// The byte sequence usually indicates that the value at the memory
/// in question has been dropped. Thus, *if* T carries a drop flag,
/// any associated destructor will not be run when the value falls out
/// of scope.
///
/// Some code at one time used the `zeroed` function above to
/// accomplish this goal.
///
/// This function is expected to be deprecated with the transition
/// to non-zeroing drop.
#[inline]
#[unstable(feature = "filling_drop", issue = "5016")]
pub unsafe fn dropped<T>() -> T {
#[inline(always)]
unsafe fn dropped_impl<T>() -> T { intrinsics::init_dropped() }

dropped_impl()
}

/// Bypasses Rust's normal memory-initialization checks by pretending to
/// produce a value of type T, while doing nothing at all.
///
Expand Down Expand Up @@ -518,56 +497,6 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
#[stable(feature = "rust1", since = "1.0.0")]
pub fn drop<T>(_x: T) { }

macro_rules! repeat_u8_as_u16 {
($name:expr) => { (($name as u16) << 8 |
($name as u16)) }
}
macro_rules! repeat_u8_as_u32 {
($name:expr) => { (($name as u32) << 24 |
($name as u32) << 16 |
($name as u32) << 8 |
($name as u32)) }
}
macro_rules! repeat_u8_as_u64 {
($name:expr) => { ((repeat_u8_as_u32!($name) as u64) << 32 |
(repeat_u8_as_u32!($name) as u64)) }
}

// NOTE: Keep synchronized with values used in librustc_trans::trans::adt.
//
// In particular, the POST_DROP_U8 marker must never equal the
// DTOR_NEEDED_U8 marker.
//
// For a while pnkfelix was using 0xc1 here.
// But having the sign bit set is a pain, so 0x1d is probably better.
//
// And of course, 0x00 brings back the old world of zero'ing on drop.
#[unstable(feature = "filling_drop", issue = "5016")]
#[allow(missing_docs)]
pub const POST_DROP_U8: u8 = 0x1d;
#[unstable(feature = "filling_drop", issue = "5016")]
#[allow(missing_docs)]
pub const POST_DROP_U16: u16 = repeat_u8_as_u16!(POST_DROP_U8);
#[unstable(feature = "filling_drop", issue = "5016")]
#[allow(missing_docs)]
pub const POST_DROP_U32: u32 = repeat_u8_as_u32!(POST_DROP_U8);
#[unstable(feature = "filling_drop", issue = "5016")]
#[allow(missing_docs)]
pub const POST_DROP_U64: u64 = repeat_u8_as_u64!(POST_DROP_U8);

#[cfg(target_pointer_width = "16")]
#[unstable(feature = "filling_drop", issue = "5016")]
#[allow(missing_docs)]
pub const POST_DROP_USIZE: usize = POST_DROP_U16 as usize;
#[cfg(target_pointer_width = "32")]
#[unstable(feature = "filling_drop", issue = "5016")]
#[allow(missing_docs)]
pub const POST_DROP_USIZE: usize = POST_DROP_U32 as usize;
#[cfg(target_pointer_width = "64")]
#[unstable(feature = "filling_drop", issue = "5016")]
#[allow(missing_docs)]
pub const POST_DROP_USIZE: usize = POST_DROP_U64 as usize;

/// Interprets `src` as `&U`, and then reads `src` without moving the contained
/// value.
///
Expand Down
Loading