Skip to content

Commit 9e322c3

Browse files
committed
---
yaml --- r: 47868 b: refs/heads/incoming c: 9dae4cf h: refs/heads/master v: v3
1 parent 91c3d02 commit 9e322c3

39 files changed

+200
-134
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 48c1c3cfc076bf155c1e54afa41ec560b343f52d
9+
refs/heads/incoming: 9dae4cf1f0f2fd82ee653d89abc46d349b6e6caa
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/compiletest/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub enum mode {
2121
mode_debug_info,
2222
}
2323

24-
pub struct config {
24+
pub type config = {
2525
// The library paths required for running the compiler
2626
compile_lib_path: ~str,
2727

@@ -68,4 +68,4 @@ pub struct config {
6868
// Explain what's going on
6969
verbose: bool
7070

71-
}
71+
};

branches/incoming/src/compiletest/compiletest.rc

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#[crate_type = "bin"];
1212

1313
#[no_core];
14+
#[legacy_records];
1415

1516
#[allow(vecs_implicitly_copyable)];
1617
#[allow(non_camel_case_types)];
@@ -76,28 +77,26 @@ pub fn parse_config(args: ~[~str]) -> config {
7677
Path(getopts::opt_str(m, nm))
7778
}
7879

79-
config {
80-
compile_lib_path: getopts::opt_str(matches, ~"compile-lib-path"),
81-
run_lib_path: getopts::opt_str(matches, ~"run-lib-path"),
82-
rustc_path: opt_path(matches, ~"rustc-path"),
83-
src_base: opt_path(matches, ~"src-base"),
84-
build_base: opt_path(matches, ~"build-base"),
85-
aux_base: opt_path(matches, ~"aux-base"),
86-
stage_id: getopts::opt_str(matches, ~"stage-id"),
87-
mode: str_mode(getopts::opt_str(matches, ~"mode")),
88-
run_ignored: getopts::opt_present(matches, ~"ignored"),
89-
filter:
80+
return {compile_lib_path: getopts::opt_str(matches, ~"compile-lib-path"),
81+
run_lib_path: getopts::opt_str(matches, ~"run-lib-path"),
82+
rustc_path: opt_path(matches, ~"rustc-path"),
83+
src_base: opt_path(matches, ~"src-base"),
84+
build_base: opt_path(matches, ~"build-base"),
85+
aux_base: opt_path(matches, ~"aux-base"),
86+
stage_id: getopts::opt_str(matches, ~"stage-id"),
87+
mode: str_mode(getopts::opt_str(matches, ~"mode")),
88+
run_ignored: getopts::opt_present(matches, ~"ignored"),
89+
filter:
9090
if vec::len(matches.free) > 0u {
9191
option::Some(matches.free[0])
9292
} else { option::None },
93-
logfile: option::map(&getopts::opt_maybe_str(matches,
93+
logfile: option::map(&getopts::opt_maybe_str(matches,
9494
~"logfile"),
95-
|s| Path(*s)),
96-
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
97-
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
98-
jit: getopts::opt_present(matches, ~"jit"),
99-
verbose: getopts::opt_present(matches, ~"verbose")
100-
}
95+
|s| Path(*s)),
96+
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
97+
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
98+
jit: getopts::opt_present(matches, ~"jit"),
99+
verbose: getopts::opt_present(matches, ~"verbose")};
101100
}
102101

103102
pub fn log_config(config: config) {

branches/incoming/src/libcore/private.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ pub mod tests {
493493
res.recv();
494494
}
495495
496-
#[test] #[should_fail] #[ignore(reason = "random red")]
496+
#[test] #[should_fail] #[ignore(cfg(windows))]
497497
pub fn exclusive_unwrap_conflict() {
498498
let x = exclusive(~~"hello");
499499
let x2 = ~mut Some(x.clone());
@@ -505,7 +505,8 @@ pub mod tests {
505505
}
506506
assert unwrap_exclusive(x) == ~~"hello";
507507
let res = option::swap_unwrap(&mut res);
508-
res.recv();
508+
// See #4689 for why this can't be just "res.recv()".
509+
assert res.recv() == task::Success;
509510
}
510511
511512
#[test] #[ignore(cfg(windows))]

branches/incoming/src/librustc/middle/astencode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,13 +1278,13 @@ fn test_simplification() {
12781278
let item_in = ast::ii_item(quote_item!(
12791279
fn new_int_alist<B:Copy>() -> alist<int, B> {
12801280
fn eq_int(&&a: int, &&b: int) -> bool { a == b }
1281-
return alist {eq_fn: eq_int, data: ~[]};
1281+
return {eq_fn: eq_int, data: ~[]};
12821282
}
12831283
).get());
12841284
let item_out = simplify_ast(item_in);
12851285
let item_exp = ast::ii_item(quote_item!(
12861286
fn new_int_alist<B:Copy>() -> alist<int, B> {
1287-
return alist {eq_fn: eq_int, data: ~[]};
1287+
return {eq_fn: eq_int, data: ~[]};
12881288
}
12891289
).get());
12901290
match (item_out, item_exp) {

branches/incoming/src/librustc/middle/lint.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -706,21 +706,23 @@ fn check_item_deprecated_self(cx: ty::ctxt, item: @ast::item) {
706706
}
707707
708708
fn check_item_structural_records(cx: ty::ctxt, it: @ast::item) {
709-
let visit = item_stopping_visitor(
710-
visit::mk_simple_visitor(@visit::SimpleVisitor {
711-
visit_expr: |e: @ast::expr| {
712-
match e.node {
713-
ast::expr_rec(*) =>
714-
cx.sess.span_lint(
715-
structural_records, e.id, it.id,
716-
e.span,
717-
~"structural records are deprecated"),
718-
_ => ()
719-
}
720-
},
721-
.. *visit::default_simple_visitor()
722-
}));
723-
visit::visit_item(it, (), visit);
709+
if !cx.legacy_records {
710+
let visit = item_stopping_visitor(
711+
visit::mk_simple_visitor(@visit::SimpleVisitor {
712+
visit_expr: |e: @ast::expr| {
713+
match e.node {
714+
ast::expr_rec(*) =>
715+
cx.sess.span_lint(
716+
structural_records, e.id, it.id,
717+
e.span,
718+
~"structural records are deprecated"),
719+
_ => ()
720+
}
721+
},
722+
.. *visit::default_simple_visitor()
723+
}));
724+
visit::visit_item(it, (), visit);
725+
}
724726
}
725727

726728
fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) {

branches/incoming/src/librustc/middle/ty.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ struct ctxt_ {
233233
mut next_id: uint,
234234
vecs_implicitly_copyable: bool,
235235
legacy_modes: bool,
236+
legacy_records: bool,
236237
cstore: @mut metadata::cstore::CStore,
237238
sess: session::Session,
238239
def_map: resolve::DefMap,
@@ -788,10 +789,16 @@ pub fn mk_ctxt(s: session::Session,
788789
crate: @ast::crate)
789790
-> ctxt {
790791
let mut legacy_modes = false;
792+
let mut legacy_records = false;
791793
for crate.node.attrs.each |attribute| {
792794
match attribute.node.value.node {
793795
ast::meta_word(w) if *w == ~"legacy_modes" => {
794796
legacy_modes = true;
797+
if legacy_records { break; }
798+
}
799+
ast::meta_word(w) if *w == ~"legacy_records" => {
800+
legacy_records = true;
801+
if legacy_modes { break; }
795802
}
796803
_ => {}
797804
}
@@ -807,6 +814,7 @@ pub fn mk_ctxt(s: session::Session,
807814
mut next_id: 0u,
808815
vecs_implicitly_copyable: vecs_implicitly_copyable,
809816
legacy_modes: legacy_modes,
817+
legacy_records: legacy_records,
810818
cstore: s.cstore,
811819
sess: s,
812820
def_map: dm,

branches/incoming/src/librusti/rusti.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#[crate_type = "lib"];
1919

20+
#[legacy_records];
2021
#[no_core];
2122

2223
#[allow(vecs_implicitly_copyable,

branches/incoming/src/librusti/wrapper.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#[allow(non_implicitly_copyable_typarams)];
1717
#[allow(owned_heap_memory)];
1818
#[allow(path_statement)];
19+
#[allow(structural_records)];
1920
#[allow(unrecognized_lint)];
2021
#[allow(unused_imports)];
2122
#[allow(vecs_implicitly_copyable)];

branches/incoming/src/librustpkg/rustpkg.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#[allow(vecs_implicitly_copyable,
2121
non_implicitly_copyable_typarams)];
2222

23+
#[legacy_records];
24+
2325
extern mod core(vers = "0.6");
2426
extern mod std(vers = "0.6");
2527
extern mod rustc(vers = "0.6");

branches/incoming/src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,7 @@ pub impl Parser {
19261926
fields.push(self.parse_field(token::COLON));
19271927
}
19281928
self.expect(token::RBRACE);
1929-
self.warn(~"REC");
1929+
//self.warn(~"REC");
19301930
return expr_rec(fields, base);
19311931
}
19321932

branches/incoming/src/test/bench/pingpong.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// Compare bounded and unbounded protocol performance.
1212

13+
#[allow(structural_records)]; // Pipes
14+
// Until a snapshot
1315
// xfail-pretty
1416

1517
extern mod std;

branches/incoming/src/test/compile-fail/borrowck-assign-comp.rs

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

11-
struct point {x: int, mut y: int }
11+
type point = { x: int, y: int };
1212

1313
fn a() {
14-
let mut p = point {x: 3, y: 4};
14+
let mut p = {x: 3, y: 4};
1515
let _q = &p; //~ NOTE loan of mutable local variable granted here
1616

1717
// This assignment is illegal because the field x is not
@@ -21,29 +21,29 @@ fn a() {
2121
}
2222

2323
fn b() {
24-
let mut p = point {x: 3, mut y: 4};
25-
// This assignment is legal because `y` is inherently mutable (and
26-
// hence &_q.y is &mut int).
24+
let mut p = {x: 3, mut y: 4};
2725
let _q = &p;
2826

27+
// This assignment is legal because `y` is inherently mutable (and
28+
// hence &_q.y is &mut int).
2929
p.y = 5;
3030
}
3131

3232
fn c() {
3333
// this is sort of the opposite. We take a loan to the interior of `p`
3434
// and then try to overwrite `p` as a whole.
3535

36-
let mut p = point {x: 3, mut y: 4};
36+
let mut p = {x: 3, mut y: 4};
3737
let _q = &p.y; //~ NOTE loan of mutable local variable granted here
38-
p = point {x: 5, mut y: 7};//~ ERROR assigning to mutable local variable prohibited due to outstanding loan
38+
p = {x: 5, mut y: 7};//~ ERROR assigning to mutable local variable prohibited due to outstanding loan
3939
copy p;
4040
}
4141

4242
fn d() {
4343
// just for completeness's sake, the easy case, where we take the
4444
// address of a subcomponent and then modify that subcomponent:
4545

46-
let mut p = point {x: 3, mut y: 4};
46+
let mut p = {x: 3, mut y: 4};
4747
let _q = &p.y; //~ NOTE loan of mutable field granted here
4848
p.y = 5; //~ ERROR assigning to mutable field prohibited due to outstanding loan
4949
copy p;

branches/incoming/src/test/compile-fail/borrowck-assign-to-subfield.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,11 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
struct A {
13-
a: int,
14-
w: B,
15-
x: @B,
16-
y: @const B,
17-
z: @mut B
18-
}
19-
struct B {
20-
a: int
21-
}
22-
let mut p = A {
23-
a: 1,
24-
w: B {a: 1},
25-
x: @B {a: 1},
26-
y: @const B {a: 1},
27-
z: @mut B {a: 1}
28-
};
12+
let mut p = {a: 1,
13+
w: {a: 1},
14+
x: @{a: 1},
15+
y: @const {a: 1},
16+
z: @mut{a: 1}};
2917

3018
// even though `x` is not declared as a mutable field,
3119
// `p` as a whole is mutable, so it can be modified.

branches/incoming/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-b.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ fn each<T>(x: &[T], op: fn(elem: &T) -> bool) {
1212
uint::range(0, x.len(), |i| op(&x[i]));
1313
}
1414

15-
struct A {
16-
mut a: int
17-
}
18-
1915
fn main() {
20-
let x = [A {mut a: 0}];
16+
let x = [{mut a: 0}];
2117
for each(x) |y| {
2218
let z = &y.a; //~ ERROR illegal borrow unless pure
2319
x[0].a = 10; //~ NOTE impure due to assigning to mutable field

branches/incoming/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ fn each<T>(x: &[T], op: fn(elem: &T) -> bool) {
1313
}
1414

1515
fn main() {
16-
struct A {
17-
mut a: int
18-
}
19-
let x = ~[A {mut a: 0}];
16+
let x = ~[{mut a: 0}];
2017
for each(x) |y| {
2118
let z = &y.a; //~ ERROR illegal borrow unless pure
2219
x[0].a = 10; //~ NOTE impure due to assigning to mutable field

branches/incoming/src/test/compile-fail/borrowck-loan-rcvr.rs

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

11-
struct point { x: int, y: int }
11+
type point = { x: int, y: int };
1212

1313
trait methods {
1414
fn impurem();
@@ -27,7 +27,7 @@ impl methods for point {
2727
}
2828

2929
fn a() {
30-
let mut p = point {x: 3, y: 4};
30+
let mut p = {x: 3, y: 4};
3131

3232
// Here: it's ok to call even though receiver is mutable, because we
3333
// can loan it out.
@@ -41,7 +41,7 @@ fn a() {
4141
}
4242

4343
fn b() {
44-
let mut p = point {x: 3, y: 4};
44+
let mut p = {x: 3, y: 4};
4545

4646
// Here I create an outstanding loan and check that we get conflicts:
4747

@@ -56,7 +56,7 @@ fn b() {
5656

5757
fn c() {
5858
// Loaning @mut as & is considered legal due to dynamic checks:
59-
let q = @mut point {x: 3, y: 4};
59+
let q = @mut {x: 3, y: 4};
6060
q.purem();
6161
q.impurem();
6262
}

branches/incoming/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs

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

11-
struct node_ {
12-
mut a: ~cycle
13-
}
14-
1511
enum cycle {
16-
node(node_),
12+
node({mut a: ~cycle}),
1713
empty
1814
}
1915
fn main() {
20-
let x = ~node(node_ {mut a: ~empty});
16+
let x = ~node({mut a: ~empty});
2117
// Create a cycle!
2218
match *x { //~ NOTE loan of immutable local variable granted here
2319
node(ref y) => {

0 commit comments

Comments
 (0)