Skip to content

Commit face238

Browse files
committed
---
yaml --- r: 274100 b: refs/heads/stable c: aca4e6a h: refs/heads/master
1 parent e5cf945 commit face238

Some content is hidden

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

79 files changed

+1587
-2219
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 4bb9d453cf9640b08d97543cd5ed9ded52fd757f
32+
refs/heads/stable: aca4e6a89aa0c12507e632f6df57e006d284eba0
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/configure

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ CFG_SELF="$0"
550550
CFG_CONFIGURE_ARGS="$@"
551551

552552

553-
case "${CFG_SRC_DIR}" in
553+
case "${CFG_SRC_DIR}" in
554554
*\ * )
555555
err "The path to the rust source directory contains spaces, which is not supported"
556556
;;
@@ -892,13 +892,6 @@ then
892892
CFG_DISABLE_JEMALLOC=1
893893
fi
894894

895-
if [ $CFG_OSTYPE = pc-windows-gnu ]
896-
then
897-
# FIXME(#31030) - there's not a great reason to disable jemalloc here
898-
step_msg "on Windows, disabling jemalloc"
899-
CFG_DISABLE_JEMALLOC=1
900-
fi
901-
902895
# OS X 10.9, gcc is actually clang. This can cause some confusion in the build
903896
# system, so if we find that gcc is clang, we should just use clang directly.
904897
if [ $CFG_OSTYPE = apple-darwin -a -z "$CFG_ENABLE_CLANG" ]
@@ -1042,7 +1035,7 @@ then
10421035
if [ -n "$CFG_OSX_CLANG_VERSION" ]
10431036
then
10441037
case $CFG_OSX_CLANG_VERSION in
1045-
(7.0* | 7.1* | 7.2*)
1038+
(7.0*)
10461039
step_msg "found ok version of APPLE CLANG: $CFG_OSX_CLANG_VERSION"
10471040
;;
10481041
(*)

branches/stable/src/doc/book/lifetimes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ fn frob<'a, 'b>(s: &'a str, t: &'b str) -> &str; // Expanded: Output lifetime is
353353
fn get_mut(&mut self) -> &mut T; // elided
354354
fn get_mut<'a>(&'a mut self) -> &'a mut T; // expanded
355355
356-
fn args<T: ToCStr>(&mut self, args: &[T]) -> &mut Command; // elided
357-
fn args<'a, 'b, T: ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command; // expanded
356+
fn args<T:ToCStr>(&mut self, args: &[T]) -> &mut Command; // elided
357+
fn args<'a, 'b, T:ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command; // expanded
358358
359359
fn new(buf: &mut [u8]) -> BufWriter; // elided
360360
fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a>; // expanded

branches/stable/src/doc/book/macros.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,9 @@ This expands to
285285

286286
```text
287287
const char *state = "reticulating splines";
288-
{
289-
int state = get_log_state();
290-
if (state > 0) {
291-
printf("log(%d): %s\n", state, state);
292-
}
288+
int state = get_log_state();
289+
if (state > 0) {
290+
printf("log(%d): %s\n", state, state);
293291
}
294292
```
295293

branches/stable/src/doc/nomicon/lifetime-elision.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ fn frob(s: &str, t: &str) -> &str; // ILLEGAL
5555
fn get_mut(&mut self) -> &mut T; // elided
5656
fn get_mut<'a>(&'a mut self) -> &'a mut T; // expanded
5757
58-
fn args<T: ToCStr>(&mut self, args: &[T]) -> &mut Command // elided
59-
fn args<'a, 'b, T: ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command // expanded
58+
fn args<T:ToCStr>(&mut self, args: &[T]) -> &mut Command // elided
59+
fn args<'a, 'b, T:ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command // expanded
6060
6161
fn new(buf: &mut [u8]) -> BufWriter; // elided
6262
fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a> // expanded

