Skip to content

Commit 1c6b2d4

Browse files
Add regression test for #137857 to ensure that we generate intra doc links for extern crate items.
1 parent 015c777 commit 1c6b2d4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/rustdoc/intra-doc/deps.rs

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

0 commit comments

Comments
 (0)