Skip to content

A handful of cleanup work and some minor bug fixes #8313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mk/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
| $$(TLIB$(1)_T_$(2)_H_$(3))/
@$$(call E, compile_and_link: $$@)
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))

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

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

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

$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
Expand Down
8 changes: 4 additions & 4 deletions mk/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)): \
| $$(TLIB$(1)_T_$(4)_H_$(3))/
@$$(call E, compile_and_link: $$@)
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@))
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@))

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

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

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

$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)): \
Expand Down
1 change: 0 additions & 1 deletion src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#[crate_type = "bin"];

#[allow(non_camel_case_types)];
#[allow(unrecognized_lint)]; // NOTE: remove after snapshot
#[deny(warnings)];

extern mod extra;
Expand Down
13 changes: 6 additions & 7 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,19 +408,21 @@ pub fn stop_after_phase_5(sess: Session) -> bool {
#[fixed_stack_segment]
pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input,
outdir: &Option<Path>, output: &Option<Path>) {
let outputs = build_output_filenames(input, outdir, output, [], sess);
// We need nested scopes here, because the intermediate results can keep
// large chunks of memory alive and we want to free them as soon as
// possible to keep the peak memory usage low
let trans = {
let (outputs, trans) = {
let expanded_crate = {
let crate = phase_1_parse_input(sess, cfg.clone(), input);
if stop_after_phase_1(sess) { return; }
phase_2_configure_and_expand(sess, cfg, crate)
};
let analysis = phase_3_run_analysis_passes(sess, expanded_crate);
if stop_after_phase_3(sess) { return; }
phase_4_translate_to_llvm(sess, expanded_crate, &analysis, outputs)
let outputs = build_output_filenames(input, outdir, output, [], sess);
let trans = phase_4_translate_to_llvm(sess, expanded_crate,
&analysis, outputs);
(outputs, trans)
};
phase_5_run_llvm_passes(sess, &trans, outputs);
if stop_after_phase_5(sess) { return; }
Expand Down Expand Up @@ -957,10 +959,7 @@ pub fn build_output_filenames(input: &input,
};

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

if *odir != None {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/cfg/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl CFGBuilder {
// Note that `break` and `loop` statements
// may cause additional edges.

// NOTE: Is the condition considered part of the loop?
// Is the condition considered part of the loop?
let loopback = self.add_dummy_node([pred]); // 1
let cond_exit = self.expr(cond, loopback); // 2
let expr_exit = self.add_node(expr.id, [cond_exit]); // 3
Expand Down
81 changes: 40 additions & 41 deletions src/librustc/middle/trans/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ use middle::trans::tvec;
use middle::trans::type_of;
use middle::ty;
use util::common::indenter;
use util::ppaux::{Repr, vec_map_to_str};

use std::hashmap::HashMap;
use std::vec;
Expand All @@ -179,7 +180,6 @@ use syntax::ast::ident;
use syntax::ast_util::path_to_ident;
use syntax::ast_util;
use syntax::codemap::{span, dummy_sp};
use syntax::print::pprust::pat_to_str;

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

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

pub fn matches_to_str(bcx: @mut Block, m: &[Match]) -> ~str {
fmt!("%?", m.map(|n| match_to_str(bcx, n)))
}

pub fn has_nested_bindings(m: &[Match], col: uint) -> bool {
for br in m.iter() {
match br.pats[col].node {
Expand All @@ -381,9 +379,9 @@ pub fn expand_nested_bindings<'r>(bcx: @mut Block,
col: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%?)",
debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand Down Expand Up @@ -416,7 +414,7 @@ pub fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::pat) {
bcx.sess().span_bug(
p.span,
fmt!("Expected an identifier pattern but found p: %s",
pat_to_str(p, bcx.sess().intr())));
p.repr(bcx.tcx())));
}
}

Expand All @@ -429,9 +427,9 @@ pub fn enter_match<'r>(bcx: @mut Block,
val: ValueRef,
e: enter_pat)
-> ~[Match<'r>] {
debug!("enter_match(bcx=%s, m=%s, col=%u, val=%?)",
debug!("enter_match(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand Down Expand Up @@ -467,7 +465,7 @@ pub fn enter_match<'r>(bcx: @mut Block,
}
}

debug!("result=%s", matches_to_str(bcx, result));
debug!("result=%s", result.repr(bcx.tcx()));

return result;
}
Expand All @@ -478,9 +476,9 @@ pub fn enter_default<'r>(bcx: @mut Block,
col: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug!("enter_default(bcx=%s, m=%s, col=%u, val=%?)",
debug!("enter_default(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand Down Expand Up @@ -525,9 +523,9 @@ pub fn enter_opt<'r>(bcx: @mut Block,
variant_size: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug!("enter_opt(bcx=%s, m=%s, col=%u, val=%?)",
debug!("enter_opt(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand Down Expand Up @@ -637,9 +635,9 @@ pub fn enter_rec_or_struct<'r>(bcx: @mut Block,
fields: &[ast::ident],
val: ValueRef)
-> ~[Match<'r>] {
debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%?)",
debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand Down Expand Up @@ -672,9 +670,9 @@ pub fn enter_tup<'r>(bcx: @mut Block,
val: ValueRef,
n_elts: uint)
-> ~[Match<'r>] {
debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%?)",
debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand All @@ -698,9 +696,9 @@ pub fn enter_tuple_struct<'r>(bcx: @mut Block,
val: ValueRef,
n_elts: uint)
-> ~[Match<'r>] {
debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%?)",
debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand All @@ -723,9 +721,9 @@ pub fn enter_box<'r>(bcx: @mut Block,
col: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug!("enter_box(bcx=%s, m=%s, col=%u, val=%?)",
debug!("enter_box(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand All @@ -750,9 +748,9 @@ pub fn enter_uniq<'r>(bcx: @mut Block,
col: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%?)",
debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand All @@ -777,9 +775,9 @@ pub fn enter_region<'r>(bcx: @mut Block,
col: uint,
val: ValueRef)
-> ~[Match<'r>] {
debug!("enter_region(bcx=%s, m=%s, col=%u, val=%?)",
debug!("enter_region(bcx=%s, m=%s, col=%u, val=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
m.repr(bcx.tcx()),
col,
bcx.val_to_str(val));
let _indenter = indenter();
Expand Down Expand Up @@ -1213,11 +1211,11 @@ pub fn compile_guard(bcx: @mut Block,
vals: &[ValueRef],
chk: Option<mk_fail>)
-> @mut Block {
debug!("compile_guard(bcx=%s, guard_expr=%s, m=%s, vals=%?)",
debug!("compile_guard(bcx=%s, guard_expr=%s, m=%s, vals=%s)",
bcx.to_str(),
bcx.expr_to_str(guard_expr),
matches_to_str(bcx, m),
vals.map(|v| bcx.val_to_str(*v)));
m.repr(bcx.tcx()),
vec_map_to_str(vals, |v| bcx.val_to_str(*v)));
let _indenter = indenter();

let mut bcx = bcx;
Expand Down Expand Up @@ -1267,10 +1265,10 @@ pub fn compile_submatch(bcx: @mut Block,
m: &[Match],
vals: &[ValueRef],
chk: Option<mk_fail>) {
debug!("compile_submatch(bcx=%s, m=%s, vals=%?)",
debug!("compile_submatch(bcx=%s, m=%s, vals=%s)",
bcx.to_str(),
matches_to_str(bcx, m),
vals.map(|v| bcx.val_to_str(*v)));
m.repr(bcx.tcx()),
vec_map_to_str(vals, |v| bcx.val_to_str(*v)));
let _indenter = indenter();

/*
Expand Down Expand Up @@ -1427,6 +1425,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,

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

debug!("bind_irrefutable_pat(bcx=%s, pat=%s, binding_mode=%?)",
bcx.to_str(),
pat_to_str(pat, bcx.sess().intr()),
pat.repr(bcx.tcx()),
binding_mode);

if bcx.sess().asm_comments() {
add_comment(bcx, fmt!("bind_irrefutable_pat(pat=%s)",
pat_to_str(pat, bcx.sess().intr())));
pat.repr(bcx.tcx())));
}

let _indenter = indenter();
Expand Down
Loading