Skip to content

Make impl consts ConstantItems not AssocConstItems, to match typedefs #83665

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

Closed
wants to merge 4 commits into from

Conversation

CraftSpider
Copy link
Contributor

Fixes #81340. Draft as I'm not sure all tests will pass, running some of them locally isn't yet easy for me.

r? @ghost

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@CraftSpider
Copy link
Contributor Author

The expected failures from HTML, I see where the problem is and think I know how to fix it

@rust-log-analyzer

This comment has been minimized.

@CraftSpider
Copy link
Contributor Author

Added test for JSON but not HTML, as HTML tests seem to already thoroughly cover this. Wasn't too bad once I just sat down and worked on it for a bit. So, assuming tests pass here as they did locally...

r? @jyn514

@CraftSpider CraftSpider marked this pull request as ready for review May 8, 2021 02:05
@CraftSpider
Copy link
Contributor Author

@rustbot label: +A-rustdoc-json +A-rustdoc +S-waiting-on-review

@rustbot rustbot added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 8, 2021
@CraftSpider CraftSpider changed the title [WIP] Make impl consts ConstantItems not AssocConstItems, to match typedefs Make impl consts ConstantItems not AssocConstItems, to match typedefs May 8, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
Suite("src/test/assembly") not skipped for "bootstrap::test::Assembly" -- not in ["src/tools/tidy"]
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 33 tests
iiiiiiiiiiiiiiiiiiiiiiiiiiiii....

 finished in 0.180 seconds
Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/debuginfo") not skipped for "bootstrap::test::Debuginfo" -- not in ["src/tools/tidy"]
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 116 tests
iiiiiiiiii.i.i..i..i..ii......ii...ii..........iiii.........i.....i...i.......ii.i.ii.....iiii.....i 100/116
test result: ok. 78 passed; 0 failed; 38 ignored; 0 measured; 0 filtered out; finished in 2.52s

 finished in 2.589 seconds
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
---
---- [js-doc-test] rustdoc-js/doc-alias.rs stdout ----

error: rustdoc-js test failed!
status: exit status: 1
command: "/usr/bin/node" "/checkout/src/tools/rustdoc-js/tester.js" "--doc-folder" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-js/doc-alias" "--crate-name" "doc_alias" "--test-file" "/checkout/src/test/rustdoc-js/doc-alias.js"
------------------------------------------
Checking "doc-alias" ... FAILED
Checking "doc-alias" ... FAILED
[ query `StructImplConstItem`]==> Result not found in 'others': '{"path":"doc_alias::Struct","name":"ImplConstItem","alias":"StructImplConstItem","href":"../doc_alias/struct.Struct.html#associatedconstant.ImplConstItem","is_alias":true}'
Diff of first error:
 {
-     "path": "doc_alias::Struct",
+     "path": "doc_alias",
     "name": "ImplConstItem",
     "alias": "StructImplConstItem",
-     "href": "../doc_alias/struct.Struct.html#associatedconstant.ImplConstItem",
+     "href": "../doc_alias/constant.ImplConstItem.html",
     "is_alias": "true",

------------------------------------------
stderr:
------------------------------------------
---
test result: FAILED. 11 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.95s



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-js" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-js" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "rustdoc-js" "--mode" "js-doc-test" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-10/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Cdebuginfo=0 -Zunstable-options  -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" "10.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 frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation 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 orcerror orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils 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 x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:33:04

@CraftSpider
Copy link
Contributor Author

Hm, the failing test is actually kind of weird, looking at it: It expects the trait impl const to be in the search index, and the method, but not the typedef. Which would have the same issue as the const is now having: There doesn't seem to be a way to have the index link to a different type than the impl actually is

@jyn514
Copy link
Member

jyn514 commented May 9, 2021

I don't have time to review this.

r? @GuillaumeGomez

@CraftSpider
Copy link
Contributor Author

👍, for status: I need advice on what to do with the test. The current tests seem to not have the same issue with impl types being typedefs because they just don't add those to the index, or at least don't test it. So it looks like I'll have to make changes to how indexing works, unless we accept losing indexing of const impls

}
hir::ImplItemKind::Const(ref ty, expr) => ConstantItem(Constant {
type_: ty.clean(cx),
kind: ConstantKind::Local { def_id: local_did, body: expr },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with this way of doing it is that it doesn't differentiate between "normal" constants and associated ones, which is why I think you have the issue in the search index generation.

@jyn514 jyn514 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 May 14, 2021
@crlf0710
Copy link
Member

crlf0710 commented Jun 5, 2021

@CraftSpider Ping from triage, any updates on this?

@CraftSpider
Copy link
Contributor Author

I haven't really had time to work on it, feel free to close and I'll re-open if I make progress

@JohnCSimon JohnCSimon added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label Jun 22, 2021
@JohnCSimon
Copy link
Member

triage: @CraftSpider closing PR on request Please feel free to reopen when you're ready to continue

@JohnCSimon JohnCSimon closed this Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. 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.

Rustdoc json: Associated constants in impl have wrong representation
7 participants