-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Rustdoc improvement round number 45 #9691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The general idea of hyperlinking between crates is that it should require as little configuration as possible, if any at all. In this vein, there are two separate ways to generate hyperlinks between crates: 1. When you're generating documentation for a crate 'foo' into folder 'doc', then if foo's external crate dependencies already have documented in the folder 'doc', then hyperlinks will be generated. This will work because all documentation is in the same folder, allowing links to work seamlessly both on the web and on the local filesystem browser. The rationale for this use case is a package with multiple libraries/crates that all want to link to one another, and you don't want to have to deal with going to the web. In theory this could be extended to have a RUST_PATH-style searching situtation, but I'm not sure that it would work seamlessly on the web as it does on the local filesystem, so I'm not attempting to explore this case in this pull request. I believe to fully realize this potential rustdoc would have to be acting as a server instead of a static site generator. 2. One of foo's external dependencies has a #[doc(html_root_url = "...")] attribute. This means that all hyperlinks to the dependency will be rooted at this url. This use case encompasses all packages using libstd/libextra. These two crates now have this attribute encoded (currently at the /doc/master url) and will be read by anything which has a dependency on libstd/libextra. This should also work for arbitrary crates in the wild that have online documentation. I don't like how the version is hard-wired into the url, but I think that this may be a case-by-case thing which doesn't end up being too bad in the long run. Closes rust-lang#9539
Here's the libextra documentation generated next to the libstd documentation. Notice that the link is to the doc folder on the same server. http://www.contrib.andrew.cmu.edu/~acrichto/doc/extra/treemap/struct.TreeMapIterator.html A random program that uses libstd (notice the link from option to the http://www.contrib.andrew.cmu.edu/~acrichto/doc/foo/fn.foo.html The commands to generate this documentation was:
So basically libstd/libextra documentation was generated alongside one another, but when removed the |
This addresses some of @huonw's in rust-lang#9691 about the startling lack of documentation guiding one throughout the innards of rustdoc::html
} | ||
|
||
// Well, at least we tried. | ||
return Unknown; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“What is this I see before me?” A return
statement at the end of a function?
(The preferred format would be Unknown
rather than return Unknown;
, right?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly this doesn't seem to be mentioned in https://github.com/mozilla/rust/wiki/Note-style-guide right now. I personally don't like ending long functions without a return
and rather with just an expression, but that's just a personal preference of me.
…eGomez Document the `html_root_url` doc attribute value. I'm not sure if this was intentionally not documented, but I think it would be good to include. This was added in rust-lang#9691. `--extern-html-root-url` is unstable, but I don't think it hurts to mention it.
Add `lintcheck` to packages linted by `dogfood` test Currently, `lintcheck` is not checked by the `dogfood` test. I assume that is not intentional. If it is intentional, then this PR can be ignored. changelog: Add `lintcheck` to packages linted by `dogfood` test
This slurps in the commits from #9684 as well as closing #9539.