Uh oh!
There was an error while loading. Please reload this page.
rustdoc: redirect URLs - #35236
Conversation
nrc
commented
Aug 3, 2016
alexcrichton
commented
Aug 4, 2016
@nrc so just to clarify, this emits |
ollie27
commented
Aug 4, 2016
As with the previous PR, methods and struct fields are in the same namespace so we get conflicts. For example |
nrc
commented
Aug 4, 2016
It is, but without changing the canonical URLs/anchors there doesn't seem to be a great way to disambiguate. However, since these are not canonical URLs, it doesn't really matter - for tool users who link to Rustdoc, there will be a very few URLs that don't work properly, but I expect this to be a pretty small edge case. |
nrc
commented
Aug 4, 2016
Well, |
alexcrichton
commented
Aug 8, 2016
ollie27
commented
Aug 8, 2016
There are a few issues with the implementation:
|
alexcrichton
commented
Aug 8, 2016
@bors: r-, ah, good points! |
bors
commented
Aug 9, 2016
⌛ Testing commit 525b77e with merge 8d86593... |
alexcrichton
commented
Aug 9, 2016
@bors: r- er... maybe a mis-parse? |
bors
commented
Aug 9, 2016
💔 Test failed - auto-win-msvc-64-opt-rustbuild |
nrc
commented
Aug 9, 2016
bors is clearly hungry for this PR, it won't take 'no' for an answer |
nrc
commented
Aug 11, 2016
re tests, does anyone (@ollie27?) have suggestions for how to test the existence of the redirects? I don't see a way to fit it into the existing framework, but I don't know it very well. |
alexcrichton
commented
Aug 12, 2016
I think you can at least test for their existence with the rustdoc tests, and maybe html tags inside them as well? |
ollie27
commented
Aug 14, 2016
Check out test/rustdoc/redirect.rs and test/rustdoc/issue-33302.rs for examples which test the same kind of things. For example I'd do something like the following for structs: #![crate_name = "foo"]// @has 'foo/FooStruct.t.html'// @has - '//p/a' 'struct.FooStruct.html'// @has 'foo/struct.FooStruct.html'pubstructFooStruct{// @has - '//*[@id="foo.v"]' 'foo'pubfoo:(),// @has - '//*[@id="dupe.v"]' 'dupe'pubdupe:(),}implFooStruct{// @has - '//*[@id="bar.v"]' 'bar'pubfnbar(){}// @has - '//*[@id="dupe.v-1"]' 'dupe'pubfndupe(){}}You should be able repeat that for every other item type. |
nrc
commented
Aug 14, 2016
@ollie27 I tried something like this and it doesn't work. I'm not really clear on the semantics of |
ollie27
commented
Aug 15, 2016
Check out src/etc/htmldocck.py for a better explanation than I could give. |
nrc
commented
Aug 15, 2016
Thanks for the link, I knew these must be documented somewhere.
This is what was tripping me up. |
nrc
commented
Aug 15, 2016
Updated with tests, spans instead of anchors, and unique ids. |
alexcrichton
commented
Aug 16, 2016
bors
commented
Aug 16, 2016
⌛ Testing commit 6765f7e with merge 30adf96... |
bors
commented
Aug 16, 2016
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
| </span><span class='stab {stab}'></span>", | ||
| shortty = ItemType::StructField, | ||
| write!(w, "<span id='{item_type}.{name}' class='{item_type}'> | ||
| <span id='{name}.{name_space}' class='invisible'> |
There was a problem hiding this comment.
You'll need to use derive_id for these as well. The existing ids are also missing a call to derive_id so you may as well also fix that while you're at it.
| write!(w, "<tr><td \ | ||
| id='variant.{v}.field.{f}'>\ | ||
| <code>{f}: {t}</code></td><td>", | ||
| <span id='{v}.{vns}.{f}.{fns}' class='invisible'>\ |
ollie27
commented
Aug 16, 2016
I was hoping you'd add a new test covering every single item type. For example enum variant struct fields and macros are different so need explicit tests. Are you going to document this feature anywhere? What kind of stability guarantees do these new URLs have? Can other people use them? |
nrc
commented
Aug 16, 2016
I suppose a few more tests couldn't hurt. The main code paths are exercised and the coverage seems as good or better than existing Rustdoc tests.
No. I see no point in encouraging use of these until the long-term URL solution is figured out.
None, use at your own risk.
Sure, but I wouldn't encourage it.
I was assuming there was some logic behind not calling derive_id here (e.g., you can't have duplicate named fields, so I assume there can't be a name clash). |
ollie27
commented
Aug 16, 2016
The test coverage in rustdoc isn't very good right now so we should be aiming for better coverage.
|
… ones cc rust-lang#35020 which does this properly
nrc
commented
Aug 17, 2016
bors
commented
Aug 17, 2016
📌 Commit 879637f has been approved by |
bors
commented
Aug 17, 2016
rustdoc: redirect URLs cc #35020 which does this properly r? @alexcrichton
cc #35020 which does this properly
r? @alexcrichton