parent
fe6484d3e6
commit
388eed383f
|
@ -123,6 +123,9 @@ Build a test harness.
|
||||||
.TP
|
.TP
|
||||||
\fB--stack-growth\fR:
|
\fB--stack-growth\fR:
|
||||||
\fBEXPERIMENTAL\fR. Perform stack growth checks.
|
\fBEXPERIMENTAL\fR. Perform stack growth checks.
|
||||||
|
.TP
|
||||||
|
\fB--warn-unused-imports\fR:
|
||||||
|
Warn about unnecessary imports.
|
||||||
.SH "BUGS"
|
.SH "BUGS"
|
||||||
See \fBhttps://github.com/graydon/rust/issues\fR for a list of known bugs.
|
See \fBhttps://github.com/graydon/rust/issues\fR for a list of known bugs.
|
||||||
.SH "AUTHOR"
|
.SH "AUTHOR"
|
||||||
|
|
|
@ -274,6 +274,8 @@ options:
|
||||||
--test build test harness
|
--test build test harness
|
||||||
--gc garbage collect shared data (experimental/temporary)
|
--gc garbage collect shared data (experimental/temporary)
|
||||||
--stack-growth perform stack checks (experimental)
|
--stack-growth perform stack checks (experimental)
|
||||||
|
--warn-unused-imports
|
||||||
|
warn about unnecessary imports
|
||||||
|
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
@ -397,6 +399,7 @@ fn build_session_options(match: getopts::match)
|
||||||
let test = opt_present(match, "test");
|
let test = opt_present(match, "test");
|
||||||
let do_gc = opt_present(match, "gc");
|
let do_gc = opt_present(match, "gc");
|
||||||
let stack_growth = opt_present(match, "stack-growth");
|
let stack_growth = opt_present(match, "stack-growth");
|
||||||
|
let warn_unused_imports = opt_present(match, "warn-unused-imports");
|
||||||
let sopts: @session::options =
|
let sopts: @session::options =
|
||||||
@{library: library,
|
@{library: library,
|
||||||
static: static,
|
static: static,
|
||||||
|
@ -417,7 +420,8 @@ fn build_session_options(match: getopts::match)
|
||||||
no_trans: no_trans,
|
no_trans: no_trans,
|
||||||
do_gc: do_gc,
|
do_gc: do_gc,
|
||||||
stack_growth: stack_growth,
|
stack_growth: stack_growth,
|
||||||
no_asm_comments: no_asm_comments};
|
no_asm_comments: no_asm_comments,
|
||||||
|
warn_unused_imports: warn_unused_imports};
|
||||||
ret sopts;
|
ret sopts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +461,8 @@ fn opts() -> [getopts::opt] {
|
||||||
optmulti("cfg"), optflag("test"),
|
optmulti("cfg"), optflag("test"),
|
||||||
optflag("lib"), optflag("static"), optflag("gc"),
|
optflag("lib"), optflag("static"), optflag("gc"),
|
||||||
optflag("stack-growth"),
|
optflag("stack-growth"),
|
||||||
optflag("no-asm-comments")];
|
optflag("no-asm-comments"),
|
||||||
|
optflag("warn-unused-imports")];
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_output_filenames(ifile: str, ofile: option::t<str>,
|
fn build_output_filenames(ifile: str, ofile: option::t<str>,
|
||||||
|
|
|
@ -43,7 +43,8 @@ type options =
|
||||||
no_trans: bool,
|
no_trans: bool,
|
||||||
do_gc: bool,
|
do_gc: bool,
|
||||||
stack_growth: bool,
|
stack_growth: bool,
|
||||||
no_asm_comments: bool};
|
no_asm_comments: bool,
|
||||||
|
warn_unused_imports: bool};
|
||||||
|
|
||||||
type crate_metadata = {name: str, data: [u8]};
|
type crate_metadata = {name: str, data: [u8]};
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,9 @@ fn resolve_crate(sess: session, amap: ast_map::map, crate: @ast::crate) ->
|
||||||
check_for_collisions(e, *crate);
|
check_for_collisions(e, *crate);
|
||||||
check_bad_exports(e);
|
check_bad_exports(e);
|
||||||
resolve_names(e, crate);
|
resolve_names(e, crate);
|
||||||
check_unused_imports(e);
|
if sess.get_opts().warn_unused_imports {
|
||||||
|
check_unused_imports(e);
|
||||||
|
}
|
||||||
ret {def_map: e.def_map, ext_map: e.ext_map};
|
ret {def_map: e.def_map, ext_map: e.ext_map};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// error-pattern:unused import
|
// error-pattern:unused import
|
||||||
|
// compile-flags:--warn-unused-imports
|
||||||
import cal = bar::c::cc;
|
import cal = bar::c::cc;
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
|
|
Loading…
Reference in New Issue