Skip to content

Commit f11c298

Browse files
committed
---
yaml --- r: 147412 b: refs/heads/try2 c: 5d0fea1 h: refs/heads/master v: v3
1 parent cd66a27 commit f11c298

File tree

9 files changed

+125
-97
lines changed

9 files changed

+125
-97
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 0c0c492101225b7e78800efc0f4bec6b43bb931f
8+
refs/heads/try2: 5d0fea144181eb8504852b664ff44543a429969e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,11 @@ ifneq ($(strip $(findstring snap,$(MAKECMDGOALS)) \
657657
include $(CFG_SRC_DIR)mk/snap.mk
658658
endif
659659

660+
ifneq ($(findstring reformat,$(MAKECMDGOALS)),)
661+
CFG_INFO := $(info cfg: including reformat rules)
662+
include $(CFG_SRC_DIR)mk/pp.mk
663+
endif
664+
660665
ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
661666
$(findstring test,$(MAKECMDGOALS)) \
662667
$(findstring perf,$(MAKECMDGOALS)) \

branches/try2/mk/pp.mk

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2+
# file at the top-level directory of this distribution and at
3+
# http://rust-lang.org/COPYRIGHT.
4+
#
5+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
# option. This file may not be copied, modified, or distributed
9+
# except according to those terms.
10+
11+
# Create a way to reformat just some files
12+
ifdef PPFILES
13+
PP_INPUTS_FILTERED := $(wildcard $(PPFILES))
14+
else
15+
PP_INPUTS = $(wildcard $(addprefix $(S)src/libstd/,*.rs */*.rs)) \
16+
$(wildcard $(addprefix $(S)src/libextra/,*.rs */*.rs)) \
17+
$(wildcard $(addprefix $(S)src/rustc/,*.rs */*.rs */*/*.rs)) \
18+
$(wildcard $(S)src/test/*/*.rs \
19+
$(S)src/test/*/*/*.rs) \
20+
$(wildcard $(S)src/rustpkg/*.rs) \
21+
$(wildcard $(S)src/rust/*.rs)
22+
23+
PP_INPUTS_FILTERED = $(shell echo $(PP_INPUTS) | xargs grep -L \
24+
"no-reformat\|xfail-pretty\|xfail-test")
25+
endif
26+
27+
reformat: $(SREQ1$(CFG_BUILD))
28+
@$(call E, reformat [stage1]: $@)
29+
for i in $(PP_INPUTS_FILTERED); \
30+
do $(call CFG_RUN_TARG_$(CFG_BUILD),1,$(CFG_BUILD)/stage1/rustc$(X_$(CFG_BUILD))) \
31+
--pretty normal $$i >$$i.tmp; \
32+
if [ $$? -ne 0 ]; \
33+
then echo failed to print $$i; rm $$i.tmp; \
34+
else if cmp --silent $$i.tmp $$i; \
35+
then echo no changes to $$i; rm $$i.tmp; \
36+
else echo reformated $$i; mv $$i.tmp $$i; \
37+
fi; \
38+
fi; \
39+
done

branches/try2/src/libextra/terminfo/parser/compiled.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ pub fn parse(file: &mut io::Reader,
320320
pub fn msys_terminfo() -> ~TermInfo {
321321
let mut strings = HashMap::new();
322322
strings.insert(~"sgr0", bytes!("\x1b[0m").to_owned());
323-
strings.insert(~"bold", bytes!("\x1b[1m").to_owned());
323+
strings.insert(~"bold", bytes!("\x1b[1m;").to_owned());
324324
strings.insert(~"setaf", bytes!("\x1b[3%p1%dm").to_owned());
325325
strings.insert(~"setab", bytes!("\x1b[4%p1%dm").to_owned());
326326
~TermInfo {

branches/try2/src/libstd/local_data.rs

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -353,56 +353,56 @@ mod tests {
353353

354354
#[test]
355355
fn test_tls_multitask() {
356-
static my_key: Key<~str> = &Key;
357-
set(my_key, ~"parent data");
356+
static my_key: Key<@~str> = &Key;
357+
set(my_key, @~"parent data");
358358
do task::spawn {
359359
// TLS shouldn't carry over.
360-
assert!(get(my_key, |k| k.map(|k| (*k).clone())).is_none());
361-
set(my_key, ~"child data");
362-
assert!(get(my_key, |k| k.map(|k| (*k).clone())).unwrap() ==
360+
assert!(get(my_key, |k| k.map(|k| *k)).is_none());
361+
set(my_key, @~"child data");
362+
assert!(*(get(my_key, |k| k.map(|k| *k)).unwrap()) ==
363363
~"child data");
364364
// should be cleaned up for us
365365
}
366366
// Must work multiple times
367-
assert!(get(my_key, |k| k.map(|k| (*k).clone())).unwrap() == ~"parent data");
368-
assert!(get(my_key, |k| k.map(|k| (*k).clone())).unwrap() == ~"parent data");
369-
assert!(get(my_key, |k| k.map(|k| (*k).clone())).unwrap() == ~"parent data");
367+
assert!(*(get(my_key, |k| k.map(|k| *k)).unwrap()) == ~"parent data");
368+
assert!(*(get(my_key, |k| k.map(|k| *k)).unwrap()) == ~"parent data");
369+
assert!(*(get(my_key, |k| k.map(|k| *k)).unwrap()) == ~"parent data");
370370
}
371371
372372
#[test]
373373
fn test_tls_overwrite() {
374-
static my_key: Key<~str> = &Key;
375-
set(my_key, ~"first data");
376-
set(my_key, ~"next data"); // Shouldn't leak.
377-
assert!(get(my_key, |k| k.map(|k| (*k).clone())).unwrap() == ~"next data");
374+
static my_key: Key<@~str> = &Key;
375+
set(my_key, @~"first data");
376+
set(my_key, @~"next data"); // Shouldn't leak.
377+
assert!(*(get(my_key, |k| k.map(|k| *k)).unwrap()) == ~"next data");
378378
}
379379
380380
#[test]
381381
fn test_tls_pop() {
382-
static my_key: Key<~str> = &Key;
383-
set(my_key, ~"weasel");
384-
assert!(pop(my_key).unwrap() == ~"weasel");
382+
static my_key: Key<@~str> = &Key;
383+
set(my_key, @~"weasel");
384+
assert!(*(pop(my_key).unwrap()) == ~"weasel");
385385
// Pop must remove the data from the map.
386386
assert!(pop(my_key).is_none());
387387
}
388388
389389
#[test]
390390
fn test_tls_modify() {
391-
static my_key: Key<~str> = &Key;
391+
static my_key: Key<@~str> = &Key;
392392
modify(my_key, |data| {
393393
match data {
394-
Some(ref val) => fail!("unwelcome value: {}", *val),
395-
None => Some(~"first data")
394+
Some(@ref val) => fail!("unwelcome value: {}", *val),
395+
None => Some(@~"first data")
396396
}
397397
});
398398
modify(my_key, |data| {
399399
match data {
400-
Some(~"first data") => Some(~"next data"),
401-
Some(ref val) => fail!("wrong value: {}", *val),
400+
Some(@~"first data") => Some(@~"next data"),
401+
Some(@ref val) => fail!("wrong value: {}", *val),
402402
None => fail!("missing value")
403403
}
404404
});
405-
assert!(pop(my_key).unwrap() == ~"next data");
405+
assert!(*(pop(my_key).unwrap()) == ~"next data");
406406
}
407407
408408
#[test]
@@ -413,67 +413,67 @@ mod tests {
413413
// to get recorded as something within a rust stack segment. Then a
414414
// subsequent upcall (esp. for logging, think vsnprintf) would run on
415415
// a stack smaller than 1 MB.
416-
static my_key: Key<~str> = &Key;
416+
static my_key: Key<@~str> = &Key;
417417
do task::spawn {
418-
set(my_key, ~"hax");
418+
set(my_key, @~"hax");
419419
}
420420
}
421421
422422
#[test]
423423
fn test_tls_multiple_types() {
424-
static str_key: Key<~str> = &Key;
425-
static box_key: Key<@()> = &Key;
426-
static int_key: Key<int> = &Key;
424+
static str_key: Key<@~str> = &Key;
425+
static box_key: Key<@@()> = &Key;
426+
static int_key: Key<@int> = &Key;
427427
do task::spawn {
428-
set(str_key, ~"string data");
429-
set(box_key, @());
430-
set(int_key, 42);
428+
set(str_key, @~"string data");
429+
set(box_key, @@());
430+
set(int_key, @42);
431431
}
432432
}
433433
434434
#[test]
435435
fn test_tls_overwrite_multiple_types() {
436-
static str_key: Key<~str> = &Key;
437-
static box_key: Key<@()> = &Key;
438-
static int_key: Key<int> = &Key;
436+
static str_key: Key<@~str> = &Key;
437+
static box_key: Key<@@()> = &Key;
438+
static int_key: Key<@int> = &Key;
439439
do task::spawn {
440-
set(str_key, ~"string data");
441-
set(str_key, ~"string data 2");
442-
set(box_key, @());
443-
set(box_key, @());
444-
set(int_key, 42);
440+
set(str_key, @~"string data");
441+
set(str_key, @~"string data 2");
442+
set(box_key, @@());
443+
set(box_key, @@());
444+
set(int_key, @42);
445445
// This could cause a segfault if overwriting-destruction is done
446446
// with the crazy polymorphic transmute rather than the provided
447447
// finaliser.
448-
set(int_key, 31337);
448+
set(int_key, @31337);
449449
}
450450
}
451451
452452
#[test]
453453
#[should_fail]
454454
fn test_tls_cleanup_on_failure() {
455-
static str_key: Key<~str> = &Key;
456-
static box_key: Key<@()> = &Key;
457-
static int_key: Key<int> = &Key;
458-
set(str_key, ~"parent data");
459-
set(box_key, @());
455+
static str_key: Key<@~str> = &Key;
456+
static box_key: Key<@@()> = &Key;
457+
static int_key: Key<@int> = &Key;
458+
set(str_key, @~"parent data");
459+
set(box_key, @@());
460460
do task::spawn {
461461
// spawn_linked
462-
set(str_key, ~"string data");
463-
set(box_key, @());
464-
set(int_key, 42);
462+
set(str_key, @~"string data");
463+
set(box_key, @@());
464+
set(int_key, @42);
465465
fail!();
466466
}
467467
// Not quite nondeterministic.
468-
set(int_key, 31337);
468+
set(int_key, @31337);
469469
fail!();
470470
}
471471

472472
#[test]
473473
fn test_static_pointer() {
474-
static key: Key<&'static int> = &Key;
474+
static key: Key<@&'static int> = &Key;
475475
static VALUE: int = 0;
476-
let v: &'static int = &VALUE;
476+
let v: @&'static int = @&VALUE;
477477
set(key, v);
478478
}
479479

branches/try2/src/libstd/option.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -445,34 +445,28 @@ mod tests {
445445

446446
#[test]
447447
fn test_get_resource() {
448-
use rc::Rc;
449-
use cell::RefCell;
450-
451448
struct R {
452-
i: Rc<RefCell<int>>,
449+
i: @mut int,
453450
}
454451

455452
#[unsafe_destructor]
456453
impl ::ops::Drop for R {
457-
fn drop(&mut self) {
458-
let ii = self.i.borrow();
459-
ii.set(ii.get() + 1);
460-
}
454+
fn drop(&mut self) { *(self.i) += 1; }
461455
}
462456

463-
fn R(i: Rc<RefCell<int>>) -> R {
457+
fn R(i: @mut int) -> R {
464458
R {
465459
i: i
466460
}
467461
}
468462

469-
let i = Rc::from_send(RefCell::new(0));
463+
let i = @mut 0;
470464
{
471-
let x = R(i.clone());
465+
let x = R(i);
472466
let opt = Some(x);
473467
let _y = opt.unwrap();
474468
}
475-
assert_eq!(i.borrow().get(), 1);
469+
assert_eq!(*i, 1);
476470
}
477471

478472
#[test]

0 commit comments

Comments
 (0)