Skip to content

Commit 9dc6359

Browse files
committed
---
yaml --- r: 274101 b: refs/heads/stable c: 7dce32e h: refs/heads/master i: 274099: e5cf945
1 parent face238 commit 9dc6359

Some content is hidden

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

76 files changed

+2251
-1493
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: aca4e6a89aa0c12507e632f6df57e006d284eba0
32+
refs/heads/stable: 7dce32e65d53ff9cfd8dba89121efa4c977030de
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: 9 additions & 2 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,6 +892,13 @@ 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+
895902
# OS X 10.9, gcc is actually clang. This can cause some confusion in the build
896903
# system, so if we find that gcc is clang, we should just use clang directly.
897904
if [ $CFG_OSTYPE = apple-darwin -a -z "$CFG_ENABLE_CLANG" ]
@@ -1035,7 +1042,7 @@ then
10351042
if [ -n "$CFG_OSX_CLANG_VERSION" ]
10361043
then
10371044
case $CFG_OSX_CLANG_VERSION in
1038-
(7.0*)
1045+
(7.0* | 7.1* | 7.2*)
10391046
step_msg "found ok version of APPLE CLANG: $CFG_OSX_CLANG_VERSION"
10401047
;;
10411048
(*)

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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,11 @@ This expands to
285285

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

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 f84e30927284b0c500ed3eaf09e8e159da20ddaf
1+
Subproject commit e24a1a025a1f214e40eedafe3b9c7b1d69937922

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

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ 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;
1516
use core::ops::Index;
1617
use core::{fmt, intrinsics, mem, ptr};
1718

@@ -158,7 +159,8 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
158159
Found(handle) => {
159160
Some(OccupiedEntry {
160161
handle: handle,
161-
length: &mut self.length
162+
length: &mut self.length,
163+
_marker: PhantomData,
162164
}.remove_kv().0)
163165
},
164166
GoDown(_) => None
@@ -172,7 +174,8 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
172174
VacantEntry {
173175
key: key,
174176
handle: handle,
175-
length: &mut self.length
177+
length: &mut self.length,
178+
_marker: PhantomData,
176179
}.insert(());
177180
None
178181
}
@@ -223,7 +226,10 @@ pub struct Range<'a, K: 'a, V: 'a> {
223226
/// A mutable iterator over a sub-range of BTreeMap's entries.
224227
pub struct RangeMut<'a, K: 'a, V: 'a> {
225228
front: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>,
226-
back: 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)>,
227233
}
228234

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

253262
/// An occupied Entry.
@@ -259,7 +268,10 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
259268
marker::LeafOrInternal
260269
>, marker::KV>,
261270

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

265277
impl<K: Ord, V> BTreeMap<K, V> {
@@ -415,7 +427,8 @@ impl<K: Ord, V> BTreeMap<K, V> {
415427
Found(handle) => {
416428
Some(OccupiedEntry {
417429
handle: handle,
418-
length: &mut self.length
430+
length: &mut self.length,
431+
_marker: PhantomData,
419432
}.remove())
420433
},
421434
GoDown(_) => None
@@ -568,7 +581,8 @@ impl<K: Ord, V> BTreeMap<K, V> {
568581

569582
RangeMut {
570583
front: front,
571-
back: back
584+
back: back,
585+
_marker: PhantomData
572586
}
573587
}
574588

@@ -593,12 +607,14 @@ impl<K: Ord, V> BTreeMap<K, V> {
593607
match search::search_tree(self.root.as_mut(), &key) {
594608
Found(handle) => Occupied(OccupiedEntry {
595609
handle: handle,
596-
length: &mut self.length
610+
length: &mut self.length,
611+
_marker: PhantomData,
597612
}),
598613
GoDown(handle) => Vacant(VacantEntry {
599614
key: key,
600615
handle: handle,
601-
length: &mut self.length
616+
length: &mut self.length,
617+
_marker: PhantomData,
602618
})
603619
}
604620
}
@@ -1235,6 +1251,7 @@ impl<K, V> BTreeMap<K, V> {
12351251
range: RangeMut {
12361252
front: first_leaf_edge(root1),
12371253
back: last_leaf_edge(root2),
1254+
_marker: PhantomData,
12381255
},
12391256
length: self.length
12401257
}

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

Lines changed: 15 additions & 10 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<*mut LeafNode<K, V>>) -> Self {
101-
BoxedNode { ptr: Unique::new(*ptr) }
100+
unsafe fn from_ptr(ptr: NonZero<*const LeafNode<K, V>>) -> Self {
101+
BoxedNode { ptr: Unique::new(*ptr as *mut LeafNode<K, V>) }
102102
}
103103

104-
fn as_ptr(&self) -> NonZero<*mut LeafNode<K, V>> {
104+
fn as_ptr(&self) -> NonZero<*const LeafNode<K, V>> {
105105
unsafe {
106-
NonZero::new(*self.ptr)
106+
NonZero::new(*self.ptr as *const LeafNode<K, V>)
107107
}
108108
}
109109
}
@@ -209,6 +209,11 @@ 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.
212217
/// A reference to a node.
213218
///
214219
/// This type has a number of paramaters that controls how it acts:
@@ -223,8 +228,8 @@ impl<K, V> Root<K, V> {
223228
/// `NodeRef` could be pointing to either type of node.
224229
pub struct NodeRef<BorrowType, K, V, Type> {
225230
height: usize,
226-
node: NonZero<*mut LeafNode<K, V>>,
227-
root: *mut Root<K, V>,
231+
node: NonZero<*const LeafNode<K, V>>,
232+
root: *const Root<K, V>,
228233
_marker: PhantomData<(BorrowType, Type)>
229234
}
230235

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

402407
fn as_leaf_mut(&mut self) -> &mut LeafNode<K, V> {
403408
unsafe {
404-
&mut **self.node
409+
&mut *(*self.node as *mut LeafNode<K, V>)
405410
}
406411
}
407412

@@ -434,7 +439,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Immut<'a>, K, V, Type> {
434439
impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
435440
pub fn into_root_mut(self) -> &'a mut Root<K, V> {
436441
unsafe {
437-
&mut *self.root
442+
&mut *(self.root as *mut Root<K, V>)
438443
}
439444
}
440445

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

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

1056-
left_node.as_leaf_mut().len += right_len as u16 + 1;
1057-
10581063
Handle::new_edge(self.node, self.idx)
10591064
}
10601065
}

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

Lines changed: 9 additions & 19 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, Map, FromIterator};
17+
use core::iter::{Peekable, 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: Map<::btree_map::IntoIter<T, ()>, fn((T, ())) -> T>,
55+
iter: ::btree_map::IntoIter<T, ()>,
5656
}
5757

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

6363
/// A lazy iterator producing elements in the set difference (in-order).
@@ -160,12 +160,7 @@ impl<T: Ord> BTreeSet<T> {
160160
-> Range<'a, T>
161161
where T: Borrow<Min> + Borrow<Max>
162162
{
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) }
163+
Range { iter: self.map.range(min, max) }
169164
}
170165
}
171166

@@ -548,12 +543,7 @@ impl<T> IntoIterator for BTreeSet<T> {
548543
/// assert_eq!(v, [1, 2, 3, 4]);
549544
/// ```
550545
fn into_iter(self) -> IntoIter<T> {
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) }
546+
IntoIter { iter: self.map.into_iter() }
557547
}
558548
}
559549

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

723713
fn next(&mut self) -> Option<T> {
724-
self.iter.next()
714+
self.iter.next().map(|(k, _)| k)
725715
}
726716
fn size_hint(&self) -> (usize, Option<usize>) {
727717
self.iter.size_hint()
@@ -730,7 +720,7 @@ impl<T> Iterator for IntoIter<T> {
730720
#[stable(feature = "rust1", since = "1.0.0")]
731721
impl<T> DoubleEndedIterator for IntoIter<T> {
732722
fn next_back(&mut self) -> Option<T> {
733-
self.iter.next_back()
723+
self.iter.next_back().map(|(k, _)| k)
734724
}
735725
}
736726
#[stable(feature = "rust1", since = "1.0.0")]
@@ -746,12 +736,12 @@ impl<'a, T> Iterator for Range<'a, T> {
746736
type Item = &'a T;
747737

748738
fn next(&mut self) -> Option<&'a T> {
749-
self.iter.next()
739+
self.iter.next().map(|(k, _)| k)
750740
}
751741
}
752742
impl<'a, T> DoubleEndedIterator for Range<'a, T> {
753743
fn next_back(&mut self) -> Option<&'a T> {
754-
self.iter.next_back()
744+
self.iter.next_back().map(|(k, _)| k)
755745
}
756746
}
757747

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 two
352-
//! options:
351+
//! characters are specified by `fill`, and the alignment can be one of the
352+
//! following 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-
/// satisifed:
305+
/// satisfied:
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-
/// satisifed:
348+
/// satisfied:
349349
///
350350
/// * `begin` must come before `end`.
351351
/// * `begin` and `end` must be byte positions within the string slice.

0 commit comments

Comments
 (0)