new debug flag, new test
This commit is contained in:
parent
6b549f9f14
commit
4c26d70a0a
7 changed files with 58 additions and 9 deletions
|
@ -400,6 +400,7 @@ fn build_session_options(match: getopts::match,
|
|||
let sysroot_opt = getopts::opt_maybe_str(match, "sysroot");
|
||||
let target_opt = getopts::opt_maybe_str(match, "target");
|
||||
let mut no_asm_comments = getopts::opt_present(match, "no-asm-comments");
|
||||
let debug_rustc = getopts::opt_present(match, "debug-rustc");
|
||||
alt output_type {
|
||||
// unless we're emitting huamn-readable assembly, omit comments.
|
||||
link::output_type_llvm_assembly | link::output_type_assembly {}
|
||||
|
@ -453,7 +454,8 @@ fn build_session_options(match: getopts::match,
|
|||
test: test,
|
||||
parse_only: parse_only,
|
||||
no_trans: no_trans,
|
||||
no_asm_comments: no_asm_comments};
|
||||
no_asm_comments: no_asm_comments,
|
||||
debug_rustc: debug_rustc};
|
||||
ret sopts;
|
||||
}
|
||||
|
||||
|
@ -531,7 +533,7 @@ fn opts() -> [getopts::opt] {
|
|||
optmulti("cfg"), optflag("test"),
|
||||
optflag("lib"), optflag("bin"), optflag("static"), optflag("gc"),
|
||||
optflag("no-asm-comments"),
|
||||
optflag("enforce-mut-vars")];
|
||||
optflag("debug-rustc")];
|
||||
}
|
||||
|
||||
type output_filenames = @{out_filename: str, obj_filename:str};
|
||||
|
|
|
@ -63,6 +63,8 @@ Options:
|
|||
(default: host triple)
|
||||
(see http://sources.redhat.com/autobook/autobook/
|
||||
autobook_17.html for detail)
|
||||
--debug-rustc enables different output that helps in debugging rustc,
|
||||
but may be less clear for normal use
|
||||
|
||||
-W <foo> enable warning <foo>
|
||||
-W no-<foo> disable warning <foo>
|
||||
|
|
|
@ -45,7 +45,8 @@ type options =
|
|||
test: bool,
|
||||
parse_only: bool,
|
||||
no_trans: bool,
|
||||
no_asm_comments: bool};
|
||||
no_asm_comments: bool,
|
||||
debug_rustc: bool};
|
||||
|
||||
type crate_metadata = {name: str, data: [u8]};
|
||||
|
||||
|
|
|
@ -640,7 +640,7 @@ fn _UndefReturn(cx: block, Fn: ValueRef) -> ValueRef {
|
|||
|
||||
fn add_span_comment(bcx: block, sp: span, text: str) {
|
||||
let ccx = bcx.ccx();
|
||||
if (!ccx.sess.opts.no_asm_comments) {
|
||||
if !ccx.sess.opts.no_asm_comments {
|
||||
let s = text + " (" + codemap::span_to_str(sp, ccx.sess.codemap)
|
||||
+ ")";
|
||||
log(debug, s);
|
||||
|
|
|
@ -50,11 +50,13 @@ fn region_to_str(cx: ctxt, region: region) -> str {
|
|||
re_scope(node_id) { #fmt["&%s", re_scope_id_to_str(cx, node_id)] }
|
||||
re_bound(br) { bound_region_to_str(cx, br) }
|
||||
re_free(id, br) {
|
||||
// For debugging, this version is sometimes helpful:
|
||||
// #fmt["{%d} %s", id, bound_region_to_str(cx, br)]
|
||||
|
||||
// But this version is what the user expects to see:
|
||||
bound_region_to_str(cx, br)
|
||||
if cx.sess.opts.debug_rustc {
|
||||
// For debugging, this version is sometimes helpful:
|
||||
#fmt["{%d} %s", id, bound_region_to_str(cx, br)]
|
||||
} else {
|
||||
// But this version is what the user expects to see:
|
||||
bound_region_to_str(cx, br)
|
||||
}
|
||||
}
|
||||
|
||||
// These two should not be seen by end-users (very often, anyhow):
|
||||
|
|
|
@ -148,6 +148,7 @@ fn build_session() -> (session::session, @mut bool) {
|
|||
parse_only: false,
|
||||
no_trans: false,
|
||||
no_asm_comments: false,
|
||||
debug_rustc: false,
|
||||
};
|
||||
|
||||
let codemap = codemap::new_codemap();
|
||||
|
|
41
src/test/compile-fail/regions-scoping.rs
Normal file
41
src/test/compile-fail/regions-scoping.rs
Normal file
|
@ -0,0 +1,41 @@
|
|||
// xfail-test
|
||||
|
||||
fn with<T>(t: T, f: fn(T)) { f(t) }
|
||||
|
||||
fn nested(x: &x.int) { // (1)
|
||||
with(
|
||||
fn&(x: &x.int, // Refers to the region `x` at (1)
|
||||
y: &y.int, // A fresh region `y` (2)
|
||||
z: fn(x: &x.int, // Refers to `x` at (1)
|
||||
y: &y.int, // Refers to `y` at (2)
|
||||
z: &z.int) -> &z.int) // A fresh region `z` (3)
|
||||
-> &x.int {
|
||||
|
||||
if false { ret z(x, x, x); } //! ERROR mismatched types: expected `&y.int` but found `&x.int`
|
||||
if false { ret z(x, x, y); } //! ERROR mismatched types: expected `&y.int` but found `&x.int`
|
||||
//!^ ERROR mismatched types: expected `&x.int` but found `&y.int`
|
||||
if false { ret z(x, y, x); }
|
||||
if false { ret z(x, y, y); } //! ERROR mismatched types: expected `&x.int` but found `&y.int`
|
||||
if false { ret z(y, x, x); } //! ERROR mismatched types: expected `&x.int` but found `&y.int`
|
||||
//!^ ERROR mismatched types: expected `&y.int` but found `&x.int`
|
||||
if false { ret z(y, x, y); } //! ERROR mismatched types: expected `&x.int` but found `&y.int`
|
||||
//!^ ERROR mismatched types: expected `&y.int` but found `&x.int`
|
||||
//!^^ ERROR mismatched types: expected `&x.int` but found `&y.int`
|
||||
if false { ret z(y, y, x); } //! ERROR mismatched types: expected `&x.int` but found `&y.int`
|
||||
if false { ret z(y, y, y); } //! ERROR mismatched types: expected `&x.int` but found `&y.int`
|
||||
//!^ ERROR mismatched types: expected `&x.int` but found `&y.int`
|
||||
fail;
|
||||
}
|
||||
) {|f|
|
||||
|
||||
let a: &x.int = f(x, x) { |_x, _y, z| z };
|
||||
let b: &x.int = f(x, a) { |_x, _y, z| z };
|
||||
let c: &x.int = f(a, a) { |_x, _y, z| z };
|
||||
|
||||
let d: &x.int = f(x, x) { |_x, _y, z| z };
|
||||
let e: &x.int = f(x, &a) { |_x, _y, z| z };
|
||||
let f: &x.int = f(&a, &a) { |_x, _y, z| z };
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue