rustc_typeck = { path = "../librustc_typeck" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
-rls-data = "0.11"
+rls-data = { git = "https://github.com/Xanewok/rls-data", branch = "crate-source" }
rls-span = "0.4"
# FIXME(#40527) should move rustc serialize out of tree
rustc-serialize = "0.3"
use span_utils::SpanUtils;
use sig;
-use rls_data::{CratePreludeData, Import, ImportKind, SpanData, Ref, RefKind,
- Def, DefKind, Relation, RelationKind};
+use rls_data::{CratePreludeData, GlobalCrateId, Import, ImportKind, SpanData,
+ Ref, RefKind, Def, DefKind, Relation, RelationKind};
macro_rules! down_cast_data {
($id:ident, $kind:ident, $sp:expr) => {
});
let data = CratePreludeData {
- crate_name: name.into(),
+ crate_id: GlobalCrateId {
+ name: name.into(),
+ disambiguator: self.tcx.sess.local_crate_disambiguator().to_string(),
+ },
crate_root: crate_root.unwrap_or("<no source>".to_owned()),
external_crates: self.save_ctxt.get_external_crates(),
span: self.span_from_span(krate.span),
use span_utils::SpanUtils;
use rls_data::{Ref, RefKind, SpanData, MacroRef, Def, DefKind, Relation, RelationKind,
- ExternalCrateData};
+ ExternalCrateData, GlobalCrateId};
use rls_data::config::Config;
RelationData(Relation),
}
-macro_rules! option_try(
- ($e:expr) => (match $e { Some(e) => e, None => return None })
-);
-
impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
fn span_from_span(&self, span: Span) -> SpanData {
use rls_span::{Row, Column};
};
let lo_loc = self.span_utils.sess.codemap().lookup_char_pos(span.lo());
result.push(ExternalCrateData {
- name: self.tcx.crate_name(n).to_string(),
- num: n.as_u32(),
file_name: SpanUtils::make_path_string(&lo_loc.file.name),
+ num: n.as_u32(),
+ id: GlobalCrateId {
+ name: self.tcx.crate_name(n).to_string(),
+ disambiguator: self.tcx.crate_disambiguator(n).to_string(),
+ },
});
}
// macro uses.
let callsite = span.source_callsite();
let callsite_span = self.span_from_span(callsite);
- let callee = option_try!(span.source_callee());
- let callee_span = option_try!(callee.span);
+ let callee = span.source_callee()?;
+ let callee_span = callee.span?;
// Ignore attribute macros, their spans are usually mangled
if let MacroAttribute(_) = callee.format {