Skip to content

Commit 65b153f

Browse files
committed
---
yaml --- r: 275063 b: refs/heads/stable c: ed01545 h: refs/heads/master i: 275061: 1e139da 275059: 69ee1a5 275055: 9f4becb
1 parent c6dc929 commit 65b153f

File tree

106 files changed

+2298
-3276
lines changed

Some content is hidden

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

106 files changed

+2298
-3276
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: b81fdd4cd2b967e73ac1f3f5cfbe8229853876d9
32+
refs/heads/stable: ed015456a114ae907a36af80c06f81ea93182a24
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/RELEASES.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ Misc
9494
the `-Z unstable-options` flag.
9595
* [When running tests with `--test`, rustdoc will pass `--cfg`
9696
arguments to the compiler][1.7dt].
97-
* [The compiler is built with RPATH information by default][1.7rpa].
97+
* [The compiler is built with RPATH information by default][1.7rp].
9898
This means that it will be possible to run `rustc` when installed in
9999
unusual configurations without configuring the dynamic linker search
100100
path explicitly.
101-
* [`rustc` passes `--enable-new-dtags` to GNU ld][1.7dta]. This makes
101+
* [`rustc` passes `--enable-new-dtags` to GNU ld][1.7dt]. This makes
102102
any RPATH entries (emitted with `-C rpath`) *not* take precedence
103103
over `LD_LIBRARY_PATH`.
104104

@@ -132,15 +132,15 @@ Compatibility Notes
132132
[1.7cp]: https://github.com/rust-lang/cargo/pull/2224
133133
[1.7d]: https://github.com/rust-lang/rust/pull/30724
134134
[1.7dt]: https://github.com/rust-lang/rust/pull/30372
135-
[1.7dta]: https://github.com/rust-lang/rust/pull/30394
135+
[1.7dt]: https://github.com/rust-lang/rust/pull/30394
136136
[1.7f]: https://github.com/rust-lang/rust/pull/30672
137137
[1.7h]: https://github.com/rust-lang/rust/pull/30818
138138
[1.7j]: https://github.com/rust-lang/rust/pull/30711
139139
[1.7ll]: https://github.com/rust-lang/rust/pull/30663
140140
[1.7m]: https://github.com/rust-lang/rust/pull/30381
141141
[1.7p]: https://github.com/rust-lang/rust/pull/30681
142142
[1.7rp]: https://github.com/rust-lang/rust/pull/29498
143-
[1.7rpa]: https://github.com/rust-lang/rust/pull/30353
143+
[1.7rp]: https://github.com/rust-lang/rust/pull/30353
144144
[1.7rr]: https://github.com/rust-lang/cargo/pull/2279
145145
[1.7sf]: https://github.com/rust-lang/rust/pull/30389
146146
[1.7utf8]: https://github.com/rust-lang/rust/pull/30740

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

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -124,65 +124,21 @@ special annotation here, it’s the default thing that Rust does.
124124
## The details
125125

126126
The reason that we cannot use a binding after we’ve moved it is subtle, but
127-
important.
128-
129-
When we write code like this:
130-
131-
```rust
132-
let x = 10;
133-
```
134-
135-
Rust allocates memory for an integer [i32] on the [stack][sh], copies the bit
136-
pattern representing the value of 10 to the allocated memory and binds the
137-
variable name x to this memory region for future reference.
138-
139-
Now consider the following code fragment:
127+
important. When we write code like this:
140128

