Skip to content

Add regression test for #137857 to ensure that we generate intra doc links for extern crate items. #142367

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

Merged
merged 1 commit into from
Jun 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions tests/rustdoc/intra-doc/deps.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Checks that links to crates are correctly generated and only existing crates
// have a link generated.
// Regression test for <https://github.com/rust-lang/rust/issues/137857>.

//@ compile-flags: --document-private-items -Z unstable-options
//@ compile-flags: --extern-html-root-url=empty=https://empty.example/
// This one is to ensure that we don't link to any item we see which has
// an external html root URL unless it actually exists.
//@ compile-flags: --extern-html-root-url=non_existant=https://non-existant.example/
//@ aux-build: empty.rs

#![crate_name = "foo"]
#![expect(rustdoc::broken_intra_doc_links)]

//@ has 'foo/index.html'
//@ has - '//a[@href="https://empty.example/empty/index.html"]' 'empty'
// There should only be one intra doc links, we should not link `non_existant`.
//@ count - '//*[@class="docblock"]//a' 1
//! [`empty`]
//!
//! [`non_existant`]

extern crate empty;
Loading