Skip to content

Commit a3f8cc5

Browse files
committed
---
yaml --- r: 124573 b: refs/heads/auto c: f05a2c9 h: refs/heads/master i: 124571: 52b4123 v: v3
1 parent 3b974a4 commit a3f8cc5

Some content is hidden

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

90 files changed

+2123
-508
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: 5274e997abc9273ef259199a1036f7753246bada
16+
refs/heads/auto: f05a2c97b8e41177e531c4440519333057f9ac55
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/libcore/ops.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,19 +749,23 @@ pub trait DerefMut<Result>: Deref<Result> {
749749
#[lang="fn"]
750750
pub trait Fn<Args,Result> {
751751
/// This is called when the call operator is used.
752+
#[rust_call_abi_hack]
752753
fn call(&self, args: Args) -> Result;
753754
}
754755

755756
/// A version of the call operator that takes a mutable receiver.
756757
#[lang="fn_mut"]
757758
pub trait FnMut<Args,Result> {
758759
/// This is called when the call operator is used.
760+
#[rust_call_abi_hack]
759761
fn call_mut(&mut self, args: Args) -> Result;
760762
}
761763

762764
/// A version of the call operator that takes a by-value receiver.
763765
#[lang="fn_once"]
764766
pub trait FnOnce<Args,Result> {
765767
/// This is called when the call operator is used.
768+
#[rust_call_abi_hack]
766769
fn call_once(self, args: Args) -> Result;
767770
}
771+

branches/auto/src/libcore/prelude.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub use ops::{BitAnd, BitOr, BitXor};
3535
pub use ops::{Drop, Deref, DerefMut};
3636
pub use ops::{Shl, Shr};
3737
pub use ops::{Index, IndexMut};
38+
pub use ops::{Fn, FnMut, FnOnce};
3839
pub use option::{Option, Some, None};
3940
pub use result::{Result, Ok, Err};
4041

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/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/front/feature_gate.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
6767
("quad_precision_float", Removed),
6868

6969
("rustc_diagnostic_macros", Active),
70+
("unboxed_closures", Active),
7071

7172
// A temporary feature gate used to enable parser extensions needed
7273
// to bootstrap fix for #5723.
@@ -327,6 +328,12 @@ impl<'a> Visitor<()> for Context<'a> {
327328
ast::ExprUnary(ast::UnBox, _) => {
328329
self.gate_box(e.span);
329330
}
331+
ast::ExprUnboxedFn(..) => {
332+
self.gate_feature("unboxed_closures",
333+
e.span,
334+
"unboxed closures are a work-in-progress \
335+
feature with known bugs");
336+
}
330337
_ => {}
331338
}
332339
visit::walk_expr(self, e, ());

branches/auto/src/librustc/lint/builtin.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,9 @@ impl LintPass for Stability {
14511451
typeck::MethodStatic(def_id) => {
14521452
def_id
14531453
}
1454+
typeck::MethodStaticUnboxedClosure(def_id) => {
1455+
def_id
1456+
}
14541457
typeck::MethodParam(typeck::MethodParam {
14551458
trait_id: trait_id,
14561459
method_num: index,

branches/auto/src/librustc/metadata/common.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ pub enum astencode_tag { // Reserves 0x40 -- 0x5f
138138
tag_table_vtable_map = 0x50,
139139
tag_table_adjustments = 0x51,
140140
tag_table_moves_map = 0x52,
141-
tag_table_capture_map = 0x53
141+
tag_table_capture_map = 0x53,
142+
tag_table_unboxed_closure_type = 0x54,
142143
}
143144
static first_astencode_tag: uint = tag_ast as uint;
144-
static last_astencode_tag: uint = tag_table_capture_map as uint;
145+
static last_astencode_tag: uint = tag_table_unboxed_closure_type as uint;
145146
impl astencode_tag {
146147
pub fn from_uint(value : uint) -> Option<astencode_tag> {
147148
let is_a_tag = first_astencode_tag <= value && value <= last_astencode_tag;
@@ -155,6 +156,10 @@ pub static tag_item_trait_method_sort: uint = 0x60;
155156

156157
pub static tag_item_impl_type_basename: uint = 0x61;
157158

159+
pub static tag_crate_triple: uint = 0x66;
160+
161+
pub static tag_dylib_dependency_formats: uint = 0x67;
162+
158163
// Language items are a top-level directory (for speed). Hierarchy:
159164
//
160165
// tag_lang_items
@@ -199,10 +204,6 @@ pub static tag_plugin_registrar_fn: uint = 0x8b;
199204
pub static tag_exported_macros: uint = 0x8c;
200205
pub static tag_macro_def: uint = 0x8d;
201206

202-
pub static tag_crate_triple: uint = 0x66;
203-
204-
pub static tag_dylib_dependency_formats: uint = 0x67;
205-
206207
pub static tag_method_argument_names: uint = 0x8e;
207208
pub static tag_method_argument_name: uint = 0x8f;
208209

@@ -211,7 +212,6 @@ pub static tag_reachable_extern_fn_id: uint = 0x91;
211212

212213
pub static tag_items_data_item_stability: uint = 0x92;
213214

214-
215215
#[deriving(Clone, Show)]
216216
pub struct LinkMeta {
217217
pub crate_name: String,
@@ -223,3 +223,7 @@ pub static tag_region_param_def_ident: uint = 0x91;
223223
pub static tag_region_param_def_def_id: uint = 0x92;
224224
pub static tag_region_param_def_space: uint = 0x93;
225225
pub static tag_region_param_def_index: uint = 0x94;
226+
227+
pub static tag_unboxed_closures: uint = 0x95;
228+
pub static tag_unboxed_closure: uint = 0x96;
229+
pub static tag_unboxed_closure_type: uint = 0x97;

0 commit comments

Comments
 (0)