review changes
This commit is contained in:
parent
bbc00c9e9c
commit
27b9182d5b
1
src/Cargo.lock
generated
1
src/Cargo.lock
generated
@ -1549,6 +1549,7 @@ dependencies = [
|
|||||||
"rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc 0.0.0",
|
"rustc 0.0.0",
|
||||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rustc_data_structures 0.0.0",
|
||||||
"rustc_typeck 0.0.0",
|
"rustc_typeck 0.0.0",
|
||||||
"syntax 0.0.0",
|
"syntax 0.0.0",
|
||||||
"syntax_pos 0.0.0",
|
"syntax_pos 0.0.0",
|
||||||
|
@ -11,6 +11,7 @@ crate-type = ["dylib"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
rustc = { path = "../librustc" }
|
rustc = { path = "../librustc" }
|
||||||
|
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||||
rustc_typeck = { path = "../librustc_typeck" }
|
rustc_typeck = { path = "../librustc_typeck" }
|
||||||
syntax = { path = "../libsyntax" }
|
syntax = { path = "../libsyntax" }
|
||||||
syntax_pos = { path = "../libsyntax_pos" }
|
syntax_pos = { path = "../libsyntax_pos" }
|
||||||
|
@ -29,8 +29,8 @@ use rustc::hir::def_id::DefId;
|
|||||||
use rustc::hir::map::Node;
|
use rustc::hir::map::Node;
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::ty::{self, TyCtxt};
|
use rustc::ty::{self, TyCtxt};
|
||||||
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
|
|
||||||
use std::collections::HashSet;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use syntax::ast::{self, NodeId, PatKind, Attribute, CRATE_NODE_ID};
|
use syntax::ast::{self, NodeId, PatKind, Attribute, CRATE_NODE_ID};
|
||||||
@ -75,7 +75,7 @@ pub struct DumpVisitor<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> {
|
|||||||
// we only write one macro def per unique macro definition, and
|
// we only write one macro def per unique macro definition, and
|
||||||
// one macro use per unique callsite span.
|
// one macro use per unique callsite span.
|
||||||
// mac_defs: HashSet<Span>,
|
// mac_defs: HashSet<Span>,
|
||||||
macro_calls: HashSet<Span>,
|
macro_calls: FxHashSet<Span>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
|
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> {
|
|||||||
span: span_utils.clone(),
|
span: span_utils.clone(),
|
||||||
cur_scope: CRATE_NODE_ID,
|
cur_scope: CRATE_NODE_ID,
|
||||||
// mac_defs: HashSet::new(),
|
// mac_defs: HashSet::new(),
|
||||||
macro_calls: HashSet::new(),
|
macro_calls: FxHashSet(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
#[macro_use] extern crate syntax;
|
#[macro_use] extern crate syntax;
|
||||||
|
extern crate rustc_data_structures;
|
||||||
extern crate rustc_serialize;
|
extern crate rustc_serialize;
|
||||||
extern crate rustc_typeck;
|
extern crate rustc_typeck;
|
||||||
extern crate syntax_pos;
|
extern crate syntax_pos;
|
||||||
|
@ -398,9 +398,10 @@ impl<'a> SpanUtils<'a> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// If sub_span is none, filter out generated code.
|
// If sub_span is none, filter out generated code.
|
||||||
if sub_span.is_none() {
|
let sub_span = match sub_span {
|
||||||
return true;
|
Some(ss) => ss,
|
||||||
}
|
None => return true,
|
||||||
|
};
|
||||||
|
|
||||||
//If the span comes from a fake filemap, filter it.
|
//If the span comes from a fake filemap, filter it.
|
||||||
if !self.sess.codemap().lookup_char_pos(parent.lo).file.is_real_file() {
|
if !self.sess.codemap().lookup_char_pos(parent.lo).file.is_real_file() {
|
||||||
@ -409,7 +410,7 @@ impl<'a> SpanUtils<'a> {
|
|||||||
|
|
||||||
// Otherwise, a generated span is deemed invalid if it is not a sub-span of the root
|
// Otherwise, a generated span is deemed invalid if it is not a sub-span of the root
|
||||||
// callsite. This filters out macro internal variables and most malformed spans.
|
// callsite. This filters out macro internal variables and most malformed spans.
|
||||||
!parent.source_callsite().contains(sub_span.unwrap())
|
!parent.source_callsite().contains(sub_span)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user