@@ -39,9 +39,9 @@ use rustc_ast::tokenstream::{TokenStream, TokenTree};
3939use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap , FxIndexSet , IndexEntry } ;
4040use rustc_errors:: codes:: * ;
4141use rustc_errors:: { FatalError , struct_span_code_err} ;
42- use rustc_hir:: PredicateOrigin ;
4342use rustc_hir:: def:: { CtorKind , DefKind , Res } ;
4443use rustc_hir:: def_id:: { DefId , DefIdMap , DefIdSet , LOCAL_CRATE , LocalDefId } ;
44+ use rustc_hir:: { LangItem , PredicateOrigin } ;
4545use rustc_hir_analysis:: hir_ty_lowering:: FeedConstTy ;
4646use rustc_hir_analysis:: { lower_const_arg_for_rustdoc, lower_ty} ;
4747use rustc_middle:: metadata:: Reexport ;
@@ -888,6 +888,10 @@ fn clean_ty_generics<'tcx>(
888888 if b. is_sized_bound ( cx) {
889889 has_sized = true ;
890890 false
891+ } else if b. is_metasized_bound ( cx) {
892+ // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
893+ // is shown and none of the new sizedness traits leak into documentation.
894+ false
891895 } else {
892896 true
893897 }
@@ -1482,6 +1486,13 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
14821486 }
14831487 _ => true ,
14841488 } ) ;
1489+
1490+ bounds. retain ( |b| {
1491+ // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
1492+ // is shown and none of the new sizedness traits leak into documentation.
1493+ !b. is_metasized_bound ( cx)
1494+ } ) ;
1495+
14851496 // Our Sized/?Sized bound didn't get handled when creating the generics
14861497 // because we didn't actually get our whole set of bounds until just now
14871498 // (some of them may have come from the trait). If we do have a sized
@@ -2317,6 +2328,12 @@ fn clean_middle_opaque_bounds<'tcx>(
23172328 _ => return None ,
23182329 } ;
23192330
2331+ // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
2332+ // is shown and none of the new sizedness traits leak into documentation.
2333+ if cx. tcx . is_lang_item ( trait_ref. def_id ( ) , LangItem :: MetaSized ) {
2334+ return None ;
2335+ }
2336+
23202337 if let Some ( sized) = cx. tcx . lang_items ( ) . sized_trait ( )
23212338 && trait_ref. def_id ( ) == sized
23222339 {
0 commit comments