1
Fork 0

rustdoc: Introduce new DynTrait type for better representation of trait objects

This commit is contained in:
Justus K 2021-06-18 21:47:42 +02:00
parent 1f65f56461
commit 4ea27484c9
No known key found for this signature in database
GPG key ID: 8C62FE98A62FC462
9 changed files with 117 additions and 116 deletions

View file

@ -402,6 +402,15 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
self.cache.parent_stack.push(did);
true
}
clean::DynTrait(ref bounds, _)
| clean::BorrowedRef { type_: box clean::DynTrait(ref bounds, _), .. } => {
if let Some(did) = bounds[0].trait_.def_id() {
self.cache.parent_stack.push(did);
true
} else {
false
}
}
ref t => {
let prim_did = t
.primitive_type()
@ -432,6 +441,12 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
| clean::BorrowedRef { type_: box clean::ResolvedPath { did, .. }, .. } => {
dids.insert(did);
}
clean::DynTrait(ref bounds, _)
| clean::BorrowedRef { type_: box clean::DynTrait(ref bounds, _), .. } => {
if let Some(did) = bounds[0].trait_.def_id() {
dids.insert(did);
}
}
ref t => {
let did = t
.primitive_type()