branches/stable/src/jemalloc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit e24a1a025a1f214e40eedafe3b9c7b1d69937922
1+
Subproject commit f84e30927284b0c500ed3eaf09e8e159da20ddaf

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

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use core::cmp::Ordering;
1212
use core::fmt::Debug;
1313
use core::hash::{Hash, Hasher};
1414
use core::iter::FromIterator;
15-
use core::marker::PhantomData;
1615
use core::ops::Index;
1716
use core::{fmt, intrinsics, mem, ptr};
1817

@@ -159,8 +158,7 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
159158
Found(handle) => {
160159
Some(OccupiedEntry {
161160
handle: handle,
162-
length: &mut self.length,
163-
_marker: PhantomData,
161+
length: &mut self.length
164162
}.remove_kv().0)
165163
},
166164
GoDown(_) => None
@@ -174,8 +172,7 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
174172
VacantEntry {
175173
key: key,
176174
handle: handle,
177-
length: &mut self.length,
178-
_marker: PhantomData,
175+
length: &mut self.length
179176
}.insert(());
180177
None
181178
}
@@ -226,10 +223,7 @@ pub struct Range<'a, K: 'a, V: 'a> {
226223
/// A mutable iterator over a sub-range of BTreeMap's entries.
227224
pub struct RangeMut<'a, K: 'a, V: 'a> {
228225
front: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>,
229-
back: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>,
230-
231-
// Be invariant in `K` and `V`
232-
_marker: PhantomData<&'a mut (K, V)>,
226+
back: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>
233227
}
234228

235229
/// A view into a single entry in a map, which may either be vacant or occupied.
@@ -253,10 +247,7 @@ pub enum Entry<'a, K: 'a, V: 'a> {
253247
pub struct VacantEntry<'a, K: 'a, V: 'a> {
254248
key: K,
255249
handle: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>,
256-
length: &'a mut usize,
257-
258-
// Be invariant in `K` and `V`
259-
_marker: PhantomData<&'a mut (K, V)>,
250+
length: &'a mut usize
260251
}
261252

262253
/// An occupied Entry.
@@ -268,10 +259,7 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
268259
marker::LeafOrInternal
269260
>, marker::KV>,
270261

271-
length: &'a mut usize,
272-
273-
// Be invariant in `K` and `V`
274-
_marker: PhantomData<&'a mut (K, V)>,
262+
length: &'a mut usize
275263
}
276264

277265
impl<K: Ord, V> BTreeMap<K, V> {
@@ -427,8 +415,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
427415
Found(handle) => {
428416
Some(OccupiedEntry {
429417
handle: handle,
430-
length: &mut self.length,
431-
_marker: PhantomData,
418+
length: &mut self.length
432419
}.remove())
433420
},
434421
GoDown(_) => None
@@ -581,8 +568,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
581568

582569
RangeMut {
583570
front: front,
584-
back: back,
585-
_marker: PhantomData
571+
back: back
586572
}
587573
}
588574

@@ -607,14 +593,12 @@ impl<K: Ord, V> BTreeMap<K, V> {
607593
match search::search_tree(self.root.as_mut(), &key) {
608594
Found(handle) => Occupied(OccupiedEntry {
609595
handle: handle,
610-
length: &mut self.length,
611-
_marker: PhantomData,
596+
length: &mut self.length
612597
}),
613598
GoDown(handle) => Vacant(VacantEntry {
614599
key: key,
615600
handle: handle,
616-
length: &mut self.length,
617-
_marker: PhantomData,
601+
length: &mut self.length
618602
})
619603
}
620604
}
@@ -1251,7 +1235,6 @@ impl<K, V> BTreeMap<K, V> {
12511235
range: RangeMut {
12521236
front: first_leaf_edge(root1),
12531237
back: last_leaf_edge(root2),
1254-
_marker: PhantomData,
12551238
},
12561239
length: self.length
12571240
}

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

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ impl<K, V> BoxedNode<K, V> {
9797
}
9898
}
9999

