X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustdoc%2Fclean%2Fmod.rs;h=ef9f5f2a957583add6b9d88ccf764f45086a06e0;hb=8aa45c65d897570696830ea0675fa2faa989c536;hp=30419d3d3c6500ed48811b435e16cde515a4e91b;hpb=c44e29bb592a55805e6a7809c4f0e153c7236368;p=rust.git diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 30419d3d3c6..ef9f5f2a957 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -538,7 +538,7 @@ pub enum ItemEnum { FunctionItem(Function), ModuleItem(Module), TypedefItem(Typedef, bool /* is associated type */), - ExistentialItem(Existential, bool /* is associated type */), + OpaqueTyItem(OpaqueTy, bool /* is associated type */), StaticItem(Static), ConstantItem(Constant), TraitItem(Trait), @@ -574,7 +574,7 @@ pub fn generics(&self) -> Option<&Generics> { ItemEnum::EnumItem(ref e) => &e.generics, ItemEnum::FunctionItem(ref f) => &f.generics, ItemEnum::TypedefItem(ref t, _) => &t.generics, - ItemEnum::ExistentialItem(ref t, _) => &t.generics, + ItemEnum::OpaqueTyItem(ref t, _) => &t.generics, ItemEnum::TraitItem(ref t) => &t.generics, ItemEnum::ImplItem(ref i) => &i.generics, ItemEnum::TyMethodItem(ref i) => &i.generics, @@ -623,7 +623,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Item { items.extend(self.foreigns.iter().map(|x| x.clean(cx))); items.extend(self.mods.iter().map(|x| x.clean(cx))); items.extend(self.typedefs.iter().map(|x| x.clean(cx))); - items.extend(self.existentials.iter().map(|x| x.clean(cx))); + items.extend(self.opaque_tys.iter().map(|x| x.clean(cx))); items.extend(self.statics.iter().map(|x| x.clean(cx))); items.extend(self.constants.iter().map(|x| x.clean(cx))); items.extend(self.traits.iter().map(|x| x.clean(cx))); @@ -2257,7 +2257,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Item { type_: ty.clean(cx), generics: Generics::default(), }, true), - hir::ImplItemKind::Existential(ref bounds) => ExistentialItem(Existential { + hir::ImplItemKind::OpaqueTy(ref bounds) => OpaqueTyItem(OpaqueTy { bounds: bounds.clean(cx), generics: Generics::default(), }, true), @@ -2415,7 +2415,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Item { }, true) } } - ty::AssocKind::Existential => unimplemented!(), + ty::AssocKind::OpaqueTy => unimplemented!(), }; let visibility = match self.container { @@ -2429,7 +2429,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Item { stability: get_stability(cx, self.def_id), deprecation: get_deprecation(cx, self.def_id), def_id: self.def_id, - attrs: inline::load_attrs(cx, self.def_id), + attrs: inline::load_attrs(cx, self.def_id).clean(cx), source: cx.tcx.def_span(self.def_id).clean(cx), inner, } @@ -2776,7 +2776,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Type { TyKind::Tup(ref tys) => Tuple(tys.clean(cx)), TyKind::Def(item_id, _) => { let item = cx.tcx.hir().expect_item(item_id.id); - if let hir::ItemKind::Existential(ref ty) = item.node { + if let hir::ItemKind::OpaqueTy(ref ty) = item.node { ImplTrait(ty.bounds.clean(cx)) } else { unreachable!() @@ -2802,7 +2802,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Type { } }; - if let Some(&hir::ItemKind::Ty(ref ty, ref generics)) = alias { + if let Some(&hir::ItemKind::TyAlias(ref ty, ref generics)) = alias { let provided_params = &path.segments.last().expect("segments were empty"); let mut ty_substs = FxHashMap::default(); let mut lt_substs = FxHashMap::default(); @@ -3372,7 +3372,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Item { }; Item { name: Some(self.ident.clean(cx)), - attrs: inline::load_attrs(cx, self.def_id), + attrs: inline::load_attrs(cx, self.def_id).clean(cx), source: cx.tcx.def_span(self.def_id).clean(cx), visibility: Some(Inherited), def_id: self.def_id, @@ -3648,12 +3648,12 @@ fn clean(&self, cx: &DocContext<'_>) -> Item { } #[derive(Clone, Debug)] -pub struct Existential { +pub struct OpaqueTy { pub bounds: Vec, pub generics: Generics, } -impl Clean for doctree::Existential<'_> { +impl Clean for doctree::OpaqueTy<'_> { fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), @@ -3663,9 +3663,9 @@ fn clean(&self, cx: &DocContext<'_>) -> Item { visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), - inner: ExistentialItem(Existential { - bounds: self.exist_ty.bounds.clean(cx), - generics: self.exist_ty.generics.clean(cx), + inner: OpaqueTyItem(OpaqueTy { + bounds: self.opaque_ty.bounds.clean(cx), + generics: self.opaque_ty.generics.clean(cx), }, false), } } @@ -3856,7 +3856,7 @@ fn build_deref_target_impls(cx: &DocContext<'_>, let primitive = match *target { ResolvedPath { did, .. } if did.is_local() => continue, ResolvedPath { did, .. } => { - ret.extend(inline::build_impls(cx, did)); + ret.extend(inline::build_impls(cx, did, None)); continue } _ => match target.primitive_type() { @@ -3894,7 +3894,7 @@ fn build_deref_target_impls(cx: &DocContext<'_>, }; if let Some(did) = did { if !did.is_local() { - inline::build_impl(cx, did, ret); + inline::build_impl(cx, did, None, ret); } } } @@ -3921,7 +3921,11 @@ fn clean(&self, cx: &DocContext<'_>) -> Vec { }, ); - if let Some(items) = inline::try_inline(cx, res, self.name, &mut visited) { + if let Some(items) = inline::try_inline( + cx, res, self.name, + Some(rustc::ty::Attributes::Borrowed(self.attrs)), + &mut visited + ) { return items; } } @@ -3981,7 +3985,11 @@ fn clean(&self, cx: &DocContext<'_>) -> Vec { } if !denied { let mut visited = FxHashSet::default(); - if let Some(items) = inline::try_inline(cx, path.res, name, &mut visited) { + if let Some(items) = inline::try_inline( + cx, path.res, name, + Some(rustc::ty::Attributes::Borrowed(self.attrs)), + &mut visited + ) { return items; } }