Skip to content

Commit 1fbb277

Browse files
committed
---
yaml --- r: 167279 b: refs/heads/try c: 62c9a48 h: refs/heads/master i: 167277: 5b821ad 167275: 4a017b5 167271: 30fa86c 167263: 555ee36 v: v3
1 parent 0ca42fe commit 1fbb277

File tree

145 files changed

+2484
-1770
lines changed

Some content is hidden

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

145 files changed

+2484
-1770
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 023dfb0c898d851dee6ace2f8339b73b5287136b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 023dfb0c898d851dee6ace2f8339b73b5287136b
5-
refs/heads/try: 252423f8b75b25228090b7606c2afaa3fcc51835
5+
refs/heads/try: 62c9a48953d8bb47dcdba4d81e977839270916c9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/mk/crates.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@ DOC_CRATES := $(filter-out rustc, \
122122
$(filter-out rustc_borrowck, \
123123
$(filter-out rustc_resolve, \
124124
$(filter-out rustc_driver, \
125-
$(filter-out syntax, $(CRATES))))))))
125+
$(filter-out log, \
126+
$(filter-out regex, \
127+
$(filter-out regex_macros, \
128+
$(filter-out getopts, \
129+
$(filter-out time, \
130+
$(filter-out syntax, $(CRATES)))))))))))))
126131
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
127132
rustc_typeck rustc_driver syntax
128133

branches/try/mk/docs.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ LIB_DOC_DEP_$(1) = \
236236
$$(RSINPUTS_$(1)) \
237237
$$(RUSTDOC_EXE) \
238238
$$(foreach dep,$$(RUST_DEPS_$(1)), \
239-
$$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep) \
239+
$$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep)) \
240+
$$(foreach dep,$$(filter $$(DOC_CRATES), $$(RUST_DEPS_$(1))), \
240241
doc/$$(dep)/)
241242
else
242243
LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1))