100-
unsafe fn from_ptr(ptr: NonZero<*const LeafNode<K, V>>) -> Self {
101-
BoxedNode { ptr: Unique::new(*ptr as *mut LeafNode<K, V>) }
100+
unsafe fn from_ptr(ptr: NonZero<*mut LeafNode<K, V>>) -> Self {
101+
BoxedNode { ptr: Unique::new(*ptr) }
102102
}
103103

104-
fn as_ptr(&self) -> NonZero<*const LeafNode<K, V>> {
104+
fn as_ptr(&self) -> NonZero<*mut LeafNode<K, V>> {
105105
unsafe {
106-
NonZero::new(*self.ptr as *const LeafNode<K, V>)
106+
NonZero::new(*self.ptr)
107107
}
108108
}
109109
}
@@ -209,11 +209,6 @@ impl<K, V> Root<K, V> {
209209
}
210210
}
211211

212-
// N.B. `NodeRef` is always covariant in `K` and `V`, even when the `BorrowType`
213-
// is `Mut`. This is technically wrong, but cannot result in any unsafety due to
214-
// internal use of `NodeRef` because we stay completely generic over `K` and `V`.
215-
// However, whenever a public type wraps `NodeRef`, make sure that it has the
216-
// correct variance.
217212
/// A reference to a node.
218213
///
219214
/// This type has a number of paramaters that controls how it acts:
@@ -228,8 +223,8 @@ impl<K, V> Root<K, V> {
228223
/// `NodeRef` could be pointing to either type of node.
229224
pub struct NodeRef<BorrowType, K, V, Type> {
230225
height: usize,
231-
node: NonZero<*const LeafNode<K, V>>,
232-
root: *const Root<K, V>,
226+
node: NonZero<*mut LeafNode<K, V>>,
227+
root: *mut Root<K, V>,
233228
_marker: PhantomData<(BorrowType, Type)>
234229
}
235230

@@ -406,7 +401,7 @@ impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
406401

407402
fn as_leaf_mut(&mut self) -> &mut LeafNode<K, V> {
408403
unsafe {
409-
&mut *(*self.node as *mut LeafNode<K, V>)
404+
&mut **self.node
410405
}
411406
}
412407

@@ -439,7 +434,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Immut<'a>, K, V, Type> {
439434
impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
440435
pub fn into_root_mut(self) -> &'a mut Root<K, V> {
441436
unsafe {
442-
&mut *(self.root as *mut Root<K, V>)
437+
&mut *self.root
443438
}
444439
}
445440

@@ -1027,8 +1022,6 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
10271022
}
10281023
self.node.as_leaf_mut().len -= 1;
10291024

1030-
left_node.as_leaf_mut().len += right_len as u16 + 1;
1031-
10321025
if self.node.height > 1 {
10331026
ptr::copy_nonoverlapping(
10341027
right_node.cast_unchecked().as_internal().edges.as_ptr(),
@@ -1060,6 +1053,8 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
10601053
);
10611054
}
10621055

1056+
left_node.as_leaf_mut().len += right_len as u16 + 1;
1057+
10631058
Handle::new_edge(self.node, self.idx)
10641059
}
10651060
}

branches/stable/src/libcollections/btree/set.rs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use core::cmp::Ordering::{self, Less, Greater, Equal};
1515
use core::fmt::Debug;
1616
use core::fmt;
17-
use core::iter::{Peekable, FromIterator};
17+
use core::iter::{Peekable, Map, FromIterator};
1818
use core::ops::{BitOr, BitAnd, BitXor, Sub};
1919

