Skip to content

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

Merged
merged 4 commits into from
Oct 3, 2013
Merged

Conversation

alexcrichton
Copy link
Member

This slurps in the commits from #9684 as well as closing #9539.

Seldaek and others added 4 commits October 2, 2013 12:32
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
@alexcrichton
Copy link
Member Author

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 static.rust-lang.org site:

http://www.contrib.andrew.cmu.edu/~acrichto/doc/foo/fn.foo.html

The commands to generate this documentation was:

rustdoc src/libstd/std.rs
rustdoc src/libextra/extra.rs
rsync doc my.remote.server:doc
rm -rf doc
rustdoc foo.rs
rsync doc my.remote.server:doc

So basically libstd/libextra documentation was generated alongside one another, but when removed the foo documentation could still link to libstd/libextra (because of the crate attributes).

bors added a commit that referenced this pull request Oct 3, 2013
This slurps in the commits from #9684 as well as closing #9539.
@bors bors closed this Oct 3, 2013
@bors bors merged commit d06043b into rust-lang:master Oct 3, 2013
@alexcrichton alexcrichton deleted the rustdoc branch October 3, 2013 16:34
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 3, 2013
This addresses some of @huonw's in rust-lang#9691 about the startling lack of
documentation guiding one throughout the innards of rustdoc::html
bors added a commit that referenced this pull request Oct 4, 2013
This addresses some of @huonw's in #9691 about the startling lack of
documentation guiding one throughout the innards of rustdoc::html

r? @huonw
}

// Well, at least we tried.
return Unknown;
Copy link
Member

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?)

Copy link
Member Author

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.

Manishearth added a commit to Manishearth/rust that referenced this pull request May 16, 2019
…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.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 23, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants