Fix intra-doc links for Self
on cross-crate items and primitives by jyn514 · Pull Request #76467 · rust-lang/rust (original) (raw)
Ok yeah my sketch of an idea is that instead of turning this into a string, I turn it into a Res
. Then I separate out all the logic for associated items, etc. and call that directly when I see Self
. This would have to introduce the idea of a 'partial resolution' - I did part of that in #75756 but I can rewrite some of it here I guess :/
Actually to make this even more consistent, I could strip Self::
out of path_str
altogether and always have a partial_res: Option<Res>
that I pass to resolve, then there's very little logic that needs to change. This will screw with the link displayed even more though, I'd have to make a separate variable that distinguishes the original link from 'path we're looking up'.