Skip to content

Commit

Permalink
Merge pull request #3 from sanxiyn/2014-07-15
Browse files Browse the repository at this point in the history
Update to 5cef16e 2014-07-15 05:56:19 +0000
  • Loading branch information
huonw committed Jul 16, 2014
2 parents f9a1b54 + 1dd37d2 commit e88cecb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ See `unsafe_ls -h` for all flags.

cargo build

Known to work with Rust master at e6c54a1.
Known to work with Rust master at 5cef16e.

## Testimonials

Expand Down
12 changes: 8 additions & 4 deletions src/unsafe_ls.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![crate_id="unsafe_ls"]
#![crate_name = "unsafe_ls"]
#![feature(managed_boxes, macro_rules)]

extern crate getopts;
Expand Down Expand Up @@ -144,6 +144,7 @@ impl Session {
/// connects source code locations to the actual code.
fn get_ast(path: Path, libs: HashSet<Path>) -> (ast::Crate, ty::ctxt) {
use syntax::diagnostic;
use rustc::back::link;

// cargo culted from rustdoc_ng :(
let input = driver::FileInput(path);
Expand All @@ -155,7 +156,8 @@ fn get_ast(path: Path, libs: HashSet<Path>) -> (ast::Crate, ty::ctxt) {
};

let codemap = syntax::codemap::CodeMap::new();
let diagnostic_handler = diagnostic::default_handler(diagnostic::Auto);
let diagnostic_handler =
diagnostic::default_handler(diagnostic::Auto, None);
let span_diagnostic_handler =
diagnostic::mk_span_handler(diagnostic_handler, codemap);

Expand All @@ -164,10 +166,12 @@ fn get_ast(path: Path, libs: HashSet<Path>) -> (ast::Crate, ty::ctxt) {
let cfg = config::build_configuration(&sess);

let krate = driver::phase_1_parse_input(&sess, cfg, &input);
let id = link::find_crate_name(Some(&sess), krate.attrs.as_slice(),
&input);
let (krate, ast_map) = driver::phase_2_configure_and_expand(
&sess, krate, &from_str("unsafe_ls").unwrap()).unwrap();
&sess, krate, id.as_slice()).unwrap();

let res = driver::phase_3_run_analysis_passes(sess, &krate, ast_map);
let res = driver::phase_3_run_analysis_passes(sess, &krate, ast_map, id);
let driver::CrateAnalysis { ty_cx, .. } = res;
(krate, ty_cx)
}
2 changes: 1 addition & 1 deletion src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl<'tcx> Visitor<()> for UnsafeVisitor<'tcx> {
visit::FkItemFn(_, _, fn_style, _) =>
(true, fn_style == ast::UnsafeFn),
visit::FkMethod(_, _, method) =>
(true, method.fn_style == ast::UnsafeFn),
(true, ast_util::method_fn_style(method) == ast::UnsafeFn),
_ => (false, false),
};

Expand Down

0 comments on commit e88cecb

Please sign in to comment.