mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 05:51:58 +00:00
convert save-analysis to use ItemCtxt
and not ast_ty_to_ty_cache
This commit is contained in:
parent
196c98d314
commit
3039398c68
1
src/Cargo.lock
generated
1
src/Cargo.lock
generated
@ -723,6 +723,7 @@ dependencies = [
|
||||
"rls-span 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc 0.0.0",
|
||||
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_typeck 0.0.0",
|
||||
"syntax 0.0.0",
|
||||
"syntax_pos 0.0.0",
|
||||
]
|
||||
|
@ -11,6 +11,7 @@ crate-type = ["dylib"]
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
rustc = { path = "../librustc" }
|
||||
rustc_typeck = { path = "../librustc_typeck" }
|
||||
syntax = { path = "../libsyntax" }
|
||||
syntax_pos = { path = "../libsyntax_pos" }
|
||||
rls-data = "0.1"
|
||||
|
@ -122,7 +122,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
|
||||
f(self);
|
||||
self.save_ctxt.tables = old_tables;
|
||||
} else {
|
||||
f(self)
|
||||
f(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#[macro_use] extern crate log;
|
||||
#[macro_use] extern crate syntax;
|
||||
extern crate rustc_serialize;
|
||||
extern crate rustc_typeck;
|
||||
extern crate syntax_pos;
|
||||
|
||||
extern crate rls_data;
|
||||
@ -50,6 +51,7 @@ use rustc::hir::def_id::DefId;
|
||||
use rustc::session::config::CrateType::CrateTypeExecutable;
|
||||
use rustc::session::Session;
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
use rustc_typeck::hir_ty_to_ty;
|
||||
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
@ -606,11 +608,12 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
|
||||
Def::Local(def_id)
|
||||
}
|
||||
|
||||
Node::NodeTy(&hir::Ty { node: hir::TyPath(ref qpath), .. }) => {
|
||||
match *qpath {
|
||||
hir::QPath::Resolved(_, ref path) => path.def,
|
||||
hir::QPath::TypeRelative(..) => {
|
||||
if let Some(ty) = self.tcx.ast_ty_to_ty_cache.borrow().get(&id) {
|
||||
Node::NodeTy(ty) => {
|
||||
if let hir::Ty { node: hir::TyPath(ref qpath), .. } = *ty {
|
||||
match *qpath {
|
||||
hir::QPath::Resolved(_, ref path) => path.def,
|
||||
hir::QPath::TypeRelative(..) => {
|
||||
let ty = hir_ty_to_ty(self.tcx, ty);
|
||||
if let ty::TyProjection(proj) = ty.sty {
|
||||
for item in self.tcx.associated_items(proj.trait_ref.def_id) {
|
||||
if item.kind == ty::AssociatedKind::Type {
|
||||
@ -620,9 +623,11 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
Def::Err
|
||||
}
|
||||
Def::Err
|
||||
}
|
||||
} else {
|
||||
Def::Err
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user