diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-03-21 16:52:41 +1100 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2022-03-21 17:04:03 +1100 |
| commit | 1f3ee7f32e1345e70f31adf1cb2d6f11d1d87c9a (patch) | |
| tree | 5979e8a7dbd451f5c73d192b3b9529d52964e890 /src/librustdoc | |
| parent | 4df2a28aee55f73d4e898c931664b8087b06522d (diff) | |
| download | rust-1f3ee7f32e1345e70f31adf1cb2d6f11d1d87c9a.tar.gz rust-1f3ee7f32e1345e70f31adf1cb2d6f11d1d87c9a.zip | |
Rename `~const Drop` to `~const Destruct`
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 2c61b7468dc..1e3260ce9ae 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -121,11 +121,20 @@ impl Clean<Option<GenericBound>> for hir::GenericBound<'_> { hir::GenericBound::Trait(ref t, modifier) => { // `T: ~const Drop` is not equivalent to `T: Drop`, and we don't currently document `~const` bounds // because of its experimental status, so just don't show these. - if Some(t.trait_ref.trait_def_id().unwrap()) == cx.tcx.lang_items().drop_trait() - && hir::TraitBoundModifier::MaybeConst == modifier + // `T: ~const Destruct` is hidden because `T: Destruct` is a no-op. + if modifier == hir::TraitBoundModifier::MaybeConst + && [cx.tcx.lang_items().drop_trait(), cx.tcx.lang_items().destruct_trait()] + .iter() + .any(|tr| *tr == Some(t.trait_ref.trait_def_id().unwrap())) { return None; } + + #[cfg(bootstrap)] + { + // FIXME: remove `lang_items().drop_trait()` from above logic, + // as well as the comment about `~const Drop` because it was renamed to `Destruct`. + } GenericBound::TraitBound(t.clean(cx), modifier) } }) @@ -306,12 +315,21 @@ impl<'a> Clean<Option<WherePredicate>> for ty::PolyTraitPredicate<'a> { fn clean(&self, cx: &mut DocContext<'_>) -> Option<WherePredicate> { // `T: ~const Drop` is not equivalent to `T: Drop`, and we don't currently document `~const` bounds // because of its experimental status, so just don't show these. + // `T: ~const Destruct` is hidden because `T: Destruct` is a no-op. if self.skip_binder().constness == ty::BoundConstness::ConstIfConst - && Some(self.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().drop_trait() + && [cx.tcx.lang_items().drop_trait(), cx.tcx.lang_items().destruct_trait()] + .iter() + .any(|tr| *tr == Some(self.skip_binder().def_id())) { return None; } + #[cfg(bootstrap)] + { + // FIXME: remove `lang_items().drop_trait()` from above logic, + // as well as the comment about `~const Drop` because it was renamed to `Destruct`. + } + let poly_trait_ref = self.map_bound(|pred| pred.trait_ref); Some(WherePredicate::BoundPredicate { ty: poly_trait_ref.skip_binder().self_ty().clean(cx), |
