Short comment on rustdoc HTML roots #705
cormacrelf
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is very minor, but maybe a useful report in relation to the recent commit 7cc8415
I recently got a convoluted rustdoc build going. I did in fact mess with
html_root_url_prefix
on RustToolchainInfo, and did pretty much what is described there.My experience was that it was not close to being flexible enough. Linking to https://docs.rs for third party crates (from
reindeer
) with the correct version number is the litmus test for anything like this. Was not feasible with a dict of package prefixes. The issues were:--extern-html-root-url
args has access to a RustDependency (or whatever) structure, whose name can be different from the originalrust_library
's. The name often comes from analias
rule. You need to look through aliases to find the crate name that you should generate a link from, otherwise you may be linking to nowhere. This is possible but very hacky. (My code examined one of the .rlib artefacts and got its owner's label.)${label.name}
etc in the right spots, because what the prelude was appending after thehtml_root_url_prefix
was not suitable.sed
on all the HTML to turn that into adocs.rs
URL. It was bad and slow.Overall, the single dict of strings on the toolchain approach was terrible. Would not recommend bringing it back. The toolchain was simply the wrong place for it. In the next attempt I will use
-Zcrate-attr
as recommended, and obviously that will be very simple to apply toreindeer
generated BUCK files. You can just do the$name-$version
parsing in the macro and put a docs.rs URL in there.Beta Was this translation helpful? Give feedback.
All reactions