141129
```rust
142130
let v = vec![1, 2, 3];
143131

144-
let mut v2 = v;
145-
```
146-
147-
The first line allocates memory for the vector object `v` on the stack like
148-
it does for `x` above. But in addition to that it also allocates some memory
149-
on the [heap][sh] for the actual data (`[1, 2, 3]`). Rust copies the address
150-
of this heap allocation to an internal pointer, which is part of the vector
151-
object placed on the stack (let's call it the data pointer).
152-
153-
It is worth pointing out (even at the risk of stating the obvious) that the
154-
vector object and its data live in separate memory regions instead of being a
155-
single contiguous memory allocation (due to reasons we will not go into at
156-
this point of time). These two parts of the vector (the one on the stack and
157-
one on the heap) must agree with each other at all times with regards to
158-
things like the length, capacity etc.
159-
160-
When we move `v` to `v2`, rust actually does a bitwise copy of the vector
161-
object `v` into the stack allocation represented by `v2`. This shallow copy
162-
does not create a copy of the heap allocation containing the actual data.
163-
Which means that there would be two pointers to the contents of the vector
164-
both pointing to the same memory allocation on the heap. It would violate
165-
Rust’s safety guarantees by introducing a data race if one could access both
166-
`v` and `v2` at the same time.
167-
168-
For example if we truncated the vector to just two elements through `v2`:
169-
170-
```rust
171-
# let v = vec![1, 2, 3];
172-
# let mut v2 = v;
173-
v2.truncate(2);
132+
let v2 = v;
174133
```
175134

176-
and `v1` were still accessible we'd end up with an invalid vector since `v1`
177-
would not know that the heap data has been truncated. Now, the part of the
178-
vector `v1` on the stack does not agree with the corresponding part on the
179-
heap. `v1` still thinks there are three elements in the vector and will
180-
happily let us access the non existent element `v1[2]` but as you might
181-
already know this is a recipe for disaster. Especially because it might lead
182-
to a segmentation fault or worse allow an unauthorized user to read from
183-
memory to which they don't have access.
184-
185-
This is why Rust forbids using `v` after we’ve done the move.
135+
The first line allocates memory for the vector object, `v`, and for the data it
136+
contains. The vector object is stored on the [stack][sh] and contains a pointer
137+
to the content (`[1, 2, 3]`) stored on the [heap][sh]. When we move `v` to `v2`,
138+
it creates a copy of that pointer, for `v2`. Which means that there would be two
139+
pointers to the content of the vector on the heap. It would violate Rust’s
140+
safety guarantees by introducing a data race. Therefore, Rust forbids using `v`
141+
after we’ve done the move.
186142

187143
[sh]: the-stack-and-the-heap.html
188144

branches/stable/src/liballoc_jemalloc/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ extern {}
4545
// explicitly request it), and on Android we explicitly request it as
4646
// unprefixing cause segfaults (mismatches in allocators).
4747
extern {
48-
#[cfg_attr(any(target_os = "macos", target_os = "android"),
48+
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
4949
link_name = "je_mallocx")]
5050
fn mallocx(size: size_t, flags: c_int) -> *mut c_void;
51-
#[cfg_attr(any(target_os = "macos", target_os = "android"),
51+
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
5252
link_name = "je_rallocx")]
5353
fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
54-
#[cfg_attr(any(target_os = "macos", target_os = "android"),
54+
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
5555
link_name = "je_xallocx")]
5656
fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
57-
#[cfg_attr(any(target_os = "macos", target_os = "android"),
57+
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
5858
link_name = "je_sdallocx")]
5959
fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
60-
#[cfg_attr(any(target_os = "macos", target_os = "android"),
60+
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
6161
link_name = "je_nallocx")]
6262
fn nallocx(size: size_t, flags: c_int) -> size_t;
6363
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,9 @@ impl<K: Ord, V> BTreeMap<K, V> {
375375
///
376376
/// If the map did not have this key present, `None` is returned.
377377
///
378-
/// If the map did have this key present, the value is updated, and the old
379-
/// value is returned. The key is not updated, though; this matters for
380-
/// types that can be `==` without being identical. See the [module-level
381-
/// documentation] for more.
378+
/// If the map did have this key present, the key is not updated, the
379+
/// value is updated and the old value is returned.
380+
/// See the [module-level documentation] for more.
382381
///
383382
/// [module-level documentation]: index.html#insert-and-complex-keys
384383
///

branches/stable/src/libcollections/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
#![feature(nonzero)]
4646
#![feature(num_bits_bytes)]
4747
#![feature(pattern)]
48-
#![feature(placement_in)]
49-
#![feature(placement_new_protocol)]
5048
#![feature(shared)]
5149
#![feature(slice_bytes)]
5250
#![feature(slice_patterns)]

branches/stable/src/libcollections/linked_list.rs

Lines changed: 2 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121

2222
#![stable(feature = "rust1", since = "1.0.0")]
2323

24-
use alloc::boxed::{Box, IntermediateBox};
24+
use alloc::boxed::Box;
2525
use core::cmp::Ordering;
2626
use core::fmt;
2727
use core::hash::{Hasher, Hash};
2828
use core::iter::FromIterator;
2929
use core::mem;
30-
use core::ops::{BoxPlace, InPlace, Place, Placer};
31-
use core::ptr::{self, Shared};
30+
use core::ptr::Shared;
3231

3332
/// A doubly-linked list.
3433
#[stable(feature = "rust1", since = "1.0.0")]
@@ -661,56 +660,6 @@ impl<T> LinkedList<T> {
661660

662661
second_part
663662
}
664-
665-
/// Returns a place for insertion at the front of the list.
666-
///
667-
/// Using this method with placement syntax is equivalent to [`push_front`]
668-
/// (#method.push_front), but may be more efficient.
669-
///
670-
/// # Examples
671-
///
672-
/// ```
673-
/// #![feature(collection_placement)]
674-
/// #![feature(placement_in_syntax)]
675-
///
676-
/// use std::collections::LinkedList;
677-
///
678-
/// let mut list = LinkedList::new();
679-
/// list.front_place() <- 2;
680-
/// list.front_place() <- 4;
681-
/// assert!(list.iter().eq(&[4, 2]));
682-
/// ```
683-
#[unstable(feature = "collection_placement",
684-
reason = "method name and placement protocol are subject to change",
685-
issue = "30172")]
686-
pub fn front_place(&mut self) -> FrontPlace<T> {
687-
FrontPlace { list: self, node: IntermediateBox::make_place() }
688-
}
689-
690-
/// Returns a place for insertion at the back of the list.
691-
///
692-
/// Using this method with placement syntax is equivalent to [`push_back`](#method.push_back),
693-
/// but may be more efficient.
694-
///
695-
/// # Examples
696-
///
697-
/// ```
698-
/// #![feature(collection_placement)]
699-
/// #![feature(placement_in_syntax)]
700-
///
701-
/// use std::collections::LinkedList;
702-
///
703-
/// let mut list = LinkedList::new();
704-
/// list.back_place() <- 2;
705-
/// list.back_place() <- 4;
706-
/// assert!(list.iter().eq(&[2, 4]));
707-
/// ```
708-
#[unstable(feature = "collection_placement",
709-
reason = "method name and placement protocol are subject to change",
710-
issue = "30172")]
711-
pub fn back_place(&mut self) -> BackPlace<T> {
712-
BackPlace { list: self, node: IntermediateBox::make_place() }
713-
}
714663
}
715664

716665
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1035,101 +984,6 @@ impl<A: Hash> Hash for LinkedList<A> {
1035984
}
1036985
}
1037986

1038-
unsafe fn finalize<T>(node: IntermediateBox<Node<T>>) -> Box<Node<T>> {
1039-
let mut node = node.finalize();
1040-
ptr::write(&mut node.next, None);
1041-
ptr::write(&mut node.prev, Rawlink::none());
1042-
node
1043-
}
1044-
1045-
/// A place for insertion at the front of a `LinkedList`.
1046-
///
1047-
/// See [`LinkedList::front_place`](struct.LinkedList.html#method.front_place) for details.
1048-
#[must_use = "places do nothing unless written to with `<-` syntax"]
1049-
#[unstable(feature = "collection_placement",
1050-
reason = "struct name and placement protocol are subject to change",
1051-
issue = "30172")]
1052-
pub struct FrontPlace<'a, T: 'a> {
1053-
list: &'a mut LinkedList<T>,
1054-
node: IntermediateBox<Node<T>>,
1055-
}
1056-
1057-
#[unstable(feature = "collection_placement",
1058-
reason = "placement protocol is subject to change",
1059-
issue = "30172")]
1060-
impl<'a, T> Placer<T> for FrontPlace<'a, T> {
1061-
type Place = Self;
1062-
1063-
fn make_place(self) -> Self {
1064-
self
1065-
}
1066-
}
1067-
1068-
#[unstable(feature = "collection_placement",
1069-
reason = "placement protocol is subject to change",
1070-
issue = "30172")]
1071-
impl<'a, T> Place<T> for FrontPlace<'a, T> {
1072-
fn pointer(&mut self) -> *mut T {
1073-
unsafe { &mut (*self.node.pointer()).value }
1074-
}
1075-
}
1076-
1077-
#[unstable(feature = "collection_placement",
1078-
reason = "placement protocol is subject to change",
1079-
issue = "30172")]
1080-
impl<'a, T> InPlace<T> for FrontPlace<'a, T> {
1081-
type Owner = ();
1082-
1083-
unsafe fn finalize(self) {
1084-
let FrontPlace { list, node } = self;
1085-
list.push_front_node(finalize(node));
1086-
}
1087-
}
1088-
1089-
/// A place for insertion at the back of a `LinkedList`.
1090-
///
1091-
/// See [`LinkedList::back_place`](struct.LinkedList.html#method.back_place) for details.
1092-
#[must_use = "places do nothing unless written to with `<-` syntax"]
1093-
#[unstable(feature = "collection_placement",
1094-
reason = "struct name and placement protocol are subject to change",
1095-
issue = "30172")]
1096-
pub struct BackPlace<'a, T: 'a> {
1097-
list: &'a mut LinkedList<T>,
1098-
node: IntermediateBox<Node<T>>,
1099-
}
1100-
1101-
#[unstable(feature = "collection_placement",
1102-
reason = "placement protocol is subject to change",
1103-
issue = "30172")]
1104-
impl<'a, T> Placer<T> for BackPlace<'a, T> {
1105-
type Place = Self;
1106-
1107-
fn make_place(self) -> Self {
1108-
self
1109-
}
1110-
}
1111-
1112-
#[unstable(feature = "collection_placement",
1113-
reason = "placement protocol is subject to change",
1114-
issue = "30172")]
1115-
impl<'a, T> Place<T> for BackPlace<'a, T> {
1116-
fn pointer(&mut self) -> *mut T {
1117-
unsafe { &mut (*self.node.pointer()).value }
1118-
}
1119-
}
1120-
1121-
#[unstable(feature = "collection_placement",
1122-
reason = "placement protocol is subject to change",
1123-
issue = "30172")]
1124-
impl<'a, T> InPlace<T> for BackPlace<'a, T> {
1125-
type Owner = ();
1126-
1127-
unsafe fn finalize(self) {
1128-
let BackPlace { list, node } = self;
1129-
list.push_back_node(finalize(node));
1130-
}
1131-
}
1132-
1133987
// Ensure that `LinkedList` and its read-only iterators are covariant in their type parameters.
1134988
#[allow(dead_code)]
1135989
fn assert_covariance() {

branches/stable/src/libcore/fmt/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ pub trait Write {
121121
self.0.write_str(s)
122122
}
123123

124-
fn write_char(&mut self, c: char) -> Result {
125-
self.0.write_char(c)
126-
}
127-
128124
fn write_fmt(&mut self, args: Arguments) -> Result {
129125
self.0.write_fmt(args)
130126
}

branches/stable/src/libcore/mem.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -571,25 +571,9 @@ pub const POST_DROP_USIZE: usize = POST_DROP_U64 as usize;
571571
/// ```
572572
/// use std::mem;
573573
///
574-
/// #[repr(packed)]
575-
/// struct Foo {
576-
/// bar: u8,
577-
/// }
578-
///
579-
/// let foo_slice = [10u8];
580-
///
581-
/// unsafe {
582-
/// // Copy the data from 'foo_slice' and treat it as a 'Foo'
583-
/// let mut foo_struct: Foo = mem::transmute_copy(&foo_slice);
584-
/// assert_eq!(foo_struct.bar, 10);
585-
///
586-
/// // Modify the copied data
587-
/// foo_struct.bar = 20;
588-
/// assert_eq!(foo_struct.bar, 20);
589-
/// }
574+
/// let one = unsafe { mem::transmute_copy(&1) };
590575
///
591-
/// // The contents of 'foo_slice' should not have changed
592-
/// assert_eq!(foo_slice, [10]);
576+
/// assert_eq!(1, one);
593577
/// ```
594578
#[inline]
595579
#[stable(feature = "rust1", since = "1.0.0")]

branches/stable/src/liblibc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 403bdc88394919f297bdb365032044cc0481c319
1+
Subproject commit a64ee24718c0289b82a77d692cf56f8a1226de51

0 commit comments

Comments
 (0)