@@ -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 ;
@@ -907,6 +907,10 @@ fn clean_ty_generics<'tcx>(
907907 if b. is_sized_bound ( cx) {
908908 has_sized = true ;
909909 false
910+ } else if b. is_meta_sized_bound ( cx) {
911+ // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
912+ // is shown and none of the new sizedness traits leak into documentation.
913+ false
910914 } else {
911915 true
912916 }
@@ -1473,6 +1477,13 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
14731477 }
14741478 _ => true ,
14751479 } ) ;
1480+
1481+ bounds. retain ( |b| {
1482+ // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
1483+ // is shown and none of the new sizedness traits leak into documentation.
1484+ !b. is_meta_sized_bound ( cx)
1485+ } ) ;
1486+
14761487 // Our Sized/?Sized bound didn't get handled when creating the generics
14771488 // because we didn't actually get our whole set of bounds until just now
14781489 // (some of them may have come from the trait). If we do have a sized
@@ -2304,6 +2315,12 @@ fn clean_middle_opaque_bounds<'tcx>(
23042315 _ => return None ,
23052316 } ;
23062317
2318+ // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
2319+ // is shown and none of the new sizedness traits leak into documentation.
2320+ if cx. tcx . is_lang_item ( trait_ref. def_id ( ) , LangItem :: MetaSized ) {
2321+ return None ;
2322+ }
2323+
23072324 if let Some ( sized) = cx. tcx . lang_items ( ) . sized_trait ( )
23082325 && trait_ref. def_id ( ) == sized
23092326 {
0 commit comments