From d699db699a07d5bb80d5d08508540b0aba6e1026 Mon Sep 17 00:00:00 2001 From: Haitao Li Date: Thu, 19 Jan 2012 20:29:50 +0800 Subject: rustc: Refactor lint check and avoid a segv fault The segv fault issue is #1566 --- src/comp/driver/driver.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/comp/driver') diff --git a/src/comp/driver/driver.rs b/src/comp/driver/driver.rs index 6c2a646f35d..ea961f917e5 100644 --- a/src/comp/driver/driver.rs +++ b/src/comp/driver/driver.rs @@ -203,9 +203,14 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg, bind last_use::find_last_uses(crate, def_map, ref_map, ty_cx)); time(time_passes, "kind checking", bind kind::check_crate(ty_cx, method_map, last_uses, crate)); - if vec::len(sess.opts.lint_opts) > 0u { - let timer = bind time(time_passes, _, _); - lint::check_crate(ty_cx, crate, sess.opts.lint_opts, timer) + + vec::iter(sess.opts.lint_opts) {|lopt| + alt lopt { + ctypes { + time(time_passes, "ctypes usage checking", + bind lint::check_ctypes(ty_cx, crate)) + } + } } if upto == cu_no_trans { ret {crate: crate, tcx: some(ty_cx), src: src}; } @@ -384,7 +389,7 @@ fn build_session_options(match: getopts::match, let parse_only = opt_present(match, "parse-only"); let no_trans = opt_present(match, "no-trans"); - let lint_opts : [lint::option] = []; + let lint_opts = []; if !opt_present(match, "no-lint-ctypes") { lint_opts += [lint::ctypes]; } -- cgit 1.4.1-3-g733a5