]> git.lizzy.rs Git - rust.git/commitdiff
remove use of `ast_ty_to_ty_cache` from librustdoc
authorNiko Matsakis <niko@alum.mit.edu>
Wed, 3 May 2017 15:53:06 +0000 (11:53 -0400)
committerNiko Matsakis <niko@alum.mit.edu>
Thu, 4 May 2017 01:26:28 +0000 (21:26 -0400)
src/Cargo.lock
src/librustdoc/Cargo.toml
src/librustdoc/clean/mod.rs
src/librustdoc/lib.rs

index 21b167f6d42739050e38297991794ab3ef96a6f9..7b1a1ec7d26d3cc830cdf43dae2083f995ad175b 100644 (file)
@@ -793,6 +793,7 @@ dependencies = [
  "rustc_metadata 0.0.0",
  "rustc_resolve 0.0.0",
  "rustc_trans 0.0.0",
+ "rustc_typeck 0.0.0",
  "serialize 0.0.0",
  "syntax 0.0.0",
  "syntax_pos 0.0.0",
index 7caae51e88913676b767b13b508192f5434b18c2..0e8a6606ae79f387aca5d2d7941e2225a98e75af 100644 (file)
@@ -21,6 +21,7 @@ rustc_errors = { path = "../librustc_errors" }
 rustc_lint = { path = "../librustc_lint" }
 rustc_metadata = { path = "../librustc_metadata" }
 rustc_resolve = { path = "../librustc_resolve" }
+rustc_typeck = { path = "../librustc_typeck" }
 rustc_trans = { path = "../librustc_trans" }
 serialize = { path = "../libserialize" }
 syntax = { path = "../libsyntax" }
index 0a748487244321711d19156f46cc76d7aac13211..24d056035ceec541da0eea065acee215154dbd58 100644 (file)
@@ -36,6 +36,7 @@
 use rustc::ty::{self, AdtKind};
 use rustc::middle::stability;
 use rustc::util::nodemap::{FxHashMap, FxHashSet};
+use rustc_typeck::hir_ty_to_ty;
 
 use rustc::hir;
 
@@ -1779,10 +1780,9 @@ fn clean(&self, cx: &DocContext) -> Type {
             }
             TyPath(hir::QPath::TypeRelative(ref qself, ref segment)) => {
                 let mut def = Def::Err;
-                if let Some(ty) = cx.tcx.ast_ty_to_ty_cache.borrow().get(&self.id) {
-                    if let ty::TyProjection(proj) = ty.sty {
-                        def = Def::Trait(proj.trait_ref.def_id);
-                    }
+                let ty = hir_ty_to_ty(cx.tcx, self);
+                if let ty::TyProjection(proj) = ty.sty {
+                    def = Def::Trait(proj.trait_ref.def_id);
                 }
                 let trait_path = hir::Path {
                     span: self.span,
index 2a6134fde5c3d8f8e9aaba8b30ee207590052184..d4be1aba62d23587e2ebbd7e044be862d08c929e 100644 (file)
@@ -41,6 +41,7 @@
 extern crate rustc_lint;
 extern crate rustc_back;
 extern crate rustc_metadata;
+extern crate rustc_typeck;
 extern crate serialize;
 #[macro_use] extern crate syntax;
 extern crate syntax_pos;