Skip to content

Commit 27b9182

Browse files
committed
review changes
1 parent bbc00c9 commit 27b9182

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

src/Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/librustc_save_analysis/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ crate-type = ["dylib"]
1111
[dependencies]
1212
log = "0.3"
1313
rustc = { path = "../librustc" }
14+
rustc_data_structures = { path = "../librustc_data_structures" }
1415
rustc_typeck = { path = "../librustc_typeck" }
1516
syntax = { path = "../libsyntax" }
1617
syntax_pos = { path = "../libsyntax_pos" }

src/librustc_save_analysis/dump_visitor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ use rustc::hir::def_id::DefId;
2929
use rustc::hir::map::Node;
3030
use rustc::session::Session;
3131
use rustc::ty::{self, TyCtxt};
32+
use rustc_data_structures::fx::FxHashSet;
3233

33-
use std::collections::HashSet;
3434
use std::path::Path;
3535

3636
use syntax::ast::{self, NodeId, PatKind, Attribute, CRATE_NODE_ID};
@@ -75,7 +75,7 @@ pub struct DumpVisitor<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> {
7575
// we only write one macro def per unique macro definition, and
7676
// one macro use per unique callsite span.
7777
// mac_defs: HashSet<Span>,
78-
macro_calls: HashSet<Span>,
78+
macro_calls: FxHashSet<Span>,
7979
}
8080

8181
impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
@@ -91,7 +91,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
9191
span: span_utils.clone(),
9292
cur_scope: CRATE_NODE_ID,
9393
// mac_defs: HashSet::new(),
94-
macro_calls: HashSet::new(),
94+
macro_calls: FxHashSet(),
9595
}
9696
}
9797

src/librustc_save_analysis/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#[macro_use] extern crate log;
2525
#[macro_use] extern crate syntax;
26+
extern crate rustc_data_structures;
2627
extern crate rustc_serialize;
2728
extern crate rustc_typeck;
2829
extern crate syntax_pos;

src/librustc_save_analysis/span_utils.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,10 @@ impl<'a> SpanUtils<'a> {
398398
return false;
399399
}
400400
// If sub_span is none, filter out generated code.
401-
if sub_span.is_none() {
402-
return true;
403-
}
401+
let sub_span = match sub_span {
402+
Some(ss) => ss,
403+
None => return true,
404+
};
404405

405406
//If the span comes from a fake filemap, filter it.
406407
if !self.sess.codemap().lookup_char_pos(parent.lo).file.is_real_file() {
@@ -409,7 +410,7 @@ impl<'a> SpanUtils<'a> {
409410

410411
// Otherwise, a generated span is deemed invalid if it is not a sub-span of the root
411412
// callsite. This filters out macro internal variables and most malformed spans.
412-
!parent.source_callsite().contains(sub_span.unwrap())
413+
!parent.source_callsite().contains(sub_span)
413414
}
414415
}
415416

0 commit comments

Comments
 (0)