Skip to content
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

rustdoc: Merge method and tymethod URL fragments and sections #92658

Closed
wants to merge 2 commits into from

Conversation

camelid
Copy link
Member

@camelid camelid commented Jan 7, 2022

This change was discussed on Zulip here.

Here is an excerpt of my proposal, explaining my rationale:

They add needless complexity to the intra-doc links code (e.g.,
whether an associated item is an impl vs a prototype has to be
hardcoded in some circumstances
) and elsewhere in rustdoc. I don't
think there's any need to distinguish between these two kinds. For
example, associated constant prototypes in traits vs definitions in
traits, trait impls, and inherent impls both use associatedconstant.

r? @GuillaumeGomez
cc @jsha

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez,@Folyd

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 7, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 7, 2022
@camelid

This comment has been minimized.

@camelid camelid force-pushed the tymethod-to-method branch 2 times, most recently from 7ef0ed1 to c996ec3 Compare January 7, 2022 23:21
@camelid
Copy link
Member Author

camelid commented Jan 7, 2022

I think the main downside of this change is the breakage of non–intra-doc links. There are a lot of results when I search for #tymethod.. Nearly all of these seem like they should be using intra-doc links instead.

Should we have an FCP given the breakage?

@jsha
Copy link
Contributor

jsha commented Jan 7, 2022

Why not add JS to fixup tymethod fragments on page load?

@camelid
Copy link
Member Author

camelid commented Jan 7, 2022

I guess we could... I just don't want to end up with tons of redirects as we change rustdoc's output over time.

Is there existing code for this or should I add it?

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member

I'd rather not have JS code for that... Such things tend to last much longer than expected. Considering how big the impact is and because it's also a breaking change, FCP is required here.

@camelid
Copy link
Member Author

camelid commented Jan 8, 2022

Hmm, I'm sympathetic to the concern about the redirect lasting too long, but on the other hand, it shouldn't be much code to maintain and the change would otherwise be annoying for users.

@jsha
Copy link
Contributor

jsha commented Jan 8, 2022

The code would be something like (in main.js):

document.addEventListener("DOMContentLoaded", function() {
  let fragment = getPageId();  // getPageId is defined in main.js
  if (fragment.startsWith("tymethod.")) {
    document.location.hash = "#" + fragment.slice(2);
  }
}

@bors

This comment has been minimized.

@camelid camelid added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 11, 2022
This change was discussed on Zulip [here][1].

Here is an excerpt of my proposal, explaining my rationale:

    They add needless complexity to the intra-doc links code (e.g.,
    [whether an associated item is an impl vs a prototype has to be
    hardcoded in some circumstances][2]) and elsewhere in rustdoc. I don't
    think there's any need to distinguish between these two kinds. For
    example, associated constant prototypes in traits vs definitions in
    traits, trait impls, and inherent impls both use `associatedconstant`.

[1]: https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.5Bproposal.5D.20merge.20tymethod.20and.20method
[2]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/trait.20assoc.20item.20-.3E.20impl.20assoc.20item
This commit replaces all uses of `tymethod` with `method` in
rust-lang/rust, including subtrees but not submodules.

The Book, Nomicon, and Reference will have to be updated separately
after this change lands.
@camelid camelid force-pushed the tymethod-to-method branch 2 times, most recently from 804c509 to 889d3f9 Compare January 28, 2022 21:49
@camelid
Copy link
Member Author

camelid commented Jan 28, 2022

I moved the CSS cleanup commit into its own PR: #93444

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-12 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
i....................................................i.............................................. 100/495
.................................................................................................... 200/495
.................................................................................................... 300/495
..............................i..................................................................i.. 400/495
Some tests failed in compiletest suite=rustdoc mode=rustdoc host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
..........................F......................................F.............................

---- [rustdoc] rustdoc/source-version-separator.rs stdout ----


error: htmldocck failed!
status: exit status: 1
command: "/usr/bin/python3" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/source-version-separator" "/checkout/src/test/rustdoc/source-version-separator.rs"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
9: @has check failed
 `XPATH PATTERN` did not match
     // @has - '//div[@id="tymethod.foo"]/*[@class="rightside"]' '3.0 · source'
Encountered 1 errors

------------------------------------------



---- [rustdoc] rustdoc/trait-impl-items-links-and-anchors.rs stdout ----

error: htmldocck failed!
status: exit status: 1
command: "/usr/bin/python3" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/trait-impl-items-links-and-anchors" "/checkout/src/test/rustdoc/trait-impl-items-links-and-anchors.rs"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
17: @has check failed
 `XPATH PATTERN` did not match
     // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.trait_function"]//a[@class="anchor"]/@href' #method.trait_function
Encountered 1 errors

------------------------------------------

---
test result: FAILED. 489 passed; 2 failed; 4 ignored; 0 measured; 0 filtered out; finished in 37.66s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/rustdoc" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "rustdoc" "--mode" "rustdoc" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-12/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "12.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine extensions filecheck frontendopenacc frontendopenmp fuzzmutate globalisel hellonew hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit orcshared orctargetprocess passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--channel" "nightly" "--color" "always"


Build completed unsuccessfully in 0:16:11

@bors
Copy link
Contributor

bors commented Feb 5, 2022

☔ The latest upstream changes (presumably #93655) made this pull request unmergeable. Please resolve the merge conflicts.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 10, 2022
…llaumeGomez

Refactor sidebar printing code

This is the refactoring parts of rust-lang#92660, plus the trait aliases capitalization
consistency fix. I think this will be necessary for rust-lang#92658.

r? `@GuillaumeGomez`
@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 6, 2022
@JohnCSimon
Copy link
Member

Ping from triage:
@camelid is this PR still active?

@camelid
Copy link
Member Author

camelid commented May 20, 2022

I've been meaning to get back to it. Hopefully within the next few weeks I'll be able to finish it. Otherwise, I'll probably close it.

@Dylan-DPC
Copy link
Member

Closing this as inactive

@Dylan-DPC Dylan-DPC closed this Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants