Skip to content

Commit 7b345fa

Browse files
Add regression test for #137857 to ensure that we generate intra doc links for extern crate items.
1 parent 40daf23 commit 7b345fa

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/rustdoc/intra-doc/deps.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Checks that the link generated
2+
// Regression test for <https://github.com/rust-lang/rust/issues/137857>.
3+
4+
//@ compile-flags: --document-private-items -Z unstable-options
5+
//@ compile-flags: --extern-html-root-url=empty=https://docs.rs/
6+
// This one is to ensure that we don't link "by default" any item we see which has
7+
// an external html root URL.
8+
//@ compile-flags: --extern-html-root-url=non_existent=https://docs.rs/
9+
//@ aux-build: empty.rs
10+
11+
#![crate_name = "foo"]
12+
#![allow(rustdoc::broken_intra_doc_links)]
13+
14+
//@ has 'foo/index.html'
15+
//@ has - '//a[@href="https://docs.rs/empty/index.html"]' 'empty'
16+
// There should only be one intra doc links, we should not link `non_existent`.
17+
//@ count - '//*[@class="docblock"]//a' 1
18+
//! [`empty`]
19+
//!
20+
//! [`non_existent`]
21+
22+
extern crate empty;

0 commit comments

Comments
 (0)