Skip to content

Commit f5cc0b9

Browse files
committed
auto merge of #5075 : luqmana/rust/derec, r=catamorphism
Now only `lib core/pipes.rs` has `#[allow(structural_records)]`. That can be removed after a snapshot.
2 parents ab784b7 + 48c1c3c commit f5cc0b9

37 files changed

+131
-196
lines changed

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 type config = {
24+
pub struct config {
2525
// The library paths required for running the compiler
2626
compile_lib_path: ~str,
2727

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

71-
};
71+
}

src/compiletest/compiletest.rc

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

1313
#[no_core];
14-
#[legacy_records];
1514

1615
#[allow(vecs_implicitly_copyable)];
1716
#[allow(non_camel_case_types)];
@@ -77,26 +76,28 @@ pub fn parse_config(args: ~[~str]) -> config {
7776
Path(getopts::opt_str(m, nm))
7877
}
7978

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:
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:
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")};
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+
}
100101
}
101102

102103
pub fn log_config(config: config) {

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 {eq_fn: eq_int, data: ~[]};
1281+
return alist {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 {eq_fn: eq_int, data: ~[]};
1287+
return alist {eq_fn: eq_int, data: ~[]};
12881288
}
12891289
).get());
12901290
match (item_out, item_exp) {

src/librustc/middle/lint.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -706,23 +706,21 @@ 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-
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-
}
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);
726724
}
727725

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

src/librustc/middle/ty.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ struct ctxt_ {
233233
mut next_id: uint,
234234
vecs_implicitly_copyable: bool,
235235
legacy_modes: bool,
236-
legacy_records: bool,
237236
cstore: @mut metadata::cstore::CStore,
238237
sess: session::Session,
239238
def_map: resolve::DefMap,
@@ -789,16 +788,10 @@ pub fn mk_ctxt(s: session::Session,
789788
crate: @ast::crate)
790789
-> ctxt {
791790
let mut legacy_modes = false;
792-
let mut legacy_records = false;
793791
for crate.node.attrs.each |attribute| {
794792
match attribute.node.value.node {
795793
ast::meta_word(w) if *w == ~"legacy_modes" => {
796794
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; }
802795
}
803796
_ => {}
804797
}
@@ -814,7 +807,6 @@ pub fn mk_ctxt(s: session::Session,
814807
mut next_id: 0u,
815808
vecs_implicitly_copyable: vecs_implicitly_copyable,
816809
legacy_modes: legacy_modes,
817-
legacy_records: legacy_records,
818810
cstore: s.cstore,
819811
sess: s,
820812
def_map: dm,

src/librusti/rusti.rc

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

1818
#[crate_type = "lib"];
1919

20-
#[legacy_records];
2120
#[no_core];
2221

2322
#[allow(vecs_implicitly_copyable,

src/librusti/wrapper.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#[allow(non_implicitly_copyable_typarams)];
1717
#[allow(owned_heap_memory)];
1818
#[allow(path_statement)];
19-
#[allow(structural_records)];
2019
#[allow(unrecognized_lint)];
2120
#[allow(unused_imports)];
2221
#[allow(vecs_implicitly_copyable)];

src/librustpkg/rustpkg.rc

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

23-
#[legacy_records];
24-
2523
extern mod core(vers = "0.6");
2624
extern mod std(vers = "0.6");
2725
extern mod rustc(vers = "0.6");

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

src/test/bench/pingpong.rs

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

1111
// Compare bounded and unbounded protocol performance.
1212

13-
#[allow(structural_records)]; // Pipes
14-
// Until a snapshot
1513
// xfail-pretty
1614

1715
extern mod std;

0 commit comments

Comments
 (0)