Skip to content

Commit 3dfb55a

Browse files
committed
auto merge of #8313 : msullivan/rust/cleanup, r=catamorphism
2 parents ba3d03d + 53c6de5 commit 3dfb55a

File tree

12 files changed

+80
-87
lines changed

12 files changed

+80
-87
lines changed

mk/target.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
4848
| $$(TLIB$(1)_T_$(2)_H_$(3))/
4949
@$$(call E, compile_and_link: $$@)
5050
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
51-
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
51+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
5252
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
5353

5454
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)): \
@@ -58,7 +58,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)): \
5858
| $$(TLIB$(1)_T_$(2)_H_$(3))/
5959
@$$(call E, compile_and_link: $$@)
6060
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@))
61-
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
61+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
6262
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@))
6363

6464
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
@@ -69,7 +69,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
6969
| $$(TLIB$(1)_T_$(2)_H_$(3))/
7070
@$$(call E, compile_and_link: $$@)
7171
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
72-
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@
72+
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@
7373
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
7474

7575
# Only build the compiler for host triples
@@ -90,7 +90,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
9090
| $$(TLIB$(1)_T_$(2)_H_$(3))/
9191
@$$(call E, compile_and_link: $$@)
9292
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
93-
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
93+
$$(STAGE$(1)_T_$(2)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
9494
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
9595

9696
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \

mk/tools.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)): \
4949
| $$(TLIB$(1)_T_$(4)_H_$(3))/
5050
@$$(call E, compile_and_link: $$@)
5151
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@))
52-
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
52+
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
5353
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@))
5454

5555
$$(TBIN$(1)_T_$(4)_H_$(3))/rustpkg$$(X_$(4)): \
@@ -67,7 +67,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)): \
6767
| $$(TLIB$(1)_T_$(4)_H_$(3))/
6868
@$$(call E, compile_and_link: $$@)
6969
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@))
70-
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
70+
$$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
7171
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@))
7272

7373
$$(TBIN$(1)_T_$(4)_H_$(3))/rustdoc$$(X_$(4)): \
@@ -85,7 +85,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTI_$(4)): \
8585
| $$(TLIB$(1)_T_$(4)_H_$(3))/
8686
@$$(call E, compile_and_link: $$@)
8787
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTI_GLOB_$(4)),$$(notdir $$@))
88-
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
88+
$$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
8989
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTI_GLOB_$(4)),$$(notdir $$@))
9090

9191
$$(TBIN$(1)_T_$(4)_H_$(3))/rusti$$(X_$(4)): \
@@ -106,7 +106,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)): \
106106
| $$(TLIB$(1)_T_$(4)_H_$(3))/
107107
@$$(call E, compile_and_link: $$@)
108108
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
109-
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
109+
$$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
110110
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
111111

112112
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)): \

src/compiletest/compiletest.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#[crate_type = "bin"];
1212

1313
#[allow(non_camel_case_types)];
14-
#[allow(unrecognized_lint)]; // NOTE: remove after snapshot
1514
#[deny(warnings)];
1615

1716
extern mod extra;

