Skip to content

Commit 75bb518

Browse files
committed
---
yaml --- r: 168517 b: refs/heads/batch c: c8c0391 h: refs/heads/master i: 168515: 74750e3 v: v3
1 parent 40d486b commit 75bb518

File tree

82 files changed

+695
-1140
lines changed

Some content is hidden

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

82 files changed

+695
-1140
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: 47b8479e73e40395f1b1b2d0c6281f28f80301e4
32+
refs/heads/batch: c8c039151963e29b92978444f2dc6590dd173ece
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970

branches/batch/src/liballoc/rc.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,17 @@ impl<T> Clone for Weak<T> {
719719
}
720720
}
721721

722+
#[experimental = "Show is experimental."]
723+
impl<T: fmt::Show> fmt::Show for Weak<T> {
724+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
725+
if self.strong() == 0 {
726+
write!(f, "NULL")
727+
} else {
728+
(*self._ptr).fmt(f)
729+
}
730+
}
731+
}
732+
722733
#[doc(hidden)]
723734
trait RcBoxPtr<T> {
724735
fn inner(&self) -> &RcBox<T>;

branches/batch/src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl<'a> Iterator<char> for Decompositions<'a> {
202202
let buffer = &mut self.buffer;
203203
let sorted = &mut self.sorted;
204204
{
205-
let callback = |&mut: d| {
205+
let callback = |d| {
206206
let class =
207207
unicode::char::canonical_combining_class(d);
208208
if class == 0 && !*sorted {

branches/batch/src/libcore/cell.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
use clone::Clone;
159159
use cmp::PartialEq;
160160
use default::Default;
161+
use fmt;
161162
use kinds::{Copy, Send};
162163
use ops::{Deref, DerefMut, Drop};
163164
use option::Option;
@@ -365,6 +366,16 @@ impl<T: PartialEq> PartialEq for RefCell<T> {
365366
}
366367
}
367368

369+
#[unstable]
370+
impl<T:fmt::Show> fmt::Show for RefCell<T> {
371+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
372+
match self.try_borrow() {
373+
Some(val) => write!(f, "{}", val),
374+
None => write!(f, "<borrowed RefCell>")
375+
}
376+
}
377+
}
378+
368379
struct BorrowRef<'b> {
369380
_borrow: &'b Cell<BorrowFlag>,
370381
}

branches/batch/src/libcore/fmt/float.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
225225
// cut off the one extra digit, and depending on its value
226226
// round the remaining ones.
227227
if limit_digits && dig == digit_count {
228-
let ascii2value = |&: chr: u8| {
228+
let ascii2value = |chr: u8| {
229229
(chr as char).to_digit(radix).unwrap()
230230
};
231-
let value2ascii = |&: val: uint| {
231+
let value2ascii = |val: uint| {
232232
char::from_digit(val, radix).unwrap() as u8
233233
};
234234

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ impl<'a> Formatter<'a> {
398398
}
399399

400400
// Writes the sign if it exists, and then the prefix if it was requested
401-
let write_prefix = |&: f: &mut Formatter| {
401+
let write_prefix = |f: &mut Formatter| {
402402
for c in sign.into_iter() {
403403
let mut b = [0, ..4];
404404
let n = c.encode_utf8(&mut b).unwrap_or(0);

branches/batch/src/libgetopts/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ fn each_split_within<F>(ss: &str, lim: uint, mut it: F) -> bool where
875875
lim = fake_i;
876876
}
877877

878-
let mut machine = |&mut: cont: &mut bool, (i, c): (uint, char)| -> bool {
878+
let machine: |&mut bool, (uint, char)| -> bool = |cont, (i, c)| {
879879
let whitespace = if c.is_whitespace() { Ws } else { Cr };
880880
let limit = if (i - slice_start + 1) <= lim { UnderLim } else { OverLim };
881881

branches/batch/src/librustc/metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
177177
}
178178

179179
pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
180-
let err = |&: s: &str| {
180+
let err = |s: &str| {
181181
match (sp, sess) {
182182
(_, None) => panic!("{}", s),
183183
(Some(sp), Some(sess)) => sess.span_err(sp, s),

branches/batch/src/librustc/metadata/csearch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub fn each_child_of_item<F>(cstore: &cstore::CStore,
6262
F: FnMut(decoder::DefLike, ast::Name, ast::Visibility),
6363
{
6464
let crate_data = cstore.get_crate_data(def_id.krate);
65-
let get_crate_data = |&mut: cnum| {
65+
let get_crate_data: decoder::GetCrateDataCb = |cnum| {
6666
cstore.get_crate_data(cnum)
6767
};
6868
decoder::each_child_of_item(cstore.intr.clone(),
@@ -79,7 +79,7 @@ pub fn each_top_level_item_of_crate<F>(cstore: &cstore::CStore,
7979
F: FnMut(decoder::DefLike, ast::Name, ast::Visibility),
8080
{
8181
let crate_data = cstore.get_crate_data(cnum);
82-
let get_crate_data = |&mut: cnum| {
82+
let get_crate_data: decoder::GetCrateDataCb = |cnum| {
8383
cstore.get_crate_data(cnum)
8484
};
8585
decoder::each_top_level_item_of_crate(cstore.intr.clone(),

branches/batch/src/librustc/metadata/decoder.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -487,13 +487,14 @@ pub fn each_lang_item<F>(cdata: Cmd, mut f: F) -> bool where
487487
})
488488
}
489489

490-
fn each_child_of_item_or_crate<F, G>(intr: Rc<IdentInterner>,
491-
cdata: Cmd,
492-
item_doc: rbml::Doc,
493-
mut get_crate_data: G,
494-
mut callback: F) where
490+
pub type GetCrateDataCb<'a> = |ast::CrateNum|: 'a -> Rc<crate_metadata>;
491+
492+
fn each_child_of_item_or_crate<F>(intr: Rc<IdentInterner>,
493+
cdata: Cmd,
494+
item_doc: rbml::Doc,
495+
get_crate_data: GetCrateDataCb,
496+
mut callback: F) where
495497
F: FnMut(DefLike, ast::Name, ast::Visibility),
496-
G: FnMut(ast::CrateNum) -> Rc<crate_metadata>,
497498
{
498499
// Iterate over all children.
499500
let _ = reader::tagged_docs(item_doc, tag_mod_child, |child_info_doc| {
@@ -607,13 +608,12 @@ fn each_child_of_item_or_crate<F, G>(intr: Rc<IdentInterner>,
607608
}
608609

609610
/// Iterates over each child of the given item.
610-
pub fn each_child_of_item<F, G>(intr: Rc<IdentInterner>,
611-
cdata: Cmd,
612-
id: ast::NodeId,
613-
get_crate_data: G,
614-
callback: F) where
611+
pub fn each_child_of_item<F>(intr: Rc<IdentInterner>,
612+
cdata: Cmd,
613+
id: ast::NodeId,
614+
get_crate_data: GetCrateDataCb,
615+
callback: F) where
615616
F: FnMut(DefLike, ast::Name, ast::Visibility),
616-
G: FnMut(ast::CrateNum) -> Rc<crate_metadata>,
617617
{
618618
// Find the item.
619619
let root_doc = rbml::Doc::new(cdata.data());
@@ -631,12 +631,11 @@ pub fn each_child_of_item<F, G>(intr: Rc<IdentInterner>,
631631
}
632632

633633
/// Iterates over all the top-level crate items.
634-
pub fn each_top_level_item_of_crate<F, G>(intr: Rc<IdentInterner>,
635-
cdata: Cmd,
636-
get_crate_data: G,
637-
callback: F) where
634+
pub fn each_top_level_item_of_crate<F>(intr: Rc<IdentInterner>,
635+
cdata: Cmd,
636+
get_crate_data: GetCrateDataCb,
637+
callback: F) where
638638
F: FnMut(DefLike, ast::Name, ast::Visibility),
639-
G: FnMut(ast::CrateNum) -> Rc<crate_metadata>,
640639
{
641640
let root_doc = rbml::Doc::new(cdata.data());
642641
let misc_info_doc = reader::get_doc(root_doc, tag_misc_info);

branches/batch/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,6 @@ fn encode_info_for_item(ecx: &EncodeContext,
14021402
}
14031403
ty::TypeTraitItem(associated_type) => {
14041404
encode_name(rbml_w, associated_type.name);
1405-
encode_def_id(rbml_w, associated_type.def_id);
14061405

14071406
let elem = ast_map::PathName(associated_type.name);
14081407
encode_path(rbml_w,
@@ -1418,7 +1417,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
14181417
encode_parent_sort(rbml_w, 't');
14191418

14201419
let trait_item = &ms[i];
1421-
let encode_trait_item = |&: rbml_w: &mut Encoder| {
1420+
let encode_trait_item = |rbml_w: &mut Encoder| {
14221421
// If this is a static method, we've already
14231422
// encoded this.
14241423
if is_nonstatic_method {

branches/batch/src/librustc/metadata/filesearch.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ pub enum FileMatch {
3030
// FIXME (#2658): I'm not happy how this module turned out. Should
3131
// probably just be folded into cstore.
3232

33+
/// Functions with type `pick` take a parent directory as well as
34+
/// a file found in that directory.
35+
pub type pick<'a> = |path: &Path|: 'a -> FileMatch;
36+
3337
pub struct FileSearch<'a> {
3438
pub sysroot: &'a Path,
3539
pub search_paths: &'a SearchPaths,
@@ -91,7 +95,7 @@ impl<'a> FileSearch<'a> {
9195
make_target_lib_path(self.sysroot, self.triple)
9296
}
9397

94-
pub fn search<F>(&self, mut pick: F) where F: FnMut(&Path) -> FileMatch {
98+
pub fn search(&self, pick: pick) {
9599
self.for_each_lib_search_path(|lib_search_path| {
96100
debug!("searching {}", lib_search_path.display());
97101
match fs::readdir(lib_search_path) {

branches/batch/src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &ast::Expr) -> bool {
185185
ast::ExprBlock(ref block) => {
186186
// Check all statements in the block
187187
for stmt in block.stmts.iter() {
188-
let block_span_err = |&: span|
188+
let block_span_err = |span|
189189
span_err!(v.tcx.sess, span, E0016,
190190
"blocks in constants are limited to items and \
191191
tail expressions");

branches/batch/src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
10121012
})
10131013
}
10141014

1015-
let check_move = |&: p: &Pat, sub: Option<&Pat>| {
1015+
let check_move: |&Pat, Option<&Pat>| = |p, sub| {
10161016
// check legality of moving out of the enum
10171017

10181018
// x @ Foo(..) is legal, but x @ Foo(y) isn't.

branches/batch/src/librustc/middle/infer/region_inference/graphviz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<'a, 'tcx> ConstraintGraph<'a, 'tcx> {
136136
let mut i = 0;
137137
let mut node_ids = FnvHashMap::new();
138138
{
139-
let mut add_node = |&mut : node| {
139+
let add_node = |node| {
140140
if let Vacant(e) = node_ids.entry(node) {
141141
e.set(i);
142142
i += 1;

branches/batch/src/librustc/middle/mem_categorization.rs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,15 +1122,11 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
11221122
})
11231123
}
11241124

1125-
pub fn cat_pattern<F>(&self, cmt: cmt<'tcx>, pat: &ast::Pat, mut op: F) where
1126-
F: FnMut(&MemCategorizationContext<'t, TYPER>, cmt<'tcx>, &ast::Pat),
1127-
{
1128-
self.cat_pattern_(cmt, pat, &mut op)
1129-
}
1130-
1131-
// FIXME(#19596) This is a workaround, but there should be a better way to do this
1132-
fn cat_pattern_<F>(&self, cmt: cmt<'tcx>, pat: &ast::Pat, op: &mut F) where
1133-
F: FnMut(&MemCategorizationContext<'t, TYPER>, cmt<'tcx>, &ast::Pat),
1125+
// FIXME(#19596) unbox `op`
1126+
pub fn cat_pattern(&self,
1127+
cmt: cmt<'tcx>,
1128+
pat: &ast::Pat,
1129+
op: |&MemCategorizationContext<'t, TYPER>, cmt<'tcx>, &ast::Pat|)
11341130
{
11351131
// Here, `cmt` is the categorization for the value being
11361132
// matched and pat is the pattern it is being matched against.
@@ -1181,7 +1177,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
11811177
pat.id, pprust::pat_to_string(pat),
11821178
cmt.repr(self.tcx()));
11831179

1184-
(*op)(self, cmt.clone(), pat);
1180+
op(self, cmt.clone(), pat);
11851181

11861182
let def_map = self.tcx().def_map.borrow();
11871183
let opt_def = def_map.get(&pat.id);
@@ -1218,7 +1214,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
12181214
pat, cmt.clone(), subpat_ty,
12191215
InteriorField(PositionalField(i)));
12201216

1221-
self.cat_pattern_(subcmt, &**subpat, op);
1217+
self.cat_pattern(subcmt, &**subpat, |x,y,z| op(x,y,z));
12221218
}
12231219
}
12241220
Some(&def::DefStruct(..)) => {
@@ -1228,12 +1224,13 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
12281224
self.cat_imm_interior(
12291225
pat, cmt.clone(), subpat_ty,
12301226
InteriorField(PositionalField(i)));
1231-
self.cat_pattern_(cmt_field, &**subpat, op);
1227+
self.cat_pattern(cmt_field, &**subpat,
1228+
|x,y,z| op(x,y,z));
12321229
}
12331230
}
12341231
Some(&def::DefConst(..)) => {
12351232
for subpat in subpats.iter() {
1236-
self.cat_pattern_(cmt.clone(), &**subpat, op);
1233+
self.cat_pattern(cmt.clone(), &**subpat, |x,y,z| op(x,y,z));
12371234
}
12381235
}
12391236
_ => {
@@ -1245,7 +1242,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
12451242
}
12461243

12471244
ast::PatIdent(_, _, Some(ref subpat)) => {
1248-
self.cat_pattern_(cmt, &**subpat, op);
1245+
self.cat_pattern(cmt, &**subpat, op);
12491246
}
12501247

12511248
ast::PatIdent(_, _, None) => {
@@ -1257,7 +1254,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
12571254
for fp in field_pats.iter() {
12581255
let field_ty = self.pat_ty(&*fp.node.pat); // see (*2)
12591256
let cmt_field = self.cat_field(pat, cmt.clone(), fp.node.ident.name, field_ty);
1260-
self.cat_pattern_(cmt_field, &*fp.node.pat, op);
1257+
self.cat_pattern(cmt_field, &*fp.node.pat, |x,y,z| op(x,y,z));
12611258
}
12621259
}
12631260

@@ -1269,28 +1266,29 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
12691266
self.cat_imm_interior(
12701267
pat, cmt.clone(), subpat_ty,
12711268
InteriorField(PositionalField(i)));
1272-
self.cat_pattern_(subcmt, &**subpat, op);
1269+
self.cat_pattern(subcmt, &**subpat, |x,y,z| op(x,y,z));
12731270
}
12741271
}
12751272

12761273
ast::PatBox(ref subpat) | ast::PatRegion(ref subpat) => {
12771274
// @p1, ~p1, ref p1
12781275
let subcmt = self.cat_deref(pat, cmt, 0, false);
1279-
self.cat_pattern_(subcmt, &**subpat, op);
1276+
self.cat_pattern(subcmt, &**subpat, op);
12801277
}
12811278

12821279
ast::PatVec(ref before, ref slice, ref after) => {
12831280
let elt_cmt = self.cat_index(pat, self.deref_vec(pat, cmt));
12841281
for before_pat in before.iter() {
1285-
self.cat_pattern_(elt_cmt.clone(), &**before_pat, op);
1282+
self.cat_pattern(elt_cmt.clone(), &**before_pat,
1283+
|x,y,z| op(x,y,z));
12861284
}
12871285
for slice_pat in slice.iter() {
12881286
let slice_ty = self.pat_ty(&**slice_pat);
12891287
let slice_cmt = self.cat_rvalue_node(pat.id(), pat.span(), slice_ty);
1290-
self.cat_pattern_(slice_cmt, &**slice_pat, op);
1288+
self.cat_pattern(slice_cmt, &**slice_pat, |x,y,z| op(x,y,z));
12911289
}
12921290
for after_pat in after.iter() {
1293-
self.cat_pattern_(elt_cmt.clone(), &**after_pat, op);
1291+
self.cat_pattern(elt_cmt.clone(), &**after_pat, |x,y,z| op(x,y,z));
12941292
}
12951293
}
12961294

branches/batch/src/librustc/middle/privacy.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
749749
fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
750750
debug!("privacy - path {}", self.nodestr(path_id));
751751
let orig_def = self.tcx.def_map.borrow()[path_id].clone();
752-
let ck = |&: tyname: &str| {
752+
let ck = |tyname: &str| {
753753
let ck_public = |def: ast::DefId| {
754754
let name = token::get_ident(path.segments.last().unwrap().identifier);
755755
let origdid = orig_def.def_id();
@@ -921,7 +921,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
921921
}
922922
}
923923
ast::ExprPath(..) => {
924-
let guard = |&: did: ast::DefId| {
924+
let guard = |did: ast::DefId| {
925925
let fields = ty::lookup_struct_fields(self.tcx, did);
926926
let any_priv = fields.iter().any(|f| {
927927
f.vis != ast::Public && (
@@ -1126,7 +1126,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
11261126
/// later on down the road...
11271127
fn check_sane_privacy(&self, item: &ast::Item) {
11281128
let tcx = self.tcx;
1129-
let check_inherited = |&: sp: Span, vis: ast::Visibility, note: &str| {
1129+
let check_inherited = |sp: Span, vis: ast::Visibility, note: &str| {
11301130
if vis != ast::Inherited {
11311131
tcx.sess.span_err(sp, "unnecessary visibility qualifier");
11321132
if note.len() > 0 {
@@ -1206,7 +1206,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
12061206
tcx.sess.span_err(sp, "visibility has no effect inside functions");
12071207
}
12081208
}
1209-
let check_struct = |&: def: &ast::StructDef| {
1209+
let check_struct = |def: &ast::StructDef| {
12101210
for f in def.fields.iter() {
12111211
match f.node.kind {
12121212
ast::NamedField(_, p) => check_inherited(tcx, f.span, p),

branches/batch/src/librustc/middle/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ fn resolve_expr(visitor: &mut RegionResolutionVisitor, expr: &ast::Expr) {
488488

489489
{
490490
let region_maps = &mut visitor.region_maps;
491-
let terminating = |&: id| {
491+
let terminating = |id| {
492492
let scope = CodeExtent::from_node_id(id);
493493
region_maps.mark_as_terminating_scope(scope)
494494
};

0 commit comments

Comments
 (0)