Skip to content

Commit c6652f4

Browse files
committed
---
yaml --- r: 274995 b: refs/heads/stable c: 895ab4f h: refs/heads/master i: 274993: bb8b589 274991: 009851c
1 parent 1d31d50 commit c6652f4

File tree

68 files changed

+673
-807
lines changed

Some content is hidden

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

68 files changed

+673
-807
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: f4046deb20cb997a5901e90be617d0c7bfa6842e
32+
refs/heads/stable: 895ab4f3170ba77c0a4137739e9ddfa516ac63c8
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/mk/tests.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,7 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10721072
$(3) \
10731073
"$$(LLVM_LIBDIR_RUSTFLAGS_$(3))" \
10741074
"$$(LLVM_ALL_COMPONENTS_$(3))" \
1075-
"$$(LLVM_CXXFLAGS_$(3))" \
1076-
'$$(CXX_$(3))'
1075+
"$$(LLVM_CXXFLAGS_$(3))"
10771076
@touch -r $$@.start_time $$@ && rm $$@.start_time
10781077
else
10791078
# FIXME #11094 - The above rule doesn't work right for multiple targets

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,15 @@ let v = vec![1, 2, 3, 4, 5]; // v: Vec<i32>
1111
```
1212

1313
(Notice that unlike the `println!` macro we’ve used in the past, we use square
14-
brackets `[]` with `vec!` macro. Rust allows you to use either in either
15-
situation, this is just convention.)
14+
brackets `[]` with `vec!` macro. Rust allows you to use either in either situation,
15+
this is just convention.)
1616

1717
There’s an alternate form of `vec!` for repeating an initial value:
1818

1919
```rust
2020
let v = vec![0; 10]; // ten zeroes
2121
```
2222

23-
Vectors store their contents as contiguous arrays of `T` on the heap. This means
24-
that they must be able to know the size of `T` at compile time (that is, how
25-
many bytes are needed to store a `T`?). The size of some things can't be known
26-
at compile time. For these you'll have to store a pointer to that thing:
27-
thankfully, the [`Box`][box] type works perfectly for this.
28-
2923
## Accessing elements
3024

3125
To get the value at a particular index in the vector, we use `[]`s:
@@ -119,7 +113,6 @@ Vectors have many more useful methods, which you can read about in [their
119113
API documentation][vec].
120114

121115
[vec]: ../std/vec/index.html
122-
[box]: ../std/boxed/index.html
123116
[generic]: generics.html
124117
[panic]: concurrency.html#panics
125118
[get]: http://doc.rust-lang.org/std/vec/struct.Vec.html#method.get

branches/stable/src/etc/maketest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def convert_path_spec(name, value):
5757
putenv('RUSTFLAGS', sys.argv[15])
5858
putenv('LLVM_COMPONENTS', sys.argv[16])
5959
putenv('LLVM_CXXFLAGS', sys.argv[17])
60-
putenv('CXX', sys.argv[18])
6160
putenv('PYTHON', sys.executable)
6261
os.putenv('TARGET', target_triple)
6362

branches/stable/src/etc/tidy.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@
2424

2525
interesting_files = ['.rs', '.py', '.js', '.sh', '.c', '.h']
2626
uninteresting_files = ['miniz.c', 'jquery', 'rust_android_dummy']
27-
stable_whitelist = {
28-
'src/bootstrap',
29-
'src/build_helper',
30-
'src/libcollectionstest',
31-
'src/libcore',
32-
'src/libstd',
33-
'src/rustc/std_shim',
34-
'src/test'
35-
}
3627

3728

3829
def report_error_name_no(name, no, s):
@@ -102,7 +93,6 @@ def interesting_file(f):
10293
file_counts = {ext: 0 for ext in interesting_files}
10394

10495
all_paths = set()
105-
needs_unstable_attr = set()
10696

10797
try:
10898
for (dirpath, dirnames, filenames) in os.walk(src_dir):
@@ -159,9 +149,6 @@ def interesting_file(f):
159149
else:
160150
if "SNAP " in line:
161151
report_warn("unmatched SNAP line: " + line)
162-
search = re.search(r'^#!\[unstable', line)
163-
if search:
164-
needs_unstable_attr.discard(filename)
165152

166153
if cr_flag in line:
167154
check_cr = False
@@ -194,9 +181,6 @@ def interesting_file(f):
194181
check_cr = True
195182
check_tab = True
196183
check_linelength = True
197-
if all(f not in filename for f in stable_whitelist) and \
198-
re.search(r'src/.*/lib\.rs', filename):
199-
needs_unstable_attr.add(filename)
200184

201185
# Put a reasonable limit on the amount of header data we use for
202186
# the licenseck
@@ -211,8 +195,6 @@ def interesting_file(f):
211195
update_counts(current_name)
212196
assert len(current_contents) > 0
213197
do_license_check(current_name, current_contents)
214-
for f in needs_unstable_attr:
215-
report_error_name_no(f, 1, "requires unstable attribute")
216198

217199
except UnicodeDecodeError as e:
218200
report_err("UTF-8 decoding error " + str(e))

branches/stable/src/libcollections/lib.rs

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

branches/stable/src/libcollections/linked_list.rs

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

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

24-
use alloc::boxed::Box;
24+
use alloc::boxed::{Box, IntermediateBox};
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::ptr::Shared;
30+
use core::ops::{BoxPlace, InPlace, Place, Placer};
31+
use core::ptr::{self, Shared};
3132

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

661662
second_part
662663
}
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+
}
663714
}
664715

665716
#[stable(feature = "rust1", since = "1.0.0")]
@@ -984,6 +1035,101 @@ impl<A: Hash> Hash for LinkedList<A> {
9841035
}
9851036
}
9861037

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+
9871133
// Ensure that `LinkedList` and its read-only iterators are covariant in their type parameters.
9881134
#[allow(dead_code)]
9891135
fn assert_covariance() {

branches/stable/src/libcollections/vec.rs

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

11-
//! A contiguous growable array type with heap-allocated contents, written
12-
//! `Vec<T>` but pronounced 'vector.'
11+
//! A growable list type with heap-allocated contents, written `Vec<T>` but
12+
//! pronounced 'vector.'
1313
//!
1414
//! Vectors have `O(1)` indexing, amortized `O(1)` push (to the end) and
1515
//! `O(1)` pop (from the end).
@@ -78,7 +78,7 @@ use borrow::{Cow, IntoCow};
7878

7979
use super::range::RangeArgument;
8080

81-
/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector.'
81+
/// A growable list type, written `Vec<T>` but pronounced 'vector.'
8282
///
8383
/// # Examples
8484
///

branches/stable/src/librustc/front/map/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
262262

263263
fn visit_pat(&mut self, pat: &'ast Pat) {
264264
let maybe_binding = match pat.node {
265-
PatKind::Ident(_, id, _) => Some(id.node),
265+
PatIdent(_, id, _) => Some(id.node),
266266
_ => None
267267
};
268268

branches/stable/src/librustc/front/map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ impl<'ast> Map<'ast> {
615615
NodeVariant(v) => PathName(v.node.name),
616616
NodeLifetime(lt) => PathName(lt.name),
617617
NodeTyParam(tp) => PathName(tp.name),
618-
NodeLocal(&Pat { node: PatKind::Ident(_,l,_), .. }) => {
618+
NodeLocal(&Pat { node: PatIdent(_,l,_), .. }) => {
619619
PathName(l.node.name)
620620
},
621621
_ => panic!("no path elem for {:?}", node)

branches/stable/src/librustc/middle/cfg/construct.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use middle::ty;
1616
use syntax::ast;
1717
use syntax::ptr::P;
1818

19-
use rustc_front::hir::{self, PatKind};
19+
use rustc_front::hir;
2020

2121
struct CFGBuilder<'a, 'tcx: 'a> {
2222
tcx: &'a ty::ctxt<'tcx>,
@@ -99,36 +99,35 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
9999

100100
fn pat(&mut self, pat: &hir::Pat, pred: CFGIndex) -> CFGIndex {
101101
match pat.node {
102-
PatKind::Ident(_, _, None) |
103-
PatKind::TupleStruct(_, None) |
104-
PatKind::Path(..) |
105-
PatKind::QPath(..) |
106-
PatKind::Lit(..) |
107-
PatKind::Range(..) |
108-
PatKind::Wild => {
102+
hir::PatIdent(_, _, None) |
103+
hir::PatEnum(_, None) |
104+
hir::PatQPath(..) |
105+
hir::PatLit(..) |
106+
hir::PatRange(..) |
107+
hir::PatWild => {
109108
self.add_ast_node(pat.id, &[pred])
110109
}
111110

112-
PatKind::Box(ref subpat) |
113-
PatKind::Ref(ref subpat, _) |
114-
PatKind::Ident(_, _, Some(ref subpat)) => {
111+
hir::PatBox(ref subpat) |
112+
hir::PatRegion(ref subpat, _) |
113+
hir::PatIdent(_, _, Some(ref subpat)) => {
115114
let subpat_exit = self.pat(&subpat, pred);
116115
self.add_ast_node(pat.id, &[subpat_exit])
117116
}
118117

119-
PatKind::TupleStruct(_, Some(ref subpats)) |
120-
PatKind::Tup(ref subpats) => {
118+
hir::PatEnum(_, Some(ref subpats)) |
119+
hir::PatTup(ref subpats) => {
121120
let pats_exit = self.pats_all(subpats.iter(), pred);
122121
self.add_ast_node(pat.id, &[pats_exit])
123122
}
124123

125-
PatKind::Struct(_, ref subpats, _) => {
124+
hir::PatStruct(_, ref subpats, _) => {
126125
let pats_exit =
127126
self.pats_all(subpats.iter().map(|f| &f.node.pat), pred);
128127
self.add_ast_node(pat.id, &[pats_exit])
129128
}
130129

131-
PatKind::Vec(ref pre, ref vec, ref post) => {
130+
hir::PatVec(ref pre, ref vec, ref post) => {
132131
let pre_exit = self.pats_all(pre.iter(), pred);
133132
let vec_exit = self.pats_all(vec.iter(), pre_exit);
134133
let post_exit = self.pats_all(post.iter(), vec_exit);

0 commit comments

Comments
 (0)