Skip to content

Commit 9fb0d4f

Browse files
committed
---
yaml --- r: 195135 b: refs/heads/tmp c: c0dd239 h: refs/heads/master i: 195133: 2e73ffb 195131: cbecef7 195127: ca7fba7 195119: be7d44e 195103: 12812cb 195071: ae83afa v: v3
1 parent 414de30 commit 9fb0d4f

Some content is hidden

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

57 files changed

+249
-1253
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: d8be84eb4499e21bd98a3500c8760540996df23b
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: be7f6ac7008f8ddf980ac07026b05bdd865f29cc
37+
refs/heads/tmp: c0dd239753ab22d059531472b3895669ce44a875
3838
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3939
refs/tags/homu-tmp: 53a183f0274316596bf9405944d4f0468d8c93e4
4040
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/liballoc/arc.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ impl<T> Drop for Arc<T> {
354354
// more than once (but it is guaranteed to be zeroed after the first if
355355
// it's run more than once)
356356
let ptr = *self._ptr;
357-
// if ptr.is_null() { return }
358-
if ptr.is_null() || ptr as usize == mem::POST_DROP_USIZE { return }
357+
if ptr.is_null() { return }
359358

360359
// Because `fetch_sub` is already atomic, we do not need to synchronize
361360
// with other threads unless we are going to delete the object. This
@@ -486,7 +485,7 @@ impl<T> Drop for Weak<T> {
486485
let ptr = *self._ptr;
487486

488487
// see comments above for why this check is here
489-
if ptr.is_null() || ptr as usize == mem::POST_DROP_USIZE { return }
488+
if ptr.is_null() { return }
490489

491490
// If we find out that we were the last weak pointer, then its time to
492491
// deallocate the data entirely. See the discussion in Arc::drop() about

branches/tmp/src/liballoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
#![feature(box_syntax)]
7676
#![feature(optin_builtin_traits)]
7777
#![feature(unboxed_closures)]
78-
#![feature(unsafe_no_drop_flag, filling_drop)]
78+
#![feature(unsafe_no_drop_flag)]
7979
#![feature(core)]
8080
#![feature(unique)]
8181
#![cfg_attr(test, feature(test, alloc, rustc_private))]

branches/tmp/src/liballoc/rc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ use core::default::Default;
160160
use core::fmt;
161161
use core::hash::{Hasher, Hash};
162162
use core::marker;
163-
use core::mem::{self, min_align_of, size_of, forget};
163+
use core::mem::{min_align_of, size_of, forget};
164164
use core::nonzero::NonZero;
165165
use core::ops::{Deref, Drop};
166166
use core::option::Option;
@@ -407,7 +407,7 @@ impl<T> Drop for Rc<T> {
407407
fn drop(&mut self) {
408408
unsafe {
409409
let ptr = *self._ptr;
410-
if !ptr.is_null() && ptr as usize != mem::POST_DROP_USIZE {
410+
if !ptr.is_null() {
411411
self.dec_strong();
412412
if self.strong() == 0 {
413413
ptr::read(&**self); // destroy the contained object
@@ -718,7 +718,7 @@ impl<T> Drop for Weak<T> {
718718
fn drop(&mut self) {
719719
unsafe {
720720
let ptr = *self._ptr;
721-
if !ptr.is_null() && ptr as usize != mem::POST_DROP_USIZE {
721+
if !ptr.is_null() {
722722
self.dec_weak();
723723
// the weak count starts at 1, and will only go to zero if all
724724
// the strong pointers have disappeared.

branches/tmp/src/libcollections/btree/map.rs

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,39 +1143,15 @@ impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> {
11431143
}
11441144

11451145
impl<'a, K: Ord, V> Entry<'a, K, V> {
1146+
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
11461147
#[unstable(feature = "std_misc",
11471148
reason = "will soon be replaced by or_insert")]
1148-
#[deprecated(since = "1.0",
1149-
reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")]
1150-
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
11511149
pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> {
11521150
match self {
11531151
Occupied(entry) => Ok(entry.into_mut()),
11541152
Vacant(entry) => Err(entry),
11551153
}
11561154
}
1157-
1158-
#[unstable(feature = "collections",
1159-
reason = "matches entry v3 specification, waiting for dust to settle")]
1160-
/// Ensures a value is in the entry by inserting the default if empty, and returns
1161-
/// a mutable reference to the value in the entry.
1162-
pub fn or_insert(self, default: V) -> &'a mut V {
1163-
match self {
1164-
Occupied(entry) => entry.into_mut(),
1165-
Vacant(entry) => entry.insert(default),
1166-
}
1167-
}
1168-
1169-
#[unstable(feature = "collections",
1170-
reason = "matches entry v3 specification, waiting for dust to settle")]
1171-
/// Ensures a value is in the entry by inserting the result of the default function if empty,
1172-
/// and returns a mutable reference to the value in the entry.
1173-
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
1174-
match self {
1175-
Occupied(entry) => entry.into_mut(),
1176-
Vacant(entry) => entry.insert(default()),
1177-
}
1178-
}
11791155
}
11801156

11811157
impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
@@ -1587,12 +1563,21 @@ impl<K: Ord, V> BTreeMap<K, V> {
15871563
/// ```
15881564
/// # #![feature(collections)]
15891565
/// use std::collections::BTreeMap;
1566+
/// use std::collections::btree_map::Entry;
15901567
///
15911568
/// let mut count: BTreeMap<&str, usize> = BTreeMap::new();
15921569
///
15931570
/// // count the number of occurrences of letters in the vec
1594-
/// for x in vec!["a","b","a","c","a","b"] {
1595-
/// *count.entry(x).or_insert(0) += 1;
1571+
/// for x in vec!["a","b","a","c","a","b"].iter() {
1572+
/// match count.entry(*x) {
1573+
/// Entry::Vacant(view) => {
1574+
/// view.insert(1);
1575+
/// },
1576+
/// Entry::Occupied(mut view) => {
1577+
/// let v = view.get_mut();
1578+
/// *v += 1;
1579+
/// },
1580+
/// }
15961581
/// }
15971582
///
15981583
/// assert_eq!(count["a"], 3);

branches/tmp/src/libcollections/btree/node.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,9 @@ impl<T> Drop for RawItems<T> {
280280
#[unsafe_destructor]
281281
impl<K, V> Drop for Node<K, V> {
282282
fn drop(&mut self) {
283-
if self.keys.is_null() ||
284-
(unsafe { self.keys.get() as *const K as usize == mem::POST_DROP_USIZE })
285-
{
283+
if self.keys.is_null() {
286284
// Since we have #[unsafe_no_drop_flag], we have to watch
287-
// out for the sentinel value being stored in self.keys. (Using
285+
// out for a null value being stored in self.keys. (Using
288286
// null is technically a violation of the `Unique`
289287
// requirements, though.)
290288
return;

branches/tmp/src/libcollections/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#![feature(unicode)]
3737
#![feature(unsafe_destructor)]
3838
#![feature(unique)]
39-
#![feature(unsafe_no_drop_flag, filling_drop)]
39+
#![feature(unsafe_no_drop_flag)]
4040
#![feature(step_by)]
4141
#![feature(str_char)]
4242
#![feature(convert)]

branches/tmp/src/libcollections/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,7 @@ impl<T> Drop for Vec<T> {
16941694
fn drop(&mut self) {
16951695
// This is (and should always remain) a no-op if the fields are
16961696
// zeroed (when moving out, because of #[unsafe_no_drop_flag]).
1697-
if self.cap != 0 && self.cap != mem::POST_DROP_USIZE {
1697+
if self.cap != 0 {
16981698
unsafe {
16991699
for x in &*self {
17001700
ptr::read(x);
@@ -1977,7 +1977,7 @@ impl<'a, T> ExactSizeIterator for Drain<'a, T> {}
19771977
#[stable(feature = "rust1", since = "1.0.0")]
19781978
impl<'a, T> Drop for Drain<'a, T> {
19791979
fn drop(&mut self) {
1980-
// self.ptr == self.end == mem::POST_DROP_USIZE if drop has already been called,
1980+
// self.ptr == self.end == null if drop has already been called,
19811981
// so we can use #[unsafe_no_drop_flag].
19821982

19831983
// destroy the remaining elements

branches/tmp/src/libcollections/vec_map.rs

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -632,12 +632,21 @@ impl<V> VecMap<V> {
632632
/// ```
633633
/// # #![feature(collections)]
634634
/// use std::collections::VecMap;
635+
/// use std::collections::vec_map::Entry;
635636
///
636637
/// let mut count: VecMap<u32> = VecMap::new();
637638
///
638639
/// // count the number of occurrences of numbers in the vec
639-
/// for x in vec![1, 2, 1, 2, 3, 4, 1, 2, 4] {
640-
/// *count.entry(x).or_insert(0) += 1;
640+
/// for x in vec![1, 2, 1, 2, 3, 4, 1, 2, 4].iter() {
641+
/// match count.entry(*x) {
642+
/// Entry::Vacant(view) => {
643+
/// view.insert(1);
644+
/// },
645+
/// Entry::Occupied(mut view) => {
646+
/// let v = view.get_mut();
647+
/// *v += 1;
648+
/// },
649+
/// }
641650
/// }
642651
///
643652
/// assert_eq!(count[1], 3);
@@ -666,37 +675,13 @@ impl<V> VecMap<V> {
666675
impl<'a, V> Entry<'a, V> {
667676
#[unstable(feature = "collections",
668677
reason = "will soon be replaced by or_insert")]
669-
#[deprecated(since = "1.0",
670-
reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")]
671678
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
672679
pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, V>> {
673680
match self {
674681
Occupied(entry) => Ok(entry.into_mut()),
675682
Vacant(entry) => Err(entry),
676683
}
677684
}
678-
679-
#[unstable(feature = "collections",
680-
reason = "matches entry v3 specification, waiting for dust to settle")]
681-
/// Ensures a value is in the entry by inserting the default if empty, and returns
682-
/// a mutable reference to the value in the entry.
683-
pub fn or_insert(self, default: V) -> &'a mut V {
684-
match self {
685-
Occupied(entry) => entry.into_mut(),
686-
Vacant(entry) => entry.insert(default),
687-
}
688-
}
689-
690-
#[unstable(feature = "collections",
691-
reason = "matches entry v3 specification, waiting for dust to settle")]
692-
/// Ensures a value is in the entry by inserting the result of the default function if empty,
693-
/// and returns a mutable reference to the value in the entry.
694-
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
695-
match self {
696-
Occupied(entry) => entry.into_mut(),
697-
Vacant(entry) => entry.insert(default()),
698-
}
699-
}
700685
}
701686

702687
impl<'a, V> VacantEntry<'a, V> {

branches/tmp/src/libcore/intrinsics.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -191,35 +191,13 @@ extern "rust-intrinsic" {
191191
/// crate it is invoked in.
192192
pub fn type_id<T: ?Sized + 'static>() -> u64;
193193

194-
/// Create a value initialized to so that its drop flag,
195-
/// if any, says that it has been dropped.
196-
///
197-
/// `init_dropped` is unsafe because it returns a datum with all
198-
/// of its bytes set to the drop flag, which generally does not
199-
/// correspond to a valid value.
200-
///
201-
/// This intrinsic is likely to be deprecated in the future when
202-
/// Rust moves to non-zeroing dynamic drop (and thus removes the
203-
/// embedded drop flags that are being established by this
204-
/// intrinsic).
205-
#[cfg(not(stage0))]
206-
pub fn init_dropped<T>() -> T;
207-
208194
/// Create a value initialized to zero.
209195
///
210196
/// `init` is unsafe because it returns a zeroed-out datum,
211-
/// which is unsafe unless T is `Copy`. Also, even if T is
212-
/// `Copy`, an all-zero value may not correspond to any legitimate
213-
/// state for the type in question.
197+
/// which is unsafe unless T is Copy.
214198
pub fn init<T>() -> T;
215199

216200
/// Create an uninitialized value.
217-
///
218-
/// `uninit` is unsafe because there is no guarantee of what its
219-
/// contents are. In particular its drop-flag may be set to any
220-
/// state, which means it may claim either dropped or
221-
/// undropped. In the general case one must use `ptr::write` to
222-
/// initialize memory previous set to the result of `uninit`.
223201
pub fn uninit<T>() -> T;
224202

225203
/// Move a value out of scope without running drop glue.

branches/tmp/src/libcore/mem.rs

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -158,32 +158,6 @@ pub unsafe fn zeroed<T>() -> T {
158158
intrinsics::init()
159159
}
160160

161-
/// Create a value initialized to an unspecified series of bytes.
162-
///
163-
/// The byte sequence usually indicates that the value at the memory
164-
/// in question has been dropped. Thus, *if* T carries a drop flag,
165-
/// any associated destructor will not be run when the value falls out
166-
/// of scope.
167-
///
168-
/// Some code at one time used the `zeroed` function above to
169-
/// accomplish this goal.
170-
///
171-
/// This function is expected to be deprecated with the transition
172-
/// to non-zeroing drop.
173-
#[inline]
174-
#[unstable(feature = "filling_drop")]
175-
pub unsafe fn dropped<T>() -> T {
176-
#[cfg(stage0)]
177-
#[inline(always)]
178-
unsafe fn dropped_impl<T>() -> T { zeroed() }
179-
180-
#[cfg(not(stage0))]
181-
#[inline(always)]
182-
unsafe fn dropped_impl<T>() -> T { intrinsics::init_dropped() }
183-
184-
dropped_impl()
185-
}
186-
187161
/// Create an uninitialized value.
188162
///
189163
/// Care must be taken when using this function, if the type `T` has a destructor and the value
@@ -317,49 +291,6 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
317291
#[stable(feature = "rust1", since = "1.0.0")]
318292
pub fn drop<T>(_x: T) { }
319293

320-
macro_rules! repeat_u8_as_u32 {
321-
($name:expr) => { (($name as u32) << 24 |
322-
($name as u32) << 16 |
323-
($name as u32) << 8 |
324-
($name as u32)) }
325-
}
326-
macro_rules! repeat_u8_as_u64 {
327-
($name:expr) => { ((repeat_u8_as_u32!($name) as u64) << 32 |
328-
(repeat_u8_as_u32!($name) as u64)) }
329-
}
330-
331-
// NOTE: Keep synchronized with values used in librustc_trans::trans::adt.
332-
//
333-
// In particular, the POST_DROP_U8 marker must never equal the
334-
// DTOR_NEEDED_U8 marker.
335-
//
336-
// For a while pnkfelix was using 0xc1 here.
337-
// But having the sign bit set is a pain, so 0x1d is probably better.
338-
//
339-
// And of course, 0x00 brings back the old world of zero'ing on drop.
340-
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
341-
pub const POST_DROP_U8: u8 = 0x1d;
342-
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
343-
pub const POST_DROP_U32: u32 = repeat_u8_as_u32!(POST_DROP_U8);
344-
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
345-
pub const POST_DROP_U64: u64 = repeat_u8_as_u64!(POST_DROP_U8);
346-
347-
#[cfg(target_pointer_width = "32")]
348-
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
349-
pub const POST_DROP_USIZE: usize = POST_DROP_U32 as usize;
350-
#[cfg(target_pointer_width = "64")]
351-
#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
352-
pub const POST_DROP_USIZE: usize = POST_DROP_U64 as usize;
353-
354-
#[cfg(stage0)] #[unstable(feature = "filling_drop")]
355-
pub const POST_DROP_U8: u8 = 0;
356-
#[cfg(stage0)] #[unstable(feature = "filling_drop")]
357-
pub const POST_DROP_U32: u32 = 0;
358-
#[cfg(stage0)] #[unstable(feature = "filling_drop")]
359-
pub const POST_DROP_U64: u64 = 0;
360-
#[cfg(stage0)] #[unstable(feature = "filling_drop")]
361-
pub const POST_DROP_USIZE: usize = 0;
362-
363294
/// Interprets `src` as `&U`, and then reads `src` without moving the contained value.
364295
///
365296
/// This function will unsafely assume the pointer `src` is valid for `sizeof(U)` bytes by

branches/tmp/src/libcore/ptr.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,21 +230,6 @@ pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
230230
tmp
231231
}
232232

233-
/// Variant of read_and_zero that writes the specific drop-flag byte
234-
/// (which may be more appropriate than zero).
235-
#[inline(always)]
236-
#[unstable(feature = "core",
237-
reason = "may play a larger role in std::ptr future extensions")]
238-
pub unsafe fn read_and_drop<T>(dest: *mut T) -> T {
239-
// Copy the data out from `dest`:
240-
let tmp = read(&*dest);
241-
242-
// Now mark `dest` as dropped:
243-
write_bytes(dest, mem::POST_DROP_U8, 1);
244-
245-
tmp
246-
}
247-
248233
/// Overwrites a memory location with the given value without reading or
249234
/// dropping the old value.
250235
///

branches/tmp/src/librustc/metadata/loader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ impl<'a> Context<'a> {
426426
info!("lib candidate: {}", path.display());
427427

428428
let hash_str = hash.to_string();
429-
let slot = candidates.entry(hash_str)
430-
.or_insert_with(|| (HashMap::new(), HashMap::new()));
429+
let slot = candidates.entry(hash_str).get().unwrap_or_else(
430+
|vacant_entry| vacant_entry.insert((HashMap::new(), HashMap::new())));
431431
let (ref mut rlibs, ref mut dylibs) = *slot;
432432
if rlib {
433433
rlibs.insert(fs::realpath(path).unwrap(), kind);

0 commit comments

Comments
 (0)