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 PRs in the queue; Wednesday #22796

Merged
merged 62 commits into from
Feb 25, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
efd2a17
Deprecate std::sync::TaskPool
aturon Feb 17, 2015
64fe93e
std: Tidy up some `unsafe impl`s for `sync`
alexcrichton Feb 20, 2015
d443f98
Apply borrowck to fns that appear in const declarations.
nikomatsakis Feb 23, 2015
d0c589d
Hide unnecessary error checking from the user
tbu- Feb 23, 2015
79bf783
std: Handle a trailing slash in create_dir_all
alexcrichton Feb 23, 2015
537d694
std: Expose a `mode` accessor for Permissions on unix
alexcrichton Feb 23, 2015
948a17e
Stop parsing "-" as integer, fixes #22745
krdln Feb 24, 2015
fcf7023
Properly reimplement `unsafe-code` lint to honor changing lint attrib…
ipetkov Feb 24, 2015
23f5a8f
std::io::BufReader: remove leftover lifetime parameter on get_ref()
mzabaluev Feb 24, 2015
a9f6f4b
Add missing `fn`
krdln Feb 24, 2015
0afebe6
Replace deprecated getdtablesize() with sysconf(_SC_OPEN_MAX) for and…
ejjeong Feb 24, 2015
0bea550
style nitpicks
Feb 24, 2015
01385a2
iOS: Sync/Send fallout
vhbit Feb 24, 2015
54b1106
Revert a wrong replace of "fail" to "panic"
tbu- Feb 24, 2015
0fc1a7d
Improve readability of an error check in `set_non_blocking`
tbu- Feb 24, 2015
f31ea22
Mention try macro in error chapter
steveklabnik Feb 17, 2015
2807a1c
Use arrays instead of vectors in tests
petrochenkov Feb 24, 2015
c11807d
Fix broken tests
petrochenkov Feb 24, 2015
0e36a27
Rollup merge of #22623 - petrochenkov:optest, r=alexcrichton
Manishearth Feb 24, 2015
5af3d66
Rollup merge of #22739 - tbu-:pr_error_net, r=alexcrichton
Manishearth Feb 24, 2015
ad73cb0
Rollup merge of #22747 - krdln:fix-parsing-minus, r=alexcrichton
Manishearth Feb 24, 2015
4ff8b8a
Rollup merge of #22752 - ipetkov:unsafe-lint-fix, r=alexcrichton
Manishearth Feb 24, 2015
1913e79
Rollup merge of #22758 - ejjeong:aarch64-linux-android, r=alexcrichton
Manishearth Feb 24, 2015
216be12
Rollup merge of #22770 - vhbit:ios-rand-send, r=alexcrichton
Manishearth Feb 24, 2015
80ac3a8
Rollup merge of #22772 - tbu-:pr_panic_fail, r=alexcrichton
Manishearth Feb 24, 2015
a429bf6
Rollup merge of #22458 - steveklabnik:try_in_error_chapter, r=alexcri…
Manishearth Feb 24, 2015
c51c377
Rollup merge of #22539 - oli-obk:style_nitpicks, r=Manishearth
Manishearth Feb 24, 2015
2408698
Rollup merge of #22736 - nikomatsakis:issue-22382, r=eddyb
Manishearth Feb 24, 2015
b711b6a
Rollup merge of #22778 - mzabaluev:leftover-lifetime, r=alexcrichton
Manishearth Feb 24, 2015
ab45694
std: Stabilize some `ptr` functions
alexcrichton Feb 23, 2015
27f8708
std: Recomend threadpool on crates.io for TaskPool
alexcrichton Feb 24, 2015
14c7683
Fix "How to submit a bug report" link
rnestler Feb 24, 2015
408f7b5
Modify collection's `Debug` output to resemble in their content only
tbu- Feb 10, 2015
870ad3b
Change `Debug` implementation of `BTree*` as well
tbu- Feb 10, 2015
db6ae66
Make traits with assoc types invariant in their inputs.
nikomatsakis Feb 20, 2015
eb841fc
Resolve regions too when normalizing param env.
nikomatsakis Feb 20, 2015
206c254
Improve debug output from coherence.
nikomatsakis Feb 23, 2015
2d200c9
std: Move std::env to the new I/O APIs
alexcrichton Feb 23, 2015
65e1e6b
Add a section on recursive macros
kmcallister Feb 20, 2015
1804242
Add a second, more vexing section on recursive macros
kmcallister Feb 21, 2015
df08657
Tweak wording in the macros guide
kmcallister Feb 21, 2015
848a7e6
Enhance and move information about macro debugging
kmcallister Feb 21, 2015
5d7e283
Turn `unsafe_no_drop_flag` back into a gated-feature.
pnkfelix Feb 25, 2015
91e00f3
unbreak openbsd after nacl intergration
semarie Feb 25, 2015
9692f3b
Rollup merge of #22635 - kmcallister:macros-chapter, r=steveklabnik
Manishearth Feb 25, 2015
24fc50d
Rollup merge of #22783 - alexcrichton:deprecate-taskpool, r=alexcrichton
Manishearth Feb 25, 2015
267c587
Rollup merge of #22784 - rnestler:fix_doc_faq, r=dotdash
Manishearth Feb 25, 2015
3a49c3b
Rollup merge of #22785 - nikomatsakis:issue-21750-normalization-with-…
Manishearth Feb 25, 2015
1c97ac3
Rollup merge of #22792 - semarie:openbsd-unbreak-nacl, r=alexcrichton
Manishearth Feb 25, 2015
c950ee9
Rollup merge of #22157 - tbu-:pr_debug_collections, r=alexcrichton
Manishearth Feb 25, 2015
7b7cf84
Rollup merge of #22596 - alexcrichton:fix-some-impls, r=huonw
Manishearth Feb 25, 2015
b18584c
Rollup merge of #22727 - alexcrichton:prep-env, r=aturon
Manishearth Feb 25, 2015
6c6f231
Rollup merge of #22729 - alexcrichton:ptr-stabilization, r=aturon
Manishearth Feb 25, 2015
ecaf74a
Rollup merge of #22742 - alexcrichton:issue-22737, r=aturon
Manishearth Feb 25, 2015
1f2b3eb
Rollup merge of #22744 - alexcrichton:issue-22738, r=aturon
Manishearth Feb 25, 2015
f164254
Rollup merge of #22787 - pnkfelix:reenable-gate-for-unsafe_no_drop_fl…
Manishearth Feb 25, 2015
f8e4fcb
allow(deprecated) for TaskPool (fixup #22783)
Manishearth Feb 25, 2015
9f8a1cb
Use os::getcwd instead of env in rustbook (fixup #22727)
Manishearth Feb 25, 2015
e61a790
Fix type inference error (fixup #22739)
Manishearth Feb 25, 2015
2470fa1
Assert is internal now (fixup #22739)
Manishearth Feb 25, 2015
d54ed56
path -> PathBuf for osx/dragonfly (fixup #22727)
Manishearth Feb 25, 2015
357b41b
Path -> PathBuf for Windows test (fixup #22727)
Manishearth Feb 25, 2015
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
1 change: 1 addition & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#![feature(unboxed_closures)]
#![feature(unsafe_no_drop_flag)]
#![feature(core)]
#![feature(unique)]
#![cfg_attr(test, feature(test, alloc, rustc_private))]
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
feature(libc))]
Expand Down
24 changes: 12 additions & 12 deletions src/libcollections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,12 +1136,12 @@ impl<K, V> Node<K, V> {
// This must be followed by insert_edge on an internal node.
#[inline]
unsafe fn insert_kv(&mut self, index: usize, key: K, val: V) -> &mut V {
ptr::copy_memory(
ptr::copy(
self.keys_mut().as_mut_ptr().offset(index as isize + 1),
self.keys().as_ptr().offset(index as isize),
self.len() - index
);
ptr::copy_memory(
ptr::copy(
self.vals_mut().as_mut_ptr().offset(index as isize + 1),
self.vals().as_ptr().offset(index as isize),
self.len() - index
Expand All @@ -1158,7 +1158,7 @@ impl<K, V> Node<K, V> {
// This can only be called immediately after a call to insert_kv.
#[inline]
unsafe fn insert_edge(&mut self, index: usize, edge: Node<K, V>) {
ptr::copy_memory(
ptr::copy(
self.edges_mut().as_mut_ptr().offset(index as isize + 1),
self.edges().as_ptr().offset(index as isize),
self.len() - index
Expand Down Expand Up @@ -1191,12 +1191,12 @@ impl<K, V> Node<K, V> {
let key = ptr::read(self.keys().get_unchecked(index));
let val = ptr::read(self.vals().get_unchecked(index));

ptr::copy_memory(
ptr::copy(
self.keys_mut().as_mut_ptr().offset(index as isize),
self.keys().as_ptr().offset(index as isize + 1),
self.len() - index - 1
);
ptr::copy_memory(
ptr::copy(
self.vals_mut().as_mut_ptr().offset(index as isize),
self.vals().as_ptr().offset(index as isize + 1),
self.len() - index - 1
Expand All @@ -1212,7 +1212,7 @@ impl<K, V> Node<K, V> {
unsafe fn remove_edge(&mut self, index: usize) -> Node<K, V> {
let edge = ptr::read(self.edges().get_unchecked(index));

ptr::copy_memory(
ptr::copy(
self.edges_mut().as_mut_ptr().offset(index as isize),
self.edges().as_ptr().offset(index as isize + 1),
self.len() - index + 1
Expand All @@ -1239,18 +1239,18 @@ impl<K, V> Node<K, V> {
unsafe {
right._len = self.len() / 2;
let right_offset = self.len() - right.len();
ptr::copy_nonoverlapping_memory(
ptr::copy_nonoverlapping(
right.keys_mut().as_mut_ptr(),
self.keys().as_ptr().offset(right_offset as isize),
right.len()
);
ptr::copy_nonoverlapping_memory(
ptr::copy_nonoverlapping(
right.vals_mut().as_mut_ptr(),
self.vals().as_ptr().offset(right_offset as isize),
right.len()
);
if !self.is_leaf() {
ptr::copy_nonoverlapping_memory(
ptr::copy_nonoverlapping(
right.edges_mut().as_mut_ptr(),
self.edges().as_ptr().offset(right_offset as isize),
right.len() + 1
Expand Down Expand Up @@ -1280,18 +1280,18 @@ impl<K, V> Node<K, V> {
ptr::write(self.keys_mut().get_unchecked_mut(old_len), key);
ptr::write(self.vals_mut().get_unchecked_mut(old_len), val);

ptr::copy_nonoverlapping_memory(
ptr::copy_nonoverlapping(
self.keys_mut().as_mut_ptr().offset(old_len as isize + 1),
right.keys().as_ptr(),
right.len()
);
ptr::copy_nonoverlapping_memory(
ptr::copy_nonoverlapping(
self.vals_mut().as_mut_ptr().offset(old_len as isize + 1),
right.vals().as_ptr(),
right.len()
);
if !self.is_leaf() {
ptr::copy_nonoverlapping_memory(
ptr::copy_nonoverlapping(
self.edges_mut().as_mut_ptr().offset(old_len as isize + 1),
right.edges().as_ptr(),
right.len() + 1
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(unsafe_destructor)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag)]
#![cfg_attr(test, feature(rand, rustc_private, test))]
#![cfg_attr(test, allow(deprecated))] // rand
Expand Down
26 changes: 12 additions & 14 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,12 +1331,10 @@ fn insertion_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> O

if i != j {
let tmp = ptr::read(read_ptr);
ptr::copy_memory(buf_v.offset(j + 1),
&*buf_v.offset(j),
(i - j) as usize);
ptr::copy_nonoverlapping_memory(buf_v.offset(j),
&tmp,
1);
ptr::copy(buf_v.offset(j + 1),
&*buf_v.offset(j),
(i - j) as usize);
ptr::copy_nonoverlapping(buf_v.offset(j), &tmp, 1);
mem::forget(tmp);
}
}
Expand Down Expand Up @@ -1409,10 +1407,10 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
// j + 1 could be `len` (for the last `i`), but in
// that case, `i == j` so we don't copy. The
// `.offset(j)` is always in bounds.
ptr::copy_memory(buf_dat.offset(j + 1),
&*buf_dat.offset(j),
i - j as usize);
ptr::copy_nonoverlapping_memory(buf_dat.offset(j), read_ptr, 1);
ptr::copy(buf_dat.offset(j + 1),
&*buf_dat.offset(j),
i - j as usize);
ptr::copy_nonoverlapping(buf_dat.offset(j), read_ptr, 1);
}
}
}
Expand Down Expand Up @@ -1460,11 +1458,11 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
if left == right_start {
// the number remaining in this run.
let elems = (right_end as usize - right as usize) / mem::size_of::<T>();
ptr::copy_nonoverlapping_memory(out, &*right, elems);
ptr::copy_nonoverlapping(out, &*right, elems);
break;
} else if right == right_end {
let elems = (right_start as usize - left as usize) / mem::size_of::<T>();
ptr::copy_nonoverlapping_memory(out, &*left, elems);
ptr::copy_nonoverlapping(out, &*left, elems);
break;
}

Expand All @@ -1478,7 +1476,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
} else {
step(&mut left)
};
ptr::copy_nonoverlapping_memory(out, &*to_copy, 1);
ptr::copy_nonoverlapping(out, &*to_copy, 1);
step(&mut out);
}
}
Expand All @@ -1492,7 +1490,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
// write the result to `v` in one go, so that there are never two copies
// of the same object in `v`.
unsafe {
ptr::copy_nonoverlapping_memory(v.as_mut_ptr(), &*buf_dat, len);
ptr::copy_nonoverlapping(v.as_mut_ptr(), &*buf_dat, len);
}

// increment the pointer, returning the old pointer.
Expand Down
18 changes: 9 additions & 9 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,9 @@ impl String {

let CharRange { ch, next } = self.char_range_at(idx);
unsafe {
ptr::copy_memory(self.vec.as_mut_ptr().offset(idx as isize),
self.vec.as_ptr().offset(next as isize),
len - next);
ptr::copy(self.vec.as_mut_ptr().offset(idx as isize),
self.vec.as_ptr().offset(next as isize),
len - next);
self.vec.set_len(len - (next - idx));
}
ch
Expand Down Expand Up @@ -598,12 +598,12 @@ impl String {
let amt = ch.encode_utf8(&mut bits).unwrap();

unsafe {
ptr::copy_memory(self.vec.as_mut_ptr().offset((idx + amt) as isize),
self.vec.as_ptr().offset(idx as isize),
len - idx);
ptr::copy_memory(self.vec.as_mut_ptr().offset(idx as isize),
bits.as_ptr(),
amt);
ptr::copy(self.vec.as_mut_ptr().offset((idx + amt) as isize),
self.vec.as_ptr().offset(idx as isize),
len - idx);
ptr::copy(self.vec.as_mut_ptr().offset(idx as isize),
bits.as_ptr(),
amt);
self.vec.set_len(len + amt);
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl<T> Vec<T> {
pub unsafe fn from_raw_buf(ptr: *const T, elts: usize) -> Vec<T> {
let mut dst = Vec::with_capacity(elts);
dst.set_len(elts);
ptr::copy_nonoverlapping_memory(dst.as_mut_ptr(), ptr, elts);
ptr::copy_nonoverlapping(dst.as_mut_ptr(), ptr, elts);
dst
}

Expand Down Expand Up @@ -548,7 +548,7 @@ impl<T> Vec<T> {
let p = self.as_mut_ptr().offset(index as isize);
// Shift everything over to make space. (Duplicating the
// `index`th element into two consecutive places.)
ptr::copy_memory(p.offset(1), &*p, len - index);
ptr::copy(p.offset(1), &*p, len - index);
// Write it in, overwriting the first copy of the `index`th
// element.
ptr::write(&mut *p, element);
Expand Down Expand Up @@ -585,7 +585,7 @@ impl<T> Vec<T> {
ret = ptr::read(ptr);

// Shift everything down to fill in that spot.
ptr::copy_memory(ptr, &*ptr.offset(1), len - index - 1);
ptr::copy(ptr, &*ptr.offset(1), len - index - 1);
}
self.set_len(len - 1);
ret
Expand Down Expand Up @@ -718,7 +718,7 @@ impl<T> Vec<T> {
self.reserve(other.len());
let len = self.len();
unsafe {
ptr::copy_nonoverlapping_memory(
ptr::copy_nonoverlapping(
self.get_unchecked_mut(len),
other.as_ptr(),
other.len());
Expand Down Expand Up @@ -1036,7 +1036,7 @@ impl<T> Vec<T> {
self.set_len(at);
other.set_len(other_len);

ptr::copy_nonoverlapping_memory(
ptr::copy_nonoverlapping(
other.as_mut_ptr(),
self.as_ptr().offset(at as isize),
other.len());
Expand Down
22 changes: 11 additions & 11 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl<T> VecDeque<T> {
self.cap);
debug_assert!(src + len <= self.cap, "dst={} src={} len={} cap={}", dst, src, len,
self.cap);
ptr::copy_memory(
ptr::copy(
self.ptr.offset(dst as isize),
self.ptr.offset(src as isize),
len);
Expand All @@ -147,7 +147,7 @@ impl<T> VecDeque<T> {
self.cap);
debug_assert!(src + len <= self.cap, "dst={} src={} len={} cap={}", dst, src, len,
self.cap);
ptr::copy_nonoverlapping_memory(
ptr::copy_nonoverlapping(
self.ptr.offset(dst as isize),
self.ptr.offset(src as isize),
len);
Expand Down Expand Up @@ -1343,22 +1343,22 @@ impl<T> VecDeque<T> {
// `at` lies in the first half.
let amount_in_first = first_len - at;

ptr::copy_nonoverlapping_memory(*other.ptr,
first_half.as_ptr().offset(at as isize),
amount_in_first);
ptr::copy_nonoverlapping(*other.ptr,
first_half.as_ptr().offset(at as isize),
amount_in_first);

// just take all of the second half.
ptr::copy_nonoverlapping_memory(other.ptr.offset(amount_in_first as isize),
second_half.as_ptr(),
second_len);
ptr::copy_nonoverlapping(other.ptr.offset(amount_in_first as isize),
second_half.as_ptr(),
second_len);
} else {
// `at` lies in the second half, need to factor in the elements we skipped
// in the first half.
let offset = at - first_len;
let amount_in_second = second_len - offset;
ptr::copy_nonoverlapping_memory(*other.ptr,
second_half.as_ptr().offset(offset as isize),
amount_in_second);
ptr::copy_nonoverlapping(*other.ptr,
second_half.as_ptr().offset(offset as isize),
amount_in_second);
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ extern "rust-intrinsic" {
/// }
/// }
/// ```
#[unstable(feature = "core")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: usize);

/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source
Expand Down Expand Up @@ -323,13 +323,12 @@ extern "rust-intrinsic" {
/// }
/// ```
///
#[unstable(feature = "core")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn copy_memory<T>(dst: *mut T, src: *const T, count: usize);

/// Invokes memset on the specified pointer, setting `count * size_of::<T>()`
/// bytes of memory starting at `dst` to `c`.
#[unstable(feature = "core",
reason = "uncertain about naming and semantics")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn set_memory<T>(dst: *mut T, val: u8, count: usize);

/// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
let mut t: T = uninitialized();

// Perform the swap, `&mut` pointers never alias
ptr::copy_nonoverlapping_memory(&mut t, &*x, 1);
ptr::copy_nonoverlapping_memory(x, &*y, 1);
ptr::copy_nonoverlapping_memory(y, &t, 1);
ptr::copy_nonoverlapping(&mut t, &*x, 1);
ptr::copy_nonoverlapping(x, &*y, 1);
ptr::copy_nonoverlapping(y, &t, 1);

// y and t now point to the same thing, but we need to completely forget `t`
// because it's no longer relevant.
Expand Down
Loading