branches/try/src/doc/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ fn main() {
483483
for i in range(0u, 3u) {
484484
let number = numbers.clone();
485485
Thread::spawn(move || {
486-
let mut array = number.lock();
486+
let mut array = number.lock().unwrap();
487487
488488
(*array)[i] += 1;
489489

branches/try/src/etc/rustup.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,18 @@ validate_opt() {
229229
done
230230
}
231231

232+
create_tmp_dir() {
233+
local TMP_DIR=./rustup-tmp-install
234+
235+
rm -Rf "${TMP_DIR}"
236+
need_ok "failed to remove temporary installation directory"
237+
238+
mkdir -p "${TMP_DIR}"
239+
need_ok "failed to create create temporary installation directory"
240+
241+
echo $TMP_DIR
242+
}
243+
232244
probe_need CFG_CURL curl
233245
probe_need CFG_TAR tar
234246
probe_need CFG_FILE file
@@ -401,7 +413,9 @@ then
401413
CFG_INSTALL_FLAGS="${CFG_INSTALL_FLAGS} --prefix=${CFG_PREFIX}"
402414
fi
403415

404-
CFG_TMP_DIR="./rustup-tmp-install"
416+
CFG_TMP_DIR=$(mktemp -d 2>/dev/null \
417+
|| mktemp -d -t 'rustup-tmp-install' 2>/dev/null \
418+
|| create_tmp_dir)
405419

406420
RUST_URL="https://static.rust-lang.org/dist"
407421
RUST_PACKAGE_NAME=rust-nightly
@@ -424,9 +438,6 @@ download_package() {
424438

425439
msg "Downloading ${remote_tarball} to ${local_tarball}"
426440

427-
mkdir -p "${CFG_TMP_DIR}"
428-
need_ok "failed to create create download directory"
429-
430441
"${CFG_CURL}" -f -o "${local_tarball}" "${remote_tarball}"
431442
if [ $? -ne 0 ]
432443
then

branches/try/src/liballoc/arc.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
//! let five = five.clone();
5959
//!
6060
//! Thread::spawn(move || {
61-
//! let mut number = five.lock();
61+
//! let mut number = five.lock().unwrap();
6262
//!
6363
//! *number += 1;
6464
//!
@@ -76,11 +76,11 @@ use core::default::Default;
7676
use core::kinds::{Sync, Send};
7777
use core::mem::{min_align_of, size_of, drop};
7878
use core::mem;
79+
use core::nonzero::NonZero;
7980
use core::ops::{Drop, Deref};
8081
use core::option::Option;
8182
use core::option::Option::{Some, None};
82-
use core::ptr::RawPtr;
83-
use core::ptr;
83+
use core::ptr::{mod, PtrExt};
8484
use heap::deallocate;
8585

8686
/// An atomically reference counted wrapper for shared state.
@@ -114,7 +114,7 @@ use heap::deallocate;
114114
pub struct Arc<T> {
115115
// FIXME #12808: strange name to try to avoid interfering with
116116
// field accesses of the contained type via Deref
117-
_ptr: *mut ArcInner<T>,
117+
_ptr: NonZero<*mut ArcInner<T>>,
118118
}
119119

120120
unsafe impl<T: Sync + Send> Send for Arc<T> { }
@@ -130,7 +130,7 @@ unsafe impl<T: Sync + Send> Sync for Arc<T> { }
130130
pub struct Weak<T> {
131131
// FIXME #12808: strange name to try to avoid interfering with
132132
// field accesses of the contained type via Deref
133-
_ptr: *mut ArcInner<T>,
133+
_ptr: NonZero<*mut ArcInner<T>>,
134134
}
135135

136136
unsafe impl<T: Sync + Send> Send for Weak<T> { }
@@ -165,7 +165,7 @@ impl<T> Arc<T> {
165165
weak: atomic::AtomicUint::new(1),
166166
data: data,
167167
};
168-
Arc { _ptr: unsafe { mem::transmute(x) } }
168+
Arc { _ptr: unsafe { NonZero::new(mem::transmute(x)) } }
169169
}
170170

171171
/// Downgrades the `Arc<T>` to a `Weak<T>` reference.
@@ -194,7 +194,7 @@ impl<T> Arc<T> {
194194
// pointer is valid. Furthermore, we know that the `ArcInner` structure itself is `Sync`
195195
// because the inner data is `Sync` as well, so we're ok loaning out an immutable pointer
196196
// to these contents.
197-
unsafe { &*self._ptr }
197+
unsafe { &**self._ptr }
198198
}
199199
}
200200

@@ -281,7 +281,7 @@ impl<T: Send + Sync + Clone> Arc<T> {
281281
// pointer that will ever be returned to T. Our reference count is guaranteed to be 1 at
282282
// this point, and we required the Arc itself to be `mut`, so we're returning the only
283283
// possible reference to the inner data.
284-
let inner = unsafe { &mut *self._ptr };
284+
let inner = unsafe { &mut **self._ptr };
285285
&mut inner.data
286286
}
287287
}
@@ -316,7 +316,8 @@ impl<T: Sync + Send> Drop for Arc<T> {
316316
fn drop(&mut self) {
317317
// This structure has #[unsafe_no_drop_flag], so this drop glue may run more than once (but
318318
// it is guaranteed to be zeroed after the first if it's run more than once)
319-
if self._ptr.is_null() { return }
319+
let ptr = *self._ptr;
320+
if ptr.is_null() { return }
320321

321322
// Because `fetch_sub` is already atomic, we do not need to synchronize with other threads
322323
// unless we are going to delete the object. This same logic applies to the below
@@ -346,7 +347,7 @@ impl<T: Sync + Send> Drop for Arc<T> {
346347

347348
if self.inner().weak.fetch_sub(1, atomic::Release) == 1 {
348349
atomic::fence(atomic::Acquire);
349-
unsafe { deallocate(self._ptr as *mut u8, size_of::<ArcInner<T>>(),
350+
unsafe { deallocate(ptr as *mut u8, size_of::<ArcInner<T>>(),
350351
min_align_of::<ArcInner<T>>()) }
351352
}
352353
}
@@ -386,7 +387,7 @@ impl<T: Sync + Send> Weak<T> {
386387
#[inline]
387388
fn inner(&self) -> &ArcInner<T> {
388389
// See comments above for why this is "safe"
389-
unsafe { &*self._ptr }
390+
unsafe { &**self._ptr }
390391
}
391392
}
392393

@@ -442,14 +443,16 @@ impl<T: Sync + Send> Drop for Weak<T> {
442443
/// } // implicit drop
443444
/// ```
444445
fn drop(&mut self) {
446+
let ptr = *self._ptr;
447+
445448
// see comments above for why this check is here
446-
if self._ptr.is_null() { return }
449+
if ptr.is_null() { return }
447450

448451
// If we find out that we were the last weak pointer, then its time to deallocate the data
449452
// entirely. See the discussion in Arc::drop() about the memory orderings
450453
if self.inner().weak.fetch_sub(1, atomic::Release) == 1 {
451454
atomic::fence(atomic::Acquire);
452-
unsafe { deallocate(self._ptr as *mut u8, size_of::<ArcInner<T>>(),
455+
unsafe { deallocate(ptr as *mut u8, size_of::<ArcInner<T>>(),
453456
min_align_of::<ArcInner<T>>()) }
454457
}
455458
}
@@ -719,7 +722,7 @@ mod tests {
719722

720723
let a = Arc::new(Cycle { x: Mutex::new(None) });
721724
let b = a.clone().downgrade();
722-
*a.x.lock() = Some(b);
725+
*a.x.lock().unwrap() = Some(b);
723726

724727
// hopefully we don't double-free (or leak)...
725728
}

branches/try/src/liballoc/heap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use core::ptr::RawPtr;
11+
use core::ptr::PtrExt;
1212

1313
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
1414

@@ -371,7 +371,7 @@ mod imp {
371371
mod test {
372372
extern crate test;
373373
use self::test::Bencher;
374-
use core::ptr::RawPtr;
374+
use core::ptr::PtrExt;
375375
use heap;
376376

377377
#[test]

branches/try/src/liballoc/rc.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ use core::fmt;
150150
use core::hash::{mod, Hash};
151151
use core::kinds::marker;
152152
use core::mem::{transmute, min_align_of, size_of, forget};
153+
use core::nonzero::NonZero;
153154
use core::ops::{Deref, Drop};
154155
use core::option::Option;
155156
use core::option::Option::{Some, None};
156-
use core::ptr;
157-
use core::ptr::RawPtr;
157+
use core::ptr::{mod, PtrExt};
158158
use core::result::Result;
159159
use core::result::Result::{Ok, Err};
160160

@@ -174,7 +174,7 @@ struct RcBox<T> {
174174
pub struct Rc<T> {
175175
// FIXME #12808: strange names to try to avoid interfering with field accesses of the contained
176176
// type via Deref
177-
_ptr: *mut RcBox<T>,
177+
_ptr: NonZero<*mut RcBox<T>>,
178178
_nosend: marker::NoSend,
179179
_noshare: marker::NoSync
180180
}
@@ -196,11 +196,11 @@ impl<T> Rc<T> {
196196
// there is an implicit weak pointer owned by all the strong pointers, which
197197
// ensures that the weak destructor never frees the allocation while the strong
198198
// destructor is running, even if the weak pointer is stored inside the strong one.
199-
_ptr: transmute(box RcBox {
199+
_ptr: NonZero::new(transmute(box RcBox {
200200
value: value,
201201
strong: Cell::new(1),
202202
weak: Cell::new(1)
203-
}),
203+
})),
204204
_nosend: marker::NoSend,
205205
_noshare: marker::NoSync
206206
}
@@ -281,7 +281,7 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> {
281281
let val = ptr::read(&*rc); // copy the contained object
282282
// destruct the box and skip our Drop
283283
// we can ignore the refcounts because we know we're unique
284-
deallocate(rc._ptr as *mut u8, size_of::<RcBox<T>>(),
284+
deallocate(*rc._ptr as *mut u8, size_of::<RcBox<T>>(),
285285
min_align_of::<RcBox<T>>());
286286
forget(rc);
287287
Ok(val)
@@ -311,7 +311,7 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> {
311311
#[experimental]
312312
pub fn get_mut<'a, T>(rc: &'a mut Rc<T>) -> Option<&'a mut T> {
313313
if is_unique(rc) {
314-
let inner = unsafe { &mut *rc._ptr };
314+
let inner = unsafe { &mut **rc._ptr };
315315
Some(&mut inner.value)
316316
} else {
317317
None
@@ -343,7 +343,7 @@ impl<T: Clone> Rc<T> {
343343
// pointer that will ever be returned to T. Our reference count is guaranteed to be 1 at
344344
// this point, and we required the `Rc<T>` itself to be `mut`, so we're returning the only
345345
// possible reference to the inner value.
346-
let inner = unsafe { &mut *self._ptr };
346+
let inner = unsafe { &mut **self._ptr };
347347
&mut inner.value
348348
}
349349
}
@@ -391,7 +391,8 @@ impl<T> Drop for Rc<T> {
391391
/// ```
392392
fn drop(&mut self) {
393393
unsafe {
394-
if !self._ptr.is_null() {
394+
let ptr = *self._ptr;
395+
if !ptr.is_null() {
395396
self.dec_strong();
396397
if self.strong() == 0 {
397398
ptr::read(&**self); // destroy the contained object
@@ -401,7 +402,7 @@ impl<T> Drop for Rc<T> {
401402
self.dec_weak();
402403

403404
if self.weak() == 0 {
404-
deallocate(self._ptr as *mut u8, size_of::<RcBox<T>>(),
405+
deallocate(ptr as *mut u8, size_of::<RcBox<T>>(),
405406
min_align_of::<RcBox<T>>())
406407
}
407408
}
@@ -618,7 +619,7 @@ impl<T: fmt::Show> fmt::Show for Rc<T> {
618619
pub struct Weak<T> {
619620
// FIXME #12808: strange names to try to avoid interfering with
620621
// field accesses of the contained type via Deref
621-
_ptr: *mut RcBox<T>,
622+
_ptr: NonZero<*mut RcBox<T>>,
622623
_nosend: marker::NoSend,
623624
_noshare: marker::NoSync
624625
}
@@ -682,12 +683,13 @@ impl<T> Drop for Weak<T> {
682683
/// ```
683684
fn drop(&mut self) {
684685
unsafe {
685-
if !self._ptr.is_null() {
686+
let ptr = *self._ptr;
687+
if !ptr.is_null() {
686688
self.dec_weak();
687689
// the weak count starts at 1, and will only go to zero if all the strong pointers
688690
// have disappeared.
689691
if self.weak() == 0 {
690-
deallocate(self._ptr as *mut u8, size_of::<RcBox<T>>(),
692+
deallocate(ptr as *mut u8, size_of::<RcBox<T>>(),
691693
min_align_of::<RcBox<T>>())
692694
}
693695
}
@@ -742,12 +744,12 @@ trait RcBoxPtr<T> {
742744

743745
impl<T> RcBoxPtr<T> for Rc<T> {
744746
#[inline(always)]
745-
fn inner(&self) -> &RcBox<T> { unsafe { &(*self._ptr) } }
747+
fn inner(&self) -> &RcBox<T> { unsafe { &(**self._ptr) } }
746748
}
747749

748750
impl<T> RcBoxPtr<T> for Weak<T> {
749751
#[inline(always)]
750-
fn inner(&self) -> &RcBox<T> { unsafe { &(*self._ptr) } }
752+
fn inner(&self) -> &RcBox<T> { unsafe { &(**self._ptr) } }
751753
}
752754

753755
#[cfg(test)]

0 commit comments

Comments
 (0)