2020
use borrow::Borrow;
@@ -52,12 +52,12 @@ pub struct Iter<'a, T: 'a> {
5252
/// An owning iterator over a BTreeSet's items.
5353
#[stable(feature = "rust1", since = "1.0.0")]
5454
pub struct IntoIter<T> {
55-
iter: ::btree_map::IntoIter<T, ()>,
55+
iter: Map<::btree_map::IntoIter<T, ()>, fn((T, ())) -> T>,
5656
}
5757

5858
/// An iterator over a sub-range of BTreeSet's items.
5959
pub struct Range<'a, T: 'a> {
60-
iter: ::btree_map::Range<'a, T, ()>,
60+
iter: Map<::btree_map::Range<'a, T, ()>, fn((&'a T, &'a ())) -> &'a T>,
6161
}
6262

6363
/// A lazy iterator producing elements in the set difference (in-order).
@@ -160,7 +160,12 @@ impl<T: Ord> BTreeSet<T> {
160160
-> Range<'a, T>
161161
where T: Borrow<Min> + Borrow<Max>
162162
{
163-
Range { iter: self.map.range(min, max) }
163+
fn first<A, B>((a, _): (A, B)) -> A {
164+
a
165+
}
166+
let first: fn((&'a T, &'a ())) -> &'a T = first; // coerce to fn pointer
167+
168+
Range { iter: self.map.range(min, max).map(first) }
164169
}
165170
}
166171

@@ -543,7 +548,12 @@ impl<T> IntoIterator for BTreeSet<T> {
543548
/// assert_eq!(v, [1, 2, 3, 4]);
544549
/// ```
545550
fn into_iter(self) -> IntoIter<T> {
546-
IntoIter { iter: self.map.into_iter() }
551+
fn first<A, B>((a, _): (A, B)) -> A {
552+
a
553+
}
554+
let first: fn((T, ())) -> T = first; // coerce to fn pointer
555+
556+
IntoIter { iter: self.map.into_iter().map(first) }
547557
}
548558
}
549559

@@ -711,7 +721,7 @@ impl<T> Iterator for IntoIter<T> {
711721
type Item = T;
712722

713723
fn next(&mut self) -> Option<T> {
714-
self.iter.next().map(|(k, _)| k)
724+
self.iter.next()
715725
}
716726
fn size_hint(&self) -> (usize, Option<usize>) {
717727
self.iter.size_hint()
@@ -720,7 +730,7 @@ impl<T> Iterator for IntoIter<T> {
720730
#[stable(feature = "rust1", since = "1.0.0")]
721731
impl<T> DoubleEndedIterator for IntoIter<T> {
722732
fn next_back(&mut self) -> Option<T> {
723-
self.iter.next_back().map(|(k, _)| k)
733+
self.iter.next_back()
724734
}
725735
}
726736
#[stable(feature = "rust1", since = "1.0.0")]
@@ -736,12 +746,12 @@ impl<'a, T> Iterator for Range<'a, T> {
736746
type Item = &'a T;
737747

738748
fn next(&mut self) -> Option<&'a T> {
739-
self.iter.next().map(|(k, _)| k)
749+
self.iter.next()
740750
}
741751
}
742752
impl<'a, T> DoubleEndedIterator for Range<'a, T> {
743753
fn next_back(&mut self) -> Option<&'a T> {
744-
self.iter.next_back().map(|(k, _)| k)
754+
self.iter.next_back()
745755
}
746756
}
747757

branches/stable/src/libcollections/fmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@
348348
//! The fill character is provided normally in conjunction with the `width`
349349
//! parameter. This indicates that if the value being formatted is smaller than
350350
//! `width` some extra characters will be printed around it. The extra
351-
//! characters are specified by `fill`, and the alignment can be one of the
352-
//! following options:
351+
//! characters are specified by `fill`, and the alignment can be one of two
352+
//! options:
353353
//!
354354
//! * `<` - the argument is left-aligned in `width` columns
355355
//! * `^` - the argument is center-aligned in `width` columns

branches/stable/src/libcollections/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl str {
302302
/// # Safety
303303
///
304304
/// Callers of this function are responsible that three preconditions are
305-
/// satisfied:
305+
/// satisifed:
306306
///
307307
/// * `begin` must come before `end`.
308308
/// * `begin` and `end` must be byte positions within the string slice.
@@ -345,7 +345,7 @@ impl str {
345345
/// # Safety
346346
///
347347
/// Callers of this function are responsible that three preconditions are
348-
/// satisfied:
348+
/// satisifed:
349349
///
350350
/// * `begin` must come before `end`.
351351
/// * `begin` and `end` must be byte positions within the string slice.

0 commit comments

Comments
 (0)