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: import cross-crate macros alongside everything else #51611

Merged
merged 5 commits into from
Jul 4, 2018

Conversation

QuietMisdreavus
Copy link
Member

The thrilling conclusion of the cross-crate macro saga in rustdoc! After #51425 made sure we saw all the namespaces of an import (and prevented us from losing the vec! macro in std's documentation), here is the PR to handle cross-crate macro re-exports at the same time as everything else. This way, attributes like #[doc(hidden)] and #[doc(no_inline)] can be used to control how the documentation for these macros is seen, rather than rustdoc inlining every macro every time.

Fixes #50647

@rust-highfive
Copy link
Collaborator

r? @frewsxcv

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 17, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:start:test_rustdoc
Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:00:43] 
[01:00:43] running 241 tests
[01:01:56] ..................F.i...............................................................................
[01:02:39] ..............i...................................................................................F.
[01:02:50] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[01:02:50] failures:
[01:02:50] 
[01:02:50] ---- [rustdoc] rustdoc/cross-crate-links.rs stdout ----
[01:02:50] ---- [rustdoc] rustdoc/cross-crate-links.rs stdout ----
[01:02:50] 
[01:02:50] error: htmldocck failed!
[01:02:50] status: exit code: 1
[01:02:50] command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/cross-crate-links" "/checkout/src/test/rustdoc/cross-crate-links.rs"
[01:02:50] ------------------------------------------
[01:02:50] 
[01:02:50] ------------------------------------------
[01:02:50] stderr:
[01:02:50] stderr:
[01:02:50] ------------------------------------------
[01:02:50] 69: @has check failed
[01:02:50]  `XPATH PATTERN` did not match
[01:02:50]  // @has 'foo/index.html' '//a[@href="../foo/macro.foo_macro.html"]' 'foo_macro'
[01:02:50] Encountered 1 errors
[01:02:50] 
[01:02:50] ------------------------------------------
[01:02:50] 
[01:02:50] 
[01:02:50] thread '[rustdoc] rustdoc/cross-crate-links.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[01:02:50] note: R/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" "--mode" "rustdoc" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:02:50] 
[01:02:50] 
[01:02:50] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:02:50] Build completed unsuccessfully in 0:22:33
[01:02:50] Build completed unsuccessfully in 0:22:33
[01:02:50] Makefile:58: recipe for target 'check' failed
[01:02:50] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:399a0e12
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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 @TimNN. (Feature Requests)

hey look, macros properly link to the right place now
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[01:06:45] failures:
[01:06:45] 
[01:06:45] ---- [rustdoc] rustdoc/pub-use-extern-macros.rs stdout ----
[01:06:45] 
[01:06:45] error: htmldocck failed!
[01:06:45] status: exit code: 1
[01:06:45] command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/pub-use-extern-macros" "/checkout/src/test/rustdoc/pub-use-extern-macros.rs"
[01:06:45] ------------------------------------------
[01:06:45] 
[01:06:45] ------------------------------------------
[01:06:45] stderr:
[01:06:45] stderr:
[01:06:45] ------------------------------------------
[01:06:45] 26: @has check failed
[01:06:45]  File does not exist 'pub_use_extern_macros/macro.quux.html'
[01:06:45]  // @has pub_use_extern_macros/macro.quux.html
[01:06:45] Encountered 1 errors
[01:06:45] 
[01:06:45] ------------------------------------------
[01:06:45] 
[01:06:45] 
[01:06:45] thread '[rustdoc] rustdoc/pub-use-extern-macros.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[01:06:45] 
[01:06:45] 
[01:06:45] failures:
[01:06:45]     [rustdoc] rustdoc/pub-use-extern-macrosd to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:06:45] Build completed unsuccessfully in 0:23:39
[01:06:45] Makefile:58: recipe for target 'check' failed
[01:06:45] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0108d6d4
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:08c441f4:start=1529275148382355537,finish=1529275148389598456,duration=7242919
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:01c7be57
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:09a5ea1c
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

};

let source = format!("macro_rules! {} {{\n{}}}",
def.ident.name.clean(cx),
Copy link
Member

Choose a reason for hiding this comment

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

This needs to use the name passed to try_inline so that things like pub use foo::foo_macro as bar_macro; will display bar_macro here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if this is something we need to do for other imports. None of them are using the imported name either, and IIRC we have other issues regarding imported structs using the wrong name in impl pages.

Copy link
Member

Choose a reason for hiding this comment

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

I believe that's a different issue. The difference with macros is that the definition is being rendered here rather than in render.rs like all other item types.

@pietroalbini
Copy link
Member

r? @ollie27 (also, review ping!)

@ollie27
Copy link
Member

ollie27 commented Jun 25, 2018

r=me with a test for the renamed case.

@QuietMisdreavus
Copy link
Member Author

@ollie27 Sorry for the delay; I've pushed a commit which updates the test.

@ollie27
Copy link
Member

ollie27 commented Jul 4, 2018

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 4, 2018

📌 Commit 61dc03c has been approved by ollie27

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 4, 2018
@bors
Copy link
Contributor

bors commented Jul 4, 2018

⌛ Testing commit 61dc03c with merge 4af9132...

bors added a commit that referenced this pull request Jul 4, 2018
rustdoc: import cross-crate macros alongside everything else

The thrilling conclusion of the cross-crate macro saga in rustdoc! After #51425 made sure we saw all the namespaces of an import (and prevented us from losing the `vec!` macro in std's documentation), here is the PR to handle cross-crate macro re-exports at the same time as everything else. This way, attributes like `#[doc(hidden)]` and `#[doc(no_inline)]` can be used to control how the documentation for these macros is seen, rather than rustdoc inlining every macro every time.

Fixes #50647
@bors
Copy link
Contributor

bors commented Jul 4, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: ollie27
Pushing 4af9132 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants