Skip to content

Commit 875940c

Browse files
committed
---
yaml --- r: 124579 b: refs/heads/auto c: e0a6e2b h: refs/heads/master i: 124577: daebdb7 124575: 23d0bb2 v: v3
1 parent 39df115 commit 875940c

File tree

30 files changed

+494
-406
lines changed

30 files changed

+494
-406
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 61ded48fbcc79e0b3d532bb17f38b1c1baf56d41
16+
refs/heads/auto: e0a6e2b41421928206cc71be27da1239b4598ed1
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libcollections/dlist.rs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,23 @@ impl<T> DList<T> {
278278
/// Move the last element to the front of the list.
279279
///
280280
/// If the list is empty, do nothing.
281+
///
282+
/// # Example
283+
///
284+
/// ```rust
285+
/// use std::collections::{DList, Deque};
286+
///
287+
/// let mut dl = DList::new();
288+
/// dl.push_back(1i);
289+
/// dl.push_back(2);
290+
/// dl.push_back(3);
291+
///
292+
/// dl.rotate_forward();
293+
///
294+
/// for e in dl.iter() {
295+
/// println!("{}", e); // prints 3, then 1, then 2
296+
/// }
297+
/// ```
281298
#[inline]
282299
pub fn rotate_forward(&mut self) {
283300
self.pop_back_node().map(|tail| {
@@ -288,6 +305,23 @@ impl<T> DList<T> {
288305
/// Move the first element to the back of the list.
289306
///
290307
/// If the list is empty, do nothing.
308+
///
309+
/// # Example
310+
///
311+
/// ```rust
312+
/// use std::collections::{DList, Deque};
313+
///
314+
/// let mut dl = DList::new();
315+
/// dl.push_back(1i);
316+
/// dl.push_back(2);
317+
/// dl.push_back(3);
318+
///
319+
/// dl.rotate_backward();
320+
///
321+
/// for e in dl.iter() {
322+
/// println!("{}", e); // prints 2, then 3, then 1
323+
/// }
324+
/// ```
291325
#[inline]
292326
pub fn rotate_backward(&mut self) {
293327
self.pop_front_node().map(|head| {
@@ -298,6 +332,25 @@ impl<T> DList<T> {
298332
/// Add all elements from `other` to the end of the list
299333
///
300334
/// O(1)
335+
///
336+
/// # Example
337+
///
338+
/// ```rust
339+
/// use std::collections::{DList, Deque};
340+
///
341+
/// let mut a = DList::new();
342+
/// let mut b = DList::new();
343+
/// a.push_back(1i);
344+
/// a.push_back(2);
345+
/// b.push_back(3i);
346+
/// b.push_back(4);
347+
///
348+
/// a.append(b);
349+
///
350+
/// for e in a.iter() {
351+
/// println!("{}", e); // prints 1, then 2, then 3, then 4
352+
/// }
353+
/// ```
301354
pub fn append(&mut self, mut other: DList<T>) {
302355
match self.list_tail.resolve() {
303356
None => *self = other,
@@ -320,6 +373,25 @@ impl<T> DList<T> {
320373
/// Add all elements from `other` to the beginning of the list
321374
///
322375
/// O(1)
376+
///
377+
/// # Example
378+
///
379+
/// ```rust
380+
/// use std::collections::{DList, Deque};
381+
///
382+
/// let mut a = DList::new();
383+
/// let mut b = DList::new();
384+
/// a.push_back(1i);
385+
/// a.push_back(2);
386+
/// b.push_back(3i);
387+
/// b.push_back(4);
388+
///
389+
/// a.prepend(b);
390+
///
391+
/// for e in a.iter() {
392+
/// println!("{}", e); // prints 3, then 4, then 1, then 2
393+
/// }
394+
/// ```
323395
#[inline]
324396
pub fn prepend(&mut self, mut other: DList<T>) {
325397
mem::swap(self, &mut other);
@@ -330,6 +402,25 @@ impl<T> DList<T> {
330402
/// or at the end.
331403
///
332404
/// O(N)
405+
///
406+
/// # Example
407+
///
408+
/// ```rust
409+
/// use std::collections::{DList, Deque};
410+
///
411+
/// let mut a: DList<int> = DList::new();
412+
/// a.push_back(2i);
413+
/// a.push_back(4);
414+
/// a.push_back(7);
415+
/// a.push_back(8);
416+
///
417+
/// // insert 11 before the first odd number in the list
418+
/// a.insert_when(11, |&e, _| e % 2 == 1);
419+
///
420+
/// for e in a.iter() {
421+
/// println!("{}", e); // prints 2, then 4, then 11, then 7, then 8
422+
/// }
423+
/// ```
333424
pub fn insert_when(&mut self, elt: T, f: |&T, &T| -> bool) {
334425
{
335426
let mut it = self.mut_iter();

branches/auto/src/librustc/back/link.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,15 +571,27 @@ pub fn find_crate_name(sess: Option<&Session>,
571571
};
572572

573573
// Look in attributes 100% of the time to make sure the attribute is marked
574-
// as used. After doing this, however, favor crate names from the command
575-
// line.
574+
// as used. After doing this, however, we still prioritize a crate name from
575+
// the command line over one found in the #[crate_name] attribute. If we
576+
// find both we ensure that they're the same later on as well.
576577
let attr_crate_name = attrs.iter().find(|at| at.check_name("crate_name"))
577578
.and_then(|at| at.value_str().map(|s| (at, s)));
578579

579580
match sess {
580581
Some(sess) => {
581582
match sess.opts.crate_name {
582-
Some(ref s) => return validate(s.clone(), None),
583+
Some(ref s) => {
584+
match attr_crate_name {
585+
Some((attr, ref name)) if s.as_slice() != name.get() => {
586+
let msg = format!("--crate-name and #[crate_name] \
587+
are required to match, but `{}` \
588+
!= `{}`", s, name);
589+
sess.span_err(attr.span, msg.as_slice());
590+
}
591+
_ => {},
592+
}
593+
return validate(s.clone(), None);
594+
}
583595
None => {}
584596
}
585597
}
@@ -1547,7 +1559,7 @@ fn add_upstream_rust_crates(cmd: &mut Command, sess: &Session,
15471559
add_dynamic_crate(cmd, sess, src.dylib.unwrap())
15481560
}
15491561
cstore::RequireStatic => {
1550-
add_static_crate(cmd, sess, tmpdir, cnum, src.rlib.unwrap())
1562+
add_static_crate(cmd, sess, tmpdir, src.rlib.unwrap())
15511563
}
15521564
}
15531565

@@ -1564,7 +1576,7 @@ fn add_upstream_rust_crates(cmd: &mut Command, sess: &Session,
15641576

15651577
// Adds the static "rlib" versions of all crates to the command line.
15661578
fn add_static_crate(cmd: &mut Command, sess: &Session, tmpdir: &Path,
1567-
cnum: ast::CrateNum, cratepath: Path) {
1579+
cratepath: Path) {
15681580
// When performing LTO on an executable output, all of the
15691581
// bytecode from the upstream libraries has already been
15701582
// included in our object file output. We need to modify all of
@@ -1580,7 +1592,8 @@ fn add_upstream_rust_crates(cmd: &mut Command, sess: &Session,
15801592
// If we're not doing LTO, then our job is simply to just link
15811593
// against the archive.
15821594
if sess.lto() {
1583-
let name = sess.cstore.get_crate_data(cnum).name.clone();
1595+
let name = cratepath.filename_str().unwrap();
1596+
let name = name.slice(3, name.len() - 5); // chop off lib/.rlib
15841597
time(sess.time_passes(),
15851598
format!("altering {}.rlib", name).as_slice(),
15861599
(), |()| {

branches/auto/src/librustc/back/lto.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,19 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
5454
};
5555

5656
let archive = ArchiveRO::open(&path).expect("wanted an rlib");
57-
debug!("reading {}", name);
57+
let file = path.filename_str().unwrap();
58+
let file = file.slice(3, file.len() - 5); // chop off lib/.rlib
59+
debug!("reading {}", file);
5860
let bc = time(sess.time_passes(),
5961
format!("read {}.bytecode.deflate", name).as_slice(),
6062
(),
6163
|_| {
6264
archive.read(format!("{}.bytecode.deflate",
63-
name).as_slice())
65+
file).as_slice())
6466
});
6567
let bc = bc.expect("missing compressed bytecode in archive!");
6668
let bc = time(sess.time_passes(),
67-
format!("inflate {}.bc", name).as_slice(),
69+
format!("inflate {}.bc", file).as_slice(),
6870
(),
6971
|_| {
7072
match flate::inflate_bytes(bc) {

branches/auto/src/librustc/diagnostics.rs

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,68 @@ register_diagnostics!(
110110
E0091,
111111
E0092,
112112
E0093,
113-
E0094
113+
E0094,
114+
E0095,
115+
E0096,
116+
E0097,
117+
E0098,
118+
E0099,
119+
E0100,
120+
E0101,
121+
E0102,
122+
E0103,
123+
E0104,
124+
E0105,
125+
E0106,
126+
E0107,
127+
E0108,
128+
E0109,
129+
E0110,
130+
E0111,
131+
E0112,
132+
E0113,
133+
E0114,
134+
E0115,
135+
E0116,
136+
E0117,
137+
E0118,
138+
E0119,
139+
E0120,
140+
E0121,
141+
E0122,
142+
E0123,
143+
E0124,
144+
E0125,
145+
E0126,
146+
E0127,
147+
E0128,
148+
E0129,
149+
E0130,
150+
E0131,
151+
E0132,
152+
E0133,
153+
E0134,
154+
E0135,
155+
E0136,
156+
E0137,
157+
E0138,
158+
E0139,
159+
E0140,
160+
E0141,
161+
E0142,
162+
E0143,
163+
E0144,
164+
E0145,
165+
E0146,
166+
E0147,
167+
E0148,
168+
E0149,
169+
E0150,
170+
E0151,
171+
E0152,
172+
E0153,
173+
E0154,
174+
E0155,
175+
E0156,
176+
E0157
114177
)

branches/auto/src/librustc/driver/driver.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,7 @@ pub struct OutputFilenames {
936936
pub out_directory: Path,
937937
pub out_filestem: String,
938938
pub single_output_file: Option<Path>,
939+
extra: String,
939940
}
940941

941942
impl OutputFilenames {
@@ -948,7 +949,7 @@ impl OutputFilenames {
948949
}
949950

950951
pub fn temp_path(&self, flavor: link::OutputType) -> Path {
951-
let base = self.out_directory.join(self.out_filestem.as_slice());
952+
let base = self.out_directory.join(self.filestem());
952953
match flavor {
953954
link::OutputTypeBitcode => base.with_extension("bc"),
954955
link::OutputTypeAssembly => base.with_extension("s"),
@@ -959,8 +960,11 @@ impl OutputFilenames {
959960
}
960961

961962
pub fn with_extension(&self, extension: &str) -> Path {
962-
let stem = self.out_filestem.as_slice();
963-
self.out_directory.join(stem).with_extension(extension)
963+
self.out_directory.join(self.filestem()).with_extension(extension)
964+
}
965+
966+
fn filestem(&self) -> String {
967+
format!("{}{}", self.out_filestem, self.extra)
964968
}
965969
}
966970

@@ -1000,6 +1004,7 @@ pub fn build_output_filenames(input: &Input,
10001004
out_directory: dirpath,
10011005
out_filestem: stem,
10021006
single_output_file: None,
1007+
extra: sess.opts.cg.extra_filename.clone(),
10031008
}
10041009
}
10051010

@@ -1018,6 +1023,7 @@ pub fn build_output_filenames(input: &Input,
10181023
out_directory: out_file.dir_path(),
10191024
out_filestem: out_file.filestem_str().unwrap().to_string(),
10201025
single_output_file: ofile,
1026+
extra: sess.opts.cg.extra_filename.clone(),
10211027
}
10221028
}
10231029
}

branches/auto/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl<'a> CheckLoanCtxt<'a> {
172172
//! are issued for future scopes and thus they may have been
173173
//! *issued* but not yet be in effect.
174174
175-
self.dfcx_loans.each_bit_on_entry_frozen(scope_id, |loan_index| {
175+
self.dfcx_loans.each_bit_on_entry(scope_id, |loan_index| {
176176
let loan = &self.all_loans[loan_index];
177177
op(loan)
178178
})
@@ -271,7 +271,7 @@ impl<'a> CheckLoanCtxt<'a> {
271271
//! we encounter `scope_id`.
272272
273273
let mut result = Vec::new();
274-
self.dfcx_loans.each_gen_bit_frozen(scope_id, |loan_index| {
274+
self.dfcx_loans.each_gen_bit(scope_id, |loan_index| {
275275
result.push(loan_index);
276276
true
277277
});

branches/auto/src/librustc/middle/borrowck/move_data.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ impl<'a> FlowedMoveData<'a> {
576576
* Iterates through each path moved by `id`
577577
*/
578578

579-
self.dfcx_moves.each_gen_bit_frozen(id, |index| {
579+
self.dfcx_moves.each_gen_bit(id, |index| {
580580
let move = self.move_data.moves.borrow();
581581
let move = move.get(index);
582582
let moved_path = move.path;
@@ -592,7 +592,7 @@ impl<'a> FlowedMoveData<'a> {
592592
593593
let mut ret = None;
594594
for loan_path_index in self.move_data.path_map.borrow().find(&*loan_path).iter() {
595-
self.dfcx_moves.each_gen_bit_frozen(id, |move_index| {
595+
self.dfcx_moves.each_gen_bit(id, |move_index| {
596596
let move = self.move_data.moves.borrow();
597597
let move = move.get(move_index);
598598
if move.path == **loan_path_index {
@@ -637,7 +637,7 @@ impl<'a> FlowedMoveData<'a> {
637637

638638
let mut ret = true;
639639

640-
self.dfcx_moves.each_bit_on_entry_frozen(id, |index| {
640+
self.dfcx_moves.each_bit_on_entry(id, |index| {
641641
let move = self.move_data.moves.borrow();
642642
let move = move.get(index);
643643
let moved_path = move.path;
@@ -693,7 +693,7 @@ impl<'a> FlowedMoveData<'a> {
693693
}
694694
};
695695

696-
self.dfcx_assign.each_bit_on_entry_frozen(id, |index| {
696+
self.dfcx_assign.each_bit_on_entry(id, |index| {
697697
let assignment = self.move_data.var_assignments.borrow();
698698
let assignment = assignment.get(index);
699699
if assignment.path == loan_path_index && !f(assignment) {

0 commit comments

Comments
 (0)