Skip to content

Commit 7e2bc4a

Browse files
committed
---
yaml --- r: 46458 b: refs/heads/auto c: 48c1c3c h: refs/heads/master v: v3
1 parent 5ccb6ec commit 7e2bc4a

Some content is hidden

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

44 files changed

+267
-266
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 1869df30a66243f6f44e37a4f6c8b3d1f098dc94
17+
refs/heads/auto: 48c1c3cfc076bf155c1e54afa41ec560b343f52d

branches/auto/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+
}

branches/auto/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) {

branches/auto/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) {

branches/auto/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) {

branches/auto/src/librustc/middle/trans/monomorphize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ pub fn monomorphic_fn(ccx: @CrateContext,
137137

138138
let depth = option::get_or_default(ccx.monomorphizing.find(&fn_id), 0u);
139139
// Random cut-off -- code that needs to instantiate the same function
140-
// recursively more than thirty times can probably safely be assumed to be
140+
// recursively more than ten times can probably safely be assumed to be
141141
// causing an infinite expansion.
142-
if depth > 30 {
142+
if depth > 10 {
143143
ccx.sess.span_fatal(
144144
span, ~"overly deep expansion of inlined function");
145145
}

branches/auto/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,

branches/auto/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,

branches/auto/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)];

branches/auto/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");

branches/auto/src/libstd/json.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,8 @@ mod tests {
12941294
}
12951295
}
12961296

1297+
// testing both auto_encode's calling patterns
1298+
// and json... not sure where to put these tests.
12971299
#[test]
12981300
fn test_write_enum () {
12991301
let bw = @io::BytesWriter();

branches/auto/src/libsyntax/diagnostic.rs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,17 @@ use std::term;
2626
pub type Emitter = fn@(cmsp: Option<(@codemap::CodeMap, span)>,
2727
msg: &str, lvl: level);
2828

29-
// a handler deals with errors; certain errors
30-
// (fatal, bug, unimpl) may cause immediate exit,
31-
// others log errors for later reporting.
29+
30+
pub trait span_handler {
31+
fn span_fatal(@mut self, sp: span, msg: &str) -> !;
32+
fn span_err(@mut self, sp: span, msg: &str);
33+
fn span_warn(@mut self, sp: span, msg: &str);
34+
fn span_note(@mut self, sp: span, msg: &str);
35+
fn span_bug(@mut self, sp: span, msg: &str) -> !;
36+
fn span_unimpl(@mut self, sp: span, msg: &str) -> !;
37+
fn handler(@mut self) -> handler;
38+
}
39+
3240
pub trait handler {
3341
fn fatal(@mut self, msg: &str) -> !;
3442
fn err(@mut self, msg: &str);
@@ -37,7 +45,6 @@ pub trait handler {
3745
fn abort_if_errors(@mut self);
3846
fn warn(@mut self, msg: &str);
3947
fn note(@mut self, msg: &str);
40-
// used to indicate a bug in the compiler:
4148
fn bug(@mut self, msg: &str) -> !;
4249
fn unimpl(@mut self, msg: &str) -> !;
4350
fn emit(@mut self,
@@ -46,19 +53,6 @@ pub trait handler {
4653
lvl: level);
4754
}
4855

49-
// a span-handler is like a handler but also
50-
// accepts span information for source-location
51-
// reporting.
52-
pub trait span_handler {
53-
fn span_fatal(@mut self, sp: span, msg: &str) -> !;
54-
fn span_err(@mut self, sp: span, msg: &str);
55-
fn span_warn(@mut self, sp: span, msg: &str);
56-
fn span_note(@mut self, sp: span, msg: &str);
57-
fn span_bug(@mut self, sp: span, msg: &str) -> !;
58-
fn span_unimpl(@mut self, sp: span, msg: &str) -> !;
59-
fn handler(@mut self) -> handler;
60-
}
61-
6256
struct HandlerT {
6357
err_count: uint,
6458
emit: Emitter,

branches/auto/src/libsyntax/ext/deriving.rs

Lines changed: 89 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -489,20 +489,36 @@ fn expand_deriving_eq_struct_def(cx: ext_ctxt,
489489
// Create the methods.
490490
let eq_ident = cx.ident_of(~"eq");
491491
let ne_ident = cx.ident_of(~"ne");
492-
let eq_method = expand_deriving_eq_struct_method(cx,
493-
span,
494-
struct_def,
495-
eq_ident,
496-
type_ident,
497-
ty_params,
498-
Conjunction);
499-
let ne_method = expand_deriving_eq_struct_method(cx,
500-
span,
501-
struct_def,
502-
ne_ident,
503-
type_ident,
504-
ty_params,
505-
Disjunction);
492+
493+
let is_struct_tuple =
494+
struct_def.fields.len() > 0 && struct_def.fields.all(|f| {
495+
match f.node.kind {
496+
named_field(*) => false,
497+
unnamed_field => true
498+
}
499+
});
500+
501+
let derive_struct_fn = if is_struct_tuple {
502+
expand_deriving_eq_struct_tuple_method
503+
} else {
504+
expand_deriving_eq_struct_method
505+
};
506+
507+
508+
let eq_method = derive_struct_fn(cx,
509+
span,
510+
struct_def,
511+
eq_ident,
512+
type_ident,
513+
ty_params,
514+
Conjunction);
515+
let ne_method = derive_struct_fn(cx,
516+
span,
517+
struct_def,
518+
ne_ident,
519+
type_ident,
520+
ty_params,
521+
Disjunction);
506522

507523
// Create the implementation.
508524
return create_derived_eq_impl(cx,
@@ -811,6 +827,65 @@ fn expand_deriving_eq_enum_method(cx: ext_ctxt,
811827
self_match_expr);
812828
}
813829

830+
fn expand_deriving_eq_struct_tuple_method(cx: ext_ctxt,
831+
span: span,
832+
struct_def: &struct_def,
833+
method_ident: ident,
834+
type_ident: ident,
835+
ty_params: &[ty_param],
836+
junction: Junction)
837+
-> @method {
838+
let self_str = ~"self";
839+
let other_str = ~"__other";
840+
let type_path = build::mk_raw_path(span, ~[type_ident]);
841+
let fields = struct_def.fields;
842+
843+
// Create comparison expression, comparing each of the fields
844+
let mut match_body = None;
845+
for fields.eachi |i, _| {
846+
let other_field_ident = cx.ident_of(other_str + i.to_str());
847+
let other_field = build::mk_path(cx, span, ~[ other_field_ident ]);
848+
849+
let self_field_ident = cx.ident_of(self_str + i.to_str());
850+
let self_field = build::mk_path(cx, span, ~[ self_field_ident ]);
851+
852+
call_substructure_eq_method(cx, span, self_field, other_field,
853+
method_ident, junction, &mut match_body);
854+
}
855+
let match_body = finish_eq_chain_expr(cx, span, match_body, junction);
856+
857+
// Create arm for the '__other' match, containing the comparison expr
858+
let other_subpats = create_subpatterns(cx, span, other_str, fields.len());
859+
let other_arm = ast::arm {
860+
pats: ~[ build::mk_pat_enum(cx, span, type_path, other_subpats) ],
861+
guard: None,
862+
body: build::mk_simple_block(cx, span, match_body),
863+
};
864+
865+
// Create the match on '__other'
866+
let other_expr = build::mk_path(cx, span, ~[ cx.ident_of(other_str) ]);
867+
let other_expr = build::mk_unary(cx, span, deref, other_expr);
868+
let other_match_expr = expr_match(other_expr, ~[other_arm]);
869+
let other_match_expr = build::mk_expr(cx, span, other_match_expr);
870+
871+
// Create arm for the 'self' match, which contains the '__other' match
872+
let self_subpats = create_subpatterns(cx, span, self_str, fields.len());
873+
let self_arm = ast::arm {
874+
pats: ~[build::mk_pat_enum(cx, span, type_path, self_subpats)],
875+
guard: None,
876+
body: build::mk_simple_block(cx, span, other_match_expr),
877+
};
878+
879+
// Create the match on 'self'
880+
let self_expr = build::mk_path(cx, span, ~[ cx.ident_of(self_str) ]);
881+
let self_expr = build::mk_unary(cx, span, deref, self_expr);
882+
let self_match_expr = expr_match(self_expr, ~[self_arm]);
883+
let self_match_expr = build::mk_expr(cx, span, self_match_expr);
884+
885+
create_eq_method(cx, span, method_ident,
886+
type_ident, ty_params, self_match_expr)
887+
}
888+
814889
fn expand_deriving_iter_bytes_enum_method(cx: ext_ctxt,
815890
span: span,
816891
enum_definition: &enum_def)

branches/auto/src/libsyntax/parse/attr.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use parse::token;
1818

1919
use core::either::{Either, Left, Right};
2020

21-
// a parser that can parse attributes.
2221
pub trait parser_attr {
2322
fn parse_outer_attributes() -> ~[ast::attribute];
2423
fn parse_attribute(style: ast::attr_style) -> ast::attribute;
@@ -82,9 +81,6 @@ impl parser_attr for Parser {
8281
// attribute of the next item (since we can't know whether the attribute
8382
// is an inner attribute of the containing item or an outer attribute of
8483
// the first contained item until we see the semi).
85-
86-
// you can make the 'next' field an Option, but the result is going to be
87-
// more useful as a vector.
8884
fn parse_inner_attrs_and_next() ->
8985
(~[ast::attribute], ~[ast::attribute]) {
9086
let mut inner_attrs: ~[ast::attribute] = ~[];

0 commit comments

Comments
 (0)