Uh oh!
There was an error while loading. Please reload this page.
[rustdoc] Page hash handling - #70563
Conversation
There was a problem hiding this comment.
Would it not be better to add a class or somesuch in the generated code so that we're not relying so hard on the exact element structure for this?
There was a problem hiding this comment.
The problem is that it would require a way bigger change to simplify the DOM in order to do so. At first I thought about adding an id to the collapse button but in this case, we have both the <code> and the <h2> with ids, making it impossible. This is why I change the page's hash when it's the <code>.
There was a problem hiding this comment.
How does the id get into the code/h2 ? if it's purely via the markdown parser then I suppose I can understand the difficulty. If it's in rustdoc though then we ought to be able to do something. Failing that, the rest looks okay and if you're sure it's reliable then you can r=me.
There was a problem hiding this comment.
It's worth checking. I'll take another look around to be sure about it.
833ffa4 to
aa5c954CompareGuillaumeGomez
commented
Jun 27, 2020
So in the end, I simply removed all the IDs inside the |
rust-highfive
commented
Jun 27, 2020
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
GuillaumeGomez
commented
Jun 27, 2020
cc @jyn514 |
rust-highfive
commented
Jun 27, 2020
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
3a30bbc to
7ea2bcfCompareGuillaumeGomez
commented
Jun 29, 2020
@kinnison I remove the ids from |
kinnison
commented
Jun 29, 2020
The IDs do look nicer in use. And you're sure nothing was relying on the dodgy IDs? |
jyn514
commented
Jun 29, 2020
Well, end-users could be relying on them. Until we stabilize intra-doc links, users have to link using the same format rustdoc generates, so changing the format will break links. Fortunately these were only hashes so the links will only go to the top of the page instead of giving a 404. |
ollie27
commented
Jun 29, 2020
The extra IDs are part of #35236. To remove them we have to be sure that nothing is still using them. For example it looks like RLS is: https://github.com/rust-lang/rls/blob/fb46b914c11b06828680cb526e2abe9e1d69b868/rls-analysis/src/lib.rs#L500 |
jyn514
commented
Jun 30, 2020
🤷 |
ollie27
commented
Jul 1, 2020
We have git blame... As I said, the IDs were added to FWIW I agree with removing these, but if we're going to remove features we should make some effort to help migrate existing users like RLS. We should also fully revert #35236 not just part of it. |
7ea2bcf to
e955bebCompareGuillaumeGomez
commented
Jul 2, 2020
I completely removed the option everywhere I could find it. Now I wonder: how do we handle this with RLS? ping @nrc |
kinnison
commented
Jul 2, 2020
@GuillaumeGomez It may also be worth pinging @Xanewok for rls stuff. |
GuillaumeGomez
commented
Jul 2, 2020
Well, you did it. @ollie27: Should we wait for RLS or should we merge? I don't really know how things are supposed to be handled in such a case... Supporting RLS through HTML ids was not a great idea. :-/ |
Xanewok
commented
Jul 6, 2020
RLS is currently broken and so I don't think we should block on RLS in this regard. I assume this modifies the behaviour that this snippet relies on: If so, could you help me adapt it to make it work as expected by new behaviour? |
The big difference will be that RLS will have to rely on "full" path instead of the weird abbreviated ones it used until now. So for example, a variant is "#variant.name". If you need a direct translation for each item, we can talk about it privately so I can help you more quickly. So if RLS isn't a blocker anymore, let's merge it. @bors r=ollie27,kinnison |
bors
commented
Jul 6, 2020
📌 Commit e955beb has been approved by |
…r=ollie27,kinnison [rustdoc] Page hash handling Fixesrust-lang#70476 A good example to see the change is to use this URL: https://doc.rust-lang.org/nightly/std/string/struct.String.html#from_iter.v-3 After the change, it actually goes to the target element (and change the page hash to something more clear for the users). r? @kinnison cc @ollie27
…arth Rollup of 14 pull requests Successful merges: - rust-lang#70563 ([rustdoc] Page hash handling) - rust-lang#73856 (Edit librustc_lexer top-level docs) - rust-lang#73870 (typeck: adding type information to projection) - rust-lang#73953 (Audit hidden/short code suggestions) - rust-lang#73962 (libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)]) - rust-lang#73969 (mir: mark mir construction temporaries as internal) - rust-lang#73974 (Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr)) - rust-lang#74067 (rustdoc: Restore underline text decoration on hover for FQN in header) - rust-lang#74074 (Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.) - rust-lang#74078 (Always resolve type@primitive as a primitive, not a module) - rust-lang#74089 (Add rust-analyzer to the build manifest) - rust-lang#74090 (Remove unused RUSTC_DEBUG_ASSERTIONS) - rust-lang#74102 (Fix const prop ICE) - rust-lang#74112 (Expand abbreviation in core::ffi description) Failed merges: r? @ghost
bors
commented
Jul 7, 2020
bors
commented
Jul 7, 2020
☔ The latest upstream changes (presumably #74117) made this pull request unmergeable. Please resolve the merge conflicts. |
…arth Rollup of 14 pull requests Successful merges: - rust-lang#70563 ([rustdoc] Page hash handling) - rust-lang#73856 (Edit librustc_lexer top-level docs) - rust-lang#73870 (typeck: adding type information to projection) - rust-lang#73953 (Audit hidden/short code suggestions) - rust-lang#73962 (libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)]) - rust-lang#73969 (mir: mark mir construction temporaries as internal) - rust-lang#73974 (Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr)) - rust-lang#74067 (rustdoc: Restore underline text decoration on hover for FQN in header) - rust-lang#74074 (Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.) - rust-lang#74078 (Always resolve type@primitive as a primitive, not a module) - rust-lang#74089 (Add rust-analyzer to the build manifest) - rust-lang#74090 (Remove unused RUSTC_DEBUG_ASSERTIONS) - rust-lang#74102 (Fix const prop ICE) - rust-lang#74112 (Expand abbreviation in core::ffi description) Failed merges: r? @ghost
Fixes#70476
A good example to see the change is to use this URL: https://doc.rust-lang.org/nightly/std/string/struct.String.html#from_iter.v-3
After the change, it actually goes to the target element (and change the page hash to something more clear for the users).
r? @kinnison
cc @ollie27