Skip to content

Commit bbee9fa

Browse files
committed
improve rustdoc
1 parent af32e33 commit bbee9fa

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

‎src/librustdoc/clean/auto_trait.rs‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ use rustc_trait_selection::traits::auto_trait::{self, RegionTarget};
1010
use tracing::{debug, instrument};
1111

1212
use crate::clean::{
13-
self, Lifetime, clean_clause, clean_generic_param_def, clean_middle_ty,
14-
clean_trait_ref_with_constraints, clean_ty_generics_inner, simplify,
13+
self, Lifetime, clean_clause_uninterned, clean_generic_param_def, clean_middle_ty, clean_trait_ref_with_constraints, clean_ty_generics_inner, simplify,
1514
};
1615
use crate::core::DocContext;
1716

@@ -174,18 +173,16 @@ fn clean_param_env<'tcx>(
174173

175174
// FIXME(#111101): Incorporate the explicit predicates of the item here...
176175
let item_clauses: FxIndexSet<_> =
177-
tcx.param_env(item_def_id).caller_bounds().all_clauses(tcx).iter().collect();
176+
tcx.param_env(item_def_id).caller_bounds().trait_clauses(tcx).iter().collect();
177+
let sized_trait = tcx.lang_items().sized_trait();
178178
let where_predicates = cx.with_exact_param_env(param_env, |cx| {
179179
param_env
180180
.caller_bounds()
181-
.all_clauses(tcx)
181+
.trait_clauses(tcx)
182182
.iter()
183183
// FIXME: ...which hopefully allows us to simplify this:
184-
.filter(|clause| {
185-
!item_clauses.contains(clause)
186-
|| clause.as_trait_clause().is_some_and(|clause| {
187-
tcx.lang_items().sized_trait() == Some(clause.def_id())
188-
})
184+
.filter(|trait_clause| {
185+
!item_clauses.contains(trait_clause) || Some(trait_clause.def_id()) == sized_trait
189186
})
190187
.map(|clause| {
191188
fold_regions(tcx, clause, |r, _| match r.kind() {
@@ -202,7 +199,7 @@ fn clean_param_env<'tcx>(
202199
}
203200
})
204201
})
205-
.flat_map(|clause| clean_clause(clause, cx))
202+
.flat_map(|clause| clean_clause_uninterned(clause.map_bound(ty::ClauseKind::Trait), cx))
206203
.chain(clean_region_outlives_constraints(&region_data, generics))
207204
.collect()
208205
});

‎src/librustdoc/clean/mod.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,13 @@ pub(crate) fn clean_clause<'tcx>(
448448
clause: ty::Clause<'tcx>,
449449
cx: &mut DocContext<'tcx>,
450450
) -> Option<WherePredicate> {
451-
let bound_clause = clause.kind();
451+
clean_clause_uninterned(clause.kind(), cx)
452+
}
453+
454+
pub(crate) fn clean_clause_uninterned<'tcx>(
455+
bound_clause: ty::Binder<'tcx, ty::ClauseKind<'tcx>>,
456+
cx: &mut DocContext<'tcx>,
457+
) -> Option<WherePredicate> {
452458
match bound_clause.skip_binder() {
453459
ty::ClauseKind::Trait(pred) => clean_poly_trait_predicate(bound_clause.rebind(pred), cx),
454460
ty::ClauseKind::RegionOutlives(pred) => Some(clean_region_outlives_clause(pred, cx.tcx)),

0 commit comments

Comments
 (0)