@@ -39,9 +39,9 @@ use rustc_ast::tokenstream::{TokenStream, TokenTree};
39
39
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap , FxIndexSet , IndexEntry } ;
40
40
use rustc_errors:: codes:: * ;
41
41
use rustc_errors:: { FatalError , struct_span_code_err} ;
42
- use rustc_hir:: PredicateOrigin ;
43
42
use rustc_hir:: def:: { CtorKind , DefKind , Res } ;
44
43
use rustc_hir:: def_id:: { DefId , DefIdMap , DefIdSet , LOCAL_CRATE , LocalDefId } ;
44
+ use rustc_hir:: { LangItem , PredicateOrigin } ;
45
45
use rustc_hir_analysis:: hir_ty_lowering:: FeedConstTy ;
46
46
use rustc_hir_analysis:: { lower_const_arg_for_rustdoc, lower_ty} ;
47
47
use rustc_middle:: metadata:: Reexport ;
@@ -892,6 +892,10 @@ fn clean_ty_generics<'tcx>(
892
892
if b. is_sized_bound ( cx) {
893
893
has_sized = true ;
894
894
false
895
+ } else if b. is_metasized_bound ( cx) {
896
+ // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
897
+ // is shown and none of the new sizedness traits leak into documentation.
898
+ false
895
899
} else {
896
900
true
897
901
}
@@ -1486,6 +1490,13 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
1486
1490
}
1487
1491
_ => true ,
1488
1492
} ) ;
1493
+
1494
+ bounds. retain ( |b| {
1495
+ // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
1496
+ // is shown and none of the new sizedness traits leak into documentation.
1497
+ !b. is_metasized_bound ( cx)
1498
+ } ) ;
1499
+
1489
1500
// Our Sized/?Sized bound didn't get handled when creating the generics
1490
1501
// because we didn't actually get our whole set of bounds until just now
1491
1502
// (some of them may have come from the trait). If we do have a sized
@@ -2321,6 +2332,12 @@ fn clean_middle_opaque_bounds<'tcx>(
2321
2332
_ => return None ,
2322
2333
} ;
2323
2334
2335
+ // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized`
2336
+ // is shown and none of the new sizedness traits leak into documentation.
2337
+ if cx. tcx . is_lang_item ( trait_ref. def_id ( ) , LangItem :: MetaSized ) {
2338
+ return None ;
2339
+ }
2340
+
2324
2341
if let Some ( sized) = cx. tcx . lang_items ( ) . sized_trait ( )
2325
2342
&& trait_ref. def_id ( ) == sized
2326
2343
{
0 commit comments