diff options
Diffstat (limited to 'src/librustdoc/clean/inline.rs')
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 618dfa0d33a..0906d2f3845 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -2,7 +2,6 @@ use std::iter::once; -use rustc::ty; use rustc_ast::ast; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; @@ -10,9 +9,9 @@ use rustc_hir::def::{CtorKind, DefKind, Res}; use rustc_hir::def_id::DefId; use rustc_hir::Mutability; use rustc_metadata::creader::LoadedMacro; +use rustc_middle::ty; use rustc_mir::const_eval::is_min_const_fn; use rustc_span::hygiene::MacroKind; -use rustc_span::symbol::sym; use rustc_span::Span; use crate::clean::{self, GetDefId, ToSource, TypeKind}; @@ -21,7 +20,7 @@ use crate::doctree; use super::Clean; -type Attrs<'hir> = rustc::ty::Attributes<'hir>; +type Attrs<'hir> = rustc_middle::ty::Attributes<'hir>; /// Attempt to inline a definition into this AST. /// @@ -42,11 +41,7 @@ pub fn try_inline( attrs: Option<Attrs<'_>>, visited: &mut FxHashSet<DefId>, ) -> Option<Vec<clean::Item>> { - let did = if let Some(did) = res.opt_def_id() { - did - } else { - return None; - }; + let did = res.opt_def_id()?; if did.is_local() { return None; } @@ -198,7 +193,6 @@ pub fn build_external_trait(cx: &DocContext<'_>, did: DefId) -> clean::Trait { let generics = (cx.tcx.generics_of(did), predicates).clean(cx); let generics = filter_non_trait_generics(did, generics); let (generics, supertrait_bounds) = separate_supertrait_bounds(generics); - let is_spotlight = load_attrs(cx, did).clean(cx).has_doc_flag(sym::spotlight); let is_auto = cx.tcx.trait_is_auto(did); clean::Trait { auto: auto_trait, @@ -206,7 +200,6 @@ pub fn build_external_trait(cx: &DocContext<'_>, did: DefId) -> clean::Trait { generics, items: trait_items, bounds: supertrait_bounds, - is_spotlight, is_auto, } } @@ -489,8 +482,8 @@ fn build_module(cx: &DocContext<'_>, did: DefId, visited: &mut FxHashSet<DefId>) } pub fn print_inlined_const(cx: &DocContext<'_>, did: DefId) -> String { - if let Some(node_id) = cx.tcx.hir().as_local_hir_id(did) { - cx.tcx.hir().hir_to_pretty_string(node_id) + if let Some(hir_id) = cx.tcx.hir().as_local_hir_id(did) { + rustc_hir_pretty::id_to_string(&cx.tcx.hir(), hir_id) } else { cx.tcx.rendered_const(did) } @@ -581,7 +574,7 @@ fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics) -> clean: name: ref _name, }, ref bounds, - } => !(*s == "Self" && did == trait_did) && !bounds.is_empty(), + } => !(bounds.is_empty() || *s == "Self" && did == trait_did), _ => true, }); g |