src/librustc/driver/driver.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -408,19 +408,21 @@ pub fn stop_after_phase_5(sess: Session) -> bool {
408408
#[fixed_stack_segment]
409409
pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input,
410410
outdir: &Option<Path>, output: &Option<Path>) {
411-
let outputs = build_output_filenames(input, outdir, output, [], sess);
412411
// We need nested scopes here, because the intermediate results can keep
413412
// large chunks of memory alive and we want to free them as soon as
414413
// possible to keep the peak memory usage low
415-
let trans = {
414+
let (outputs, trans) = {
416415
let expanded_crate = {
417416
let crate = phase_1_parse_input(sess, cfg.clone(), input);
418417
if stop_after_phase_1(sess) { return; }
419418
phase_2_configure_and_expand(sess, cfg, crate)
420419
};
421420
let analysis = phase_3_run_analysis_passes(sess, expanded_crate);
422421
if stop_after_phase_3(sess) { return; }
423-
phase_4_translate_to_llvm(sess, expanded_crate, &analysis, outputs)
422+
let outputs = build_output_filenames(input, outdir, output, [], sess);
423+
let trans = phase_4_translate_to_llvm(sess, expanded_crate,
424+
&analysis, outputs);
425+
(outputs, trans)
424426
};
425427
phase_5_run_llvm_passes(sess, &trans, outputs);
426428
if stop_after_phase_5(sess) { return; }
@@ -957,10 +959,7 @@ pub fn build_output_filenames(input: &input,
957959
};
958960

959961
if *sess.building_library {
960-
// FIXME (#2401): We might want to warn here; we're actually not
961-
// going to respect the user's choice of library name when it
962-
// comes time to link, we'll be linking to
963-
// lib<basename>-<hash>-<version>.so no matter what.
962+
sess.warn("ignoring specified output filename for library.");
964963
}
965964

966965
if *odir != None {

src/librustc/middle/cfg/construct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl CFGBuilder {
225225
// Note that `break` and `loop` statements
226226
// may cause additional edges.
227227

228-
// NOTE: Is the condition considered part of the loop?
228+
// Is the condition considered part of the loop?
229229
let loopback = self.add_dummy_node([pred]); // 1
230230
let cond_exit = self.expr(cond, loopback); // 2
231231
let expr_exit = self.add_node(expr.id, [cond_exit]); // 3

src/librustc/middle/trans/_match.rs

+40-41
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ use middle::trans::tvec;
171171
use middle::trans::type_of;
172172
use middle::ty;
173173
use util::common::indenter;
174+
use util::ppaux::{Repr, vec_map_to_str};
174175

175176
use std::hashmap::HashMap;
176177
use std::vec;
@@ -179,7 +180,6 @@ use syntax::ast::ident;
179180
use syntax::ast_util::path_to_ident;
180181
use syntax::ast_util;
181182
use syntax::codemap::{span, dummy_sp};
182-
use syntax::print::pprust::pat_to_str;
183183

184184
// An option identifying a literal: either a unit-like struct or an
185185
// expression.
@@ -353,19 +353,17 @@ pub struct Match<'self> {
353353
data: ArmData<'self>
354354
}
355355

356-
pub fn match_to_str(bcx: @mut Block, m: &Match) -> ~str {
357-
if bcx.sess().verbose() {
358-
// for many programs, this just take too long to serialize
359-
fmt!("%?", m.pats.map(|p| pat_to_str(*p, bcx.sess().intr())))
360-
} else {
361-
fmt!("%u pats", m.pats.len())
356+
impl<'self> Repr for Match<'self> {
357+
fn repr(&self, tcx: ty::ctxt) -> ~str {
358+
if tcx.sess.verbose() {
359+
// for many programs, this just take too long to serialize
360+
self.pats.repr(tcx)
361+
} else {
362+
fmt!("%u pats", self.pats.len())
363+
}
362364
}
363365
}
364366

365-
pub fn matches_to_str(bcx: @mut Block, m: &[Match]) -> ~str {
366-
fmt!("%?", m.map(|n| match_to_str(bcx, n)))
367-
}
368-
369367
pub fn has_nested_bindings(m: &[Match], col: uint) -> bool {
370368
for br in m.iter() {
371369
match br.pats[col].node {
@@ -381,9 +379,9 @@ pub fn expand_nested_bindings<'r>(bcx: @mut Block,
381379
col: uint,
382380
val: ValueRef)
383381
-> ~[Match<'r>] {
384-
debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%?)",
382+
debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%s)",
385383
bcx.to_str(),
386-
matches_to_str(bcx, m),
384+
m.repr(bcx.tcx()),
387385
col,
388386
bcx.val_to_str(val));
389387
let _indenter = indenter();
@@ -416,7 +414,7 @@ pub fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::pat) {
416414
bcx.sess().span_bug(
417415
p.span,
418416
fmt!("Expected an identifier pattern but found p: %s",
419-
pat_to_str(p, bcx.sess().intr())));
417+
p.repr(bcx.tcx())));
420418
}
421419
}
422420

@@ -429,9 +427,9 @@ pub fn enter_match<'r>(bcx: @mut Block,
429427
val: ValueRef,
430428
e: enter_pat)
431429
-> ~[Match<'r>] {
432-
debug!("enter_match(bcx=%s, m=%s, col=%u, val=%?)",
430+
debug!("enter_match(bcx=%s, m=%s, col=%u, val=%s)",
433431
bcx.to_str(),
434-
matches_to_str(bcx, m),
432+
m.repr(bcx.tcx()),
435433
col,
436434
bcx.val_to_str(val));
437435
let _indenter = indenter();
@@ -467,7 +465,7 @@ pub fn enter_match<'r>(bcx: @mut Block,
467465
}
468466
}
469467

470-
debug!("result=%s", matches_to_str(bcx, result));
468+
debug!("result=%s", result.repr(bcx.tcx()));
471469

472470
return result;
473471
}
@@ -478,9 +476,9 @@ pub fn enter_default<'r>(bcx: @mut Block,
478476
col: uint,
479477
val: ValueRef)
480478
-> ~[Match<'r>] {
481-
debug!("enter_default(bcx=%s, m=%s, col=%u, val=%?)",
479+
debug!("enter_default(bcx=%s, m=%s, col=%u, val=%s)",
482480
bcx.to_str(),
483-
matches_to_str(bcx, m),
481+
m.repr(bcx.tcx()),
484482
col,
485483
bcx.val_to_str(val));
486484
let _indenter = indenter();
@@ -525,9 +523,9 @@ pub fn enter_opt<'r>(bcx: @mut Block,
525523
variant_size: uint,
526524
val: ValueRef)
527525
-> ~[Match<'r>] {
528-
debug!("enter_opt(bcx=%s, m=%s, col=%u, val=%?)",
526+
debug!("enter_opt(bcx=%s, m=%s, col=%u, val=%s)",
529527
bcx.to_str(),
530-
matches_to_str(bcx, m),
528+
m.repr(bcx.tcx()),
531529
col,
532530
bcx.val_to_str(val));
533531
let _indenter = indenter();
@@ -637,9 +635,9 @@ pub fn enter_rec_or_struct<'r>(bcx: @mut Block,
637635
fields: &[ast::ident],
638636
val: ValueRef)
639637
-> ~[Match<'r>] {
640-
debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%?)",
638+
debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%s)",
641639
bcx.to_str(),
642-
matches_to_str(bcx, m),
640+
m.repr(bcx.tcx()),
643641
col,
644642
bcx.val_to_str(val));
645643
let _indenter = indenter();
@@ -672,9 +670,9 @@ pub fn enter_tup<'r>(bcx: @mut Block,
672670
val: ValueRef,
673671
n_elts: uint)
674672
-> ~[Match<'r>] {
675-
debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%?)",
673+
debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%s)",
676674
bcx.to_str(),
677-
matches_to_str(bcx, m),
675+
m.repr(bcx.tcx()),
678676
col,
679677
bcx.val_to_str(val));
680678
let _indenter = indenter();
@@ -698,9 +696,9 @@ pub fn enter_tuple_struct<'r>(bcx: @mut Block,
698696
val: ValueRef,
699697
n_elts: uint)
700698
-> ~[Match<'r>] {
701-
debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%?)",
699+
debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%s)",
702700
bcx.to_str(),
703-
matches_to_str(bcx, m),
701+
m.repr(bcx.tcx()),
704702
col,
705703
bcx.val_to_str(val));
706704
let _indenter = indenter();
@@ -723,9 +721,9 @@ pub fn enter_box<'r>(bcx: @mut Block,
723721
col: uint,
724722
val: ValueRef)
725723
-> ~[Match<'r>] {
726-
debug!("enter_box(bcx=%s, m=%s, col=%u, val=%?)",
724+
debug!("enter_box(bcx=%s, m=%s, col=%u, val=%s)",
727725
bcx.to_str(),
728-
matches_to_str(bcx, m),
726+
m.repr(bcx.tcx()),
729727
col,
730728
bcx.val_to_str(val));
731729
let _indenter = indenter();
@@ -750,9 +748,9 @@ pub fn enter_uniq<'r>(bcx: @mut Block,
750748
col: uint,
751749
val: ValueRef)
752750
-> ~[Match<'r>] {
753-
debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%?)",
751+
debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%s)",
754752
bcx.to_str(),
755-
matches_to_str(bcx, m),
753+
m.repr(bcx.tcx()),
756754
col,
757755
bcx.val_to_str(val));
758756
let _indenter = indenter();
@@ -777,9 +775,9 @@ pub fn enter_region<'r>(bcx: @mut Block,
777775
col: uint,
778776
val: ValueRef)
779777
-> ~[Match<'r>] {
780-
debug!("enter_region(bcx=%s, m=%s, col=%u, val=%?)",
778+
debug!("enter_region(bcx=%s, m=%s, col=%u, val=%s)",
781779
bcx.to_str(),
782-
matches_to_str(bcx, m),
780+
m.repr(bcx.tcx()),
783781
col,
784782
bcx.val_to_str(val));
785783
let _indenter = indenter();
@@ -1213,11 +1211,11 @@ pub fn compile_guard(bcx: @mut Block,
12131211
vals: &[ValueRef],
12141212
chk: Option<mk_fail>)
12151213
-> @mut Block {
1216-
debug!("compile_guard(bcx=%s, guard_expr=%s, m=%s, vals=%?)",
1214+
debug!("compile_guard(bcx=%s, guard_expr=%s, m=%s, vals=%s)",
12171215
bcx.to_str(),
12181216
bcx.expr_to_str(guard_expr),
1219-
matches_to_str(bcx, m),
1220-
vals.map(|v| bcx.val_to_str(*v)));
1217+
m.repr(bcx.tcx()),
1218+
vec_map_to_str(vals, |v| bcx.val_to_str(*v)));
12211219
let _indenter = indenter();
12221220

12231221
let mut bcx = bcx;
@@ -1267,10 +1265,10 @@ pub fn compile_submatch(bcx: @mut Block,
12671265
m: &[Match],
12681266
vals: &[ValueRef],
12691267
chk: Option<mk_fail>) {
1270-
debug!("compile_submatch(bcx=%s, m=%s, vals=%?)",
1268+
debug!("compile_submatch(bcx=%s, m=%s, vals=%s)",
12711269
bcx.to_str(),
1272-
matches_to_str(bcx, m),
1273-
vals.map(|v| bcx.val_to_str(*v)));
1270+
m.repr(bcx.tcx()),
1271+
vec_map_to_str(vals, |v| bcx.val_to_str(*v)));
12741272
let _indenter = indenter();
12751273

12761274
/*
@@ -1427,6 +1425,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,
14271425

14281426
// Decide what kind of branch we need
14291427
let opts = get_options(bcx, m, col);
1428+
debug!("options=%?", opts);
14301429
let mut kind = no_branch;
14311430
let mut test_val = val;
14321431
if opts.len() > 0u {
@@ -1914,12 +1913,12 @@ fn bind_irrefutable_pat(bcx: @mut Block,
19141913

19151914
debug!("bind_irrefutable_pat(bcx=%s, pat=%s, binding_mode=%?)",
19161915
bcx.to_str(),
1917-
pat_to_str(pat, bcx.sess().intr()),
1916+
pat.repr(bcx.tcx()),
19181917
binding_mode);
19191918

19201919
if bcx.sess().asm_comments() {
19211920
add_comment(bcx, fmt!("bind_irrefutable_pat(pat=%s)",
1922-
pat_to_str(pat, bcx.sess().intr())));
1921+
pat.repr(bcx.tcx())));
19231922
}
19241923

19251924
let _indenter = indenter();

0 commit comments

Comments
 (0)