Skip to content

Commit 434805f

Browse files
authored
Unrolled build for #142367
Rollup merge of #142367 - GuillaumeGomez:extern-crate-items-intra-doc, r=lolbinarycat Add regression test for #137857 to ensure that we generate intra doc links for extern crate items. Fixes #137857. I checked that linking to extern crates was generating valid links (with the `/index.html` part) and since it's already working, just adding a regression test. r? `@notriddle`
2 parents dddd7ab + 1052ddd commit 434805f

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 to any item we see which has
8+
// an external html root URL unless it actually exists.
9+
//@ compile-flags: --extern-html-root-url=non_existant=https://non-existant.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_existant`.
18+
//@ count - '//*[@class="docblock"]//a' 1
19+
//! [`empty`]
20+
//!
21+
//! [`non_existant`]
22+
23+
extern crate empty;

0 commit comments

Comments
 (0)