diff options
| author | bors <bors@rust-lang.org> | 2021-06-26 10:52:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-06-26 10:52:16 +0000 |
| commit | 831ae3c1364b7b033bd1da430bc1cb86d93ad186 (patch) | |
| tree | 32db4a7d7858a85aefba7d95d4e728858b1ebee1 /src/librustdoc/formats | |
| parent | 481971978fda83aa7cf1f1f3c80cfad822377cf2 (diff) | |
| parent | 4ea27484c9582389cded2301d1f0dd4f421c8c35 (diff) | |
Auto merge of #84814 - Stupremee:properly-render-hrtbs, r=GuillaumeGomez
Properly render HRTBs
```rust
pub fn test<T>()
where
for<'a> &'a T: Iterator,
{}
```
This will now render properly including the `for<'a>`

I do not know if this covers all cases, it only covers everything that I could think of that includes `for` and lifetimes in where bounds.
Also someone need to mentor me on how to add a proper rustdoc test for this.
Resolves #78482
Diffstat (limited to 'src/librustdoc/formats')
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index c9682bd84f7..1e1fc2436aa 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -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() |
