Skip to content

Commit b720b82

Browse files
committed
---
yaml --- r: 3181 b: refs/heads/master c: b84fffa h: refs/heads/master i: 3179: 679a5d1 v: v3
1 parent 33ca284 commit b720b82

27 files changed

+474
-473
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: eb9969f54699924e4373f6c447aaeb4dd041b0dd
2+
refs/heads/master: b84fffaa4e0e672b4653a7832d75a2dc120040aa

trunk/src/comp/back/abi.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ const int obj_body_elt_fields = 2;
9090

9191
const int obj_body_elt_with_obj = 3;
9292

93-
/* The base object to which an anonymous
94-
* object is attached */
95-
const int fn_field_code = 0;
93+
94+
/* The base object to which an anonymous
95+
* object is attached */
96+
const int fn_field_code = 0;
9697

9798
const int fn_field_box = 1;
9899

trunk/src/comp/back/link.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ mod write {
175175
} else {
176176
// If we aren't saving temps then just output the file
177177
// type corresponding to the '-c' or '-S' flag used
178+
178179
auto triple = x86::get_target_triple();
179180
llvm::LLVMRustWriteOutputFile(pm.llpm, llmod,
180181
str::buf(triple),

trunk/src/comp/back/x86.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ fn get_meta_sect_name() -> str {
1616

1717
fn get_data_layout() -> str {
1818
if (str::eq(target_os(), "macos")) {
19-
ret "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16"
20-
+ "-i32:32:32-i64:32:64"
21-
+ "-f32:32:32-f64:32:64-v64:64:64"
22-
+ "-v128:128:128-a0:0:64-f80:128:128"
23-
+ "-n8:16:32";
19+
ret "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" + "-i32:32:32-i64:32:64" +
20+
"-f32:32:32-f64:32:64-v64:64:64" +
21+
"-v128:128:128-a0:0:64-f80:128:128" + "-n8:16:32";
2422
}
2523
if (str::eq(target_os(), "win32")) {
2624
ret "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32";

trunk/src/comp/driver/rustc.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn build_session_options(str binary, getopts::match match) ->
239239
case ("3") { 3u }
240240
case (_) {
241241
log_err "error: optimization level needs " +
242-
"to be between 0-3";
242+
"to be between 0-3";
243243
fail
244244
}
245245
}
@@ -399,13 +399,11 @@ fn main(vec[str] args) {
399399
let str prog = "gcc";
400400
// The invocations of gcc share some flags across platforms
401401

402-
let vec[str] common_args = [stage, "-Lrt", "-lrustrt",
403-
"-fno-strict-aliasing", "-fPIC", "-Wall",
404-
"-fno-rtti", "-fno-exceptions", "-g", glu, "-o",
405-
saved_out_filename, saved_out_filename + ".o"];
406-
407-
auto shared_cmd;
408-
402+
let vec[str] common_args =
403+
[stage, "-Lrt", "-lrustrt", "-fno-strict-aliasing", "-fPIC",
404+
"-Wall", "-fno-rtti", "-fno-exceptions", "-g", glu, "-o",
405+
saved_out_filename, saved_out_filename + ".o"];
406+
auto shared_cmd;
409407
alt (sess.get_targ_cfg().os) {
410408
case (session::os_win32) {
411409
shared_cmd = "-shared";
@@ -421,12 +419,12 @@ fn main(vec[str] args) {
421419
}
422420
}
423421
if (sopts.shared) {
424-
gcc_args += [shared_cmd];
422+
gcc_args += [shared_cmd];
425423
} else {
426-
gcc_args += ["-Lrustllvm", "-lrustllvm", "-lstd", "-lm", main];
424+
gcc_args += ["-Lrustllvm", "-lrustllvm", "-lstd", "-lm", main];
427425
}
428-
429426
// We run 'gcc' here
427+
430428
run::run_program(prog, gcc_args);
431429
// Clean up on Darwin
432430

trunk/src/comp/front/ast.rs

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,16 @@ tag expr_ {
245245
expr_alt(@expr, vec[arm], ann);
246246
expr_fn(_fn, ann);
247247
expr_block(block, ann);
248-
expr_move(@expr /* TODO: @expr|is_lval */, @expr, ann);
249-
expr_assign(@expr /* TODO: @expr|is_lval */, @expr, ann);
250-
expr_swap(@expr /* TODO: @expr|is_lval */,
251-
@expr /* TODO: @expr|is_lval */, ann);
252-
expr_assign_op(binop, @expr /* TODO: @expr|is_lval */, @expr, ann);
253-
expr_send(@expr /* TODO: @expr|is_lval */, @expr, ann);
254-
expr_recv(@expr /* TODO: @expr|is_lval */, @expr, ann);
248+
/*
249+
* FIXME: many of these @exprs should be constrained with
250+
* is_lval once we have constrained types working.
251+
*/
252+
expr_move(@expr, @expr, ann);
253+
expr_assign(@expr,@expr, ann);
254+
expr_swap(@expr, @expr, ann);
255+
expr_assign_op(binop, @expr, @expr, ann);
256+
expr_send(@expr, @expr, ann);
257+
expr_recv(@expr, @expr, ann);
255258
expr_field(@expr, ident, ann);
256259
expr_index(@expr, @expr, ann);
257260
expr_path(path, ann);
@@ -366,16 +369,14 @@ type constr_arg = constr_arg_general[uint];
366369
367370
type constr_arg_general[T] = spanned[constr_arg_general_[T]];
368371
369-
type constr_ = rec(path path,
370-
vec[@constr_arg_general[uint]] args,
371-
ann ann);
372+
type constr_ = rec(path path, vec[@constr_arg_general[uint]] args, ann ann);
372373
373374
type constr = spanned[constr_];
374375
376+
375377
/* The parser generates ast::constrs; resolve generates
376378
a mapping from each function to a list of ty::constr_defs,
377379
corresponding to these. */
378-
379380
type arg = rec(mode mode, @ty ty, ident ident, def_id id);
380381
381382
type fn_decl =
@@ -464,12 +465,14 @@ tag attr_style { attr_outer; attr_inner; }
464465

465466
type attribute_ = rec(attr_style style, meta_item value);
466467

467-
type item = rec(ident ident,
468-
vec[attribute] attrs,
469-
def_id id, // For objs, this is the type def_id
470-
ann ann,
471-
item_ node,
472-
span span);
468+
type item =
469+
rec(ident ident,
470+
vec[attribute] attrs,
471+
def_id id, // For objs, this is the type def_id
472+
473+
ann ann,
474+
item_ node,
475+
span span);
473476

474477
tag item_ {
475478
item_const(@ty, @expr);
@@ -478,7 +481,9 @@ tag item_ {
478481
item_native_mod(native_mod);
479482
item_ty(@ty, vec[ty_param]);
480483
item_tag(vec[variant], vec[ty_param]);
481-
item_obj(_obj, vec[ty_param], def_id /* constructor id */);
484+
item_obj(_obj, vec[ty_param], def_id);
485+
/* constructor id */
486+
482487
}
483488

484489
type native_item = spanned[native_item_];
@@ -521,9 +526,9 @@ fn is_exported(ident i, _mod m) -> bool {
521526
case (_) {/* fall through */ }
522527
}
523528
}
524-
525529
// If there are no declared exports then
526530
// everything not imported is exported
531+
527532
ret count == 0u && !nonlocal;
528533
}
529534

trunk/src/comp/front/creader.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,7 @@ fn tag_variant_ids(&ebml::doc item, int this_cnum) -> vec[ast::def_id] {
478478

479479
fn get_metadata_section(str filename) -> option::t[vec[u8]] {
480480
auto b = str::buf(filename);
481-
auto mb =
482-
llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(b);
481+
auto mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(b);
483482
if (mb as int == 0) { ret option::none[vec[u8]]; }
484483
auto of = mk_object_file(mb);
485484
auto si = mk_section_iter(of.llof);

trunk/src/comp/front/eval.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,19 @@ fn eval_crate_directive(ctx cx, env e, @ast::crate_directive cdir, str prefix,
294294
cx.p.set_def(next_id._1);
295295
cx.chpos = p0.get_chpos();
296296
cx.next_ann = p0.next_ann_num();
297-
auto i = front::parser::mk_item(cx.p, cdir.span.lo, cdir.span.hi,
298-
id, ast::item_mod(m0), []);
297+
auto i =
298+
front::parser::mk_item(cx.p, cdir.span.lo, cdir.span.hi, id,
299+
ast::item_mod(m0), []);
299300
vec::push[@ast::item](items, i);
300301
}
301302
case (ast::cdir_dir_mod(?id, ?dir_opt, ?cdirs)) {
302303
auto path = id;
303304
alt (dir_opt) { case (some(?d)) { path = d; } case (none) { } }
304305
auto full_path = prefix + std::fs::path_sep() + path;
305306
auto m0 = eval_crate_directives_to_mod(cx, e, cdirs, full_path);
306-
auto i = front::parser::mk_item
307-
(cx.p, cdir.span.lo, cdir.span.hi, id, ast::item_mod(m0), []);
307+
auto i =
308+
front::parser::mk_item(cx.p, cdir.span.lo, cdir.span.hi, id,
309+
ast::item_mod(m0), []);
308310
vec::push[@ast::item](items, i);
309311
}
310312
case (ast::cdir_view_item(?vi)) {

trunk/src/comp/front/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ fn scan_number(char c, &reader rdr) -> token::token {
281281
rdr.bump();
282282
ret token::LIT_MACH_FLOAT(util::common::ty_f64,
283283
intern(*rdr.get_interner(),
284-
float_str));
284+
float_str));
285285
/* FIXME: if this is out of range for either a 32-bit or
286286
64-bit float, it won't be noticed till the back-end */
287287

trunk/src/comp/middle/alias.rs

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ type scope = vec[restrict];
3434
tag local_info { arg(ast::mode); objfield(ast::mutability); }
3535

3636
type ctx =
37-
rec(@ty::ctxt tcx,
38-
std::map::hashmap[def_num, local_info] local_map);
37+
rec(@ty::ctxt tcx, std::map::hashmap[def_num, local_info] local_map);
3938

4039
fn check_crate(@ty::ctxt tcx, &@ast::crate crate) {
4140
auto cx =
4241
@rec(tcx=tcx,
42+
4343
// Stores information about object fields and function
4444
// arguments that's otherwise not easily available.
4545
local_map=util::common::new_int_hash());
@@ -93,8 +93,8 @@ fn visit_expr(@ctx cx, &@ast::expr ex, &scope sc, &vt[scope] v) {
9393
auto root = expr_root(*cx, ex, false);
9494
if (mut_field(root.ds)) {
9595
cx.tcx.sess.span_err(ex.span,
96-
"result of put must be"
97-
+ " immutably rooted");
96+
"result of put must be" +
97+
" immutably rooted");
9898
}
9999
visit_expr(cx, ex, sc, v);
100100
}
@@ -129,7 +129,6 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
129129
rec(vec[def_num] root_vars, vec[ty::t] unsafe_ts) {
130130
auto fty = ty::expr_ty(*cx.tcx, f);
131131
auto arg_ts = fty_args(cx, fty);
132-
133132
let vec[def_num] roots = [];
134133
let vec[tup(uint, def_num)] mut_roots = [];
135134
let vec[ty::t] unsafe_ts = [];
@@ -146,7 +145,8 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
146145
}
147146
case (_) {
148147
if (!mut_field(root.ds)) {
149-
auto m = "passing a temporary value or \
148+
auto m =
149+
"passing a temporary value or \
150150
immutable field by mutable alias";
151151
cx.tcx.sess.span_err(arg.span, m);
152152
}
@@ -171,10 +171,10 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
171171
alt (f.node) {
172172
case (ast::expr_path(_, ?ann)) {
173173
if (def_is_local(cx.tcx.def_map.get(ann.id), true)) {
174-
cx.tcx.sess.span_err
175-
(f.span, #fmt("function may alias with argument \
176-
%u, which is not immutably rooted",
177-
unsafe_t_offsets.(0)));
174+
cx.tcx.sess.span_err(f.span,
175+
#fmt("function may alias with \
176+
argument %u, which is not immutably rooted",
177+
unsafe_t_offsets.(0)));
178178
}
179179
}
180180
case (_) { }
@@ -218,9 +218,10 @@ fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
218218

219219
fn check_tail_call(&ctx cx, &@ast::expr call) {
220220
auto args;
221-
auto f = alt (call.node) {
222-
case (ast::expr_call(?f, ?args_, _)) { args = args_; f }
223-
};
221+
auto f =
222+
alt (call.node) {
223+
case (ast::expr_call(?f, ?args_, _)) { args = args_; f }
224+
};
224225
auto i = 0u;
225226
for (ty::arg arg_t in fty_args(cx, ty::expr_ty(*cx.tcx, f))) {
226227
if (arg_t.mode != ty::mo_val) {
@@ -233,30 +234,28 @@ fn check_tail_call(&ctx cx, &@ast::expr call) {
233234
alt (cx.local_map.find(dnum)) {
234235
case (some(arg(ast::alias(?mut)))) {
235236
if (mut_a && !mut) {
236-
cx.tcx.sess.span_warn
237-
(args.(i).span, "passing an immutable \
237+
cx.tcx.sess.span_warn(args.(i).span,
238+
"passing an immutable \
238239
alias by mutable alias");
239240
}
240241
}
241-
case (_) {
242-
ok = !def_is_local(def, false);
243-
}
242+
case (_) { ok = !def_is_local(def, false); }
244243
}
245244
}
246245
case (_) { ok = false; }
247246
}
248247
if (!ok) {
249-
cx.tcx.sess.span_warn
250-
(args.(i).span, "can not pass a local value by alias to \
251-
a tail call");
248+
cx.tcx.sess.span_warn(args.(i).span,
249+
"can not pass a local value by \
250+
alias to a tail call");
252251
}
253252
}
254253
i += 1u;
255254
}
256255
}
257256

258-
fn check_alt(&ctx cx, &@ast::expr input, &vec[ast::arm] arms,
259-
&scope sc, &vt[scope] v) {
257+
fn check_alt(&ctx cx, &@ast::expr input, &vec[ast::arm] arms, &scope sc,
258+
&vt[scope] v) {
260259
visit::visit_expr(input, sc, v);
261260
auto root = expr_root(cx, input, true);
262261
auto roots =
@@ -630,21 +629,20 @@ fn ty_can_unsafely_include(&ctx cx, ty::t needle, ty::t haystack, bool mut) ->
630629

631630
fn def_is_local(&ast::def d, bool objfields_count) -> bool {
632631
ret alt (d) {
633-
case (ast::def_local(_)) { true }
634-
case (ast::def_arg(_)) { true }
635-
case (ast::def_obj_field(_)) { objfields_count }
636-
case (ast::def_binding(_)) { true }
637-
case (_) { false }
638-
};
632+
case (ast::def_local(_)) { true }
633+
case (ast::def_arg(_)) { true }
634+
case (ast::def_obj_field(_)) { objfields_count }
635+
case (ast::def_binding(_)) { true }
636+
case (_) { false }
637+
};
639638
}
640639

641640
fn fty_args(&ctx cx, ty::t fty) -> vec[ty::arg] {
642641
ret alt (ty::struct(*cx.tcx, fty)) {
643-
case (ty::ty_fn(_, ?args, _, _, _)) { args }
644-
case (ty::ty_native_fn(_, ?args, _)) { args }
645-
};
642+
case (ty::ty_fn(_, ?args, _, _, _)) { args }
643+
case (ty::ty_native_fn(_, ?args, _)) { args }
644+
};
646645
}
647-
648646
// Local Variables:
649647
// mode: rust
650648
// fill-column: 78;

trunk/src/comp/middle/metadata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ fn encode_info_for_item(@trans::crate_ctxt cx, &ebml::writer ebml_w,
557557
encode_variant_id(ebml_w, v.node.id);
558558
}
559559
ebml::end_tag(ebml_w);
560-
encode_tag_variant_info(cx, ebml_w, item.id, variants,
561-
index, tps);
560+
encode_tag_variant_info(cx, ebml_w, item.id, variants, index,
561+
tps);
562562
}
563563
case (ast::item_obj(_, ?tps, ?ctor_id)) {
564564
ebml::start_tag(ebml_w, tag_items_data_item);

0 commit comments

Comments
 (0)