`rustdoc::bare_urls` URL detection cuts off on underscore
Open
Nobody has claimed this yet.
A-diagnostics
A-suggestion-diagnostics
D-invalid-suggestion
T-rustdoc
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried
/// See https://en.wikipedia.org/wiki/Rust_(programming_language)
fn main() {
println!("Hello, world!");
}
and then ran cargo doc:
root@7db9afd9db3d:/rust/tests/rustdoc-demo# cargo doc
warning: this URL is not a hyperlink
--> src/main.rs:1:9
|
1 | /// See https://en.wikipedia.org/wiki/Rust_(programming_language)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: bare URLs are not automatically turned into clickable links
= note: `#[warn(rustdoc::bare_urls)]` on by default
help: use an automatic link instead
|
1 | /// See <https://en.wikipedia.org/wiki/Rust>_(programming_language)
| + +
warning: `rustdoc-demo` (bin "rustdoc-demo" doc) generated 1 warning (run `cargo fix --bin "rustdoc-demo" -p rustdoc-demo` to apply 1 suggestion)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.18s
Generated /rust/tests/rustdoc-demo/target/doc/rustdoc_demo/index.html
expected output:
root@7db9afd9db3d:/rust/tests/rustdoc-demo# cargo doc
warning: this URL is not a hyperlink
--> src/main.rs:1:9
|
1 | /// See https://en.wikipedia.org/wiki/Rust_(programming_language)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: bare URLs are not automatically turned into clickable links
= note: `#[warn(rustdoc::bare_urls)]` on by default
help: use an automatic link instead
|
1 | /// See <https://en.wikipedia.org/wiki/Rust_(programming_language)>
| + +
warning: `rustdoc-demo` (bin "rustdoc-demo" doc) generated 1 warning (run `cargo fix --bin "rustdoc-demo" -p rustdoc-demo` to apply 1 suggestion)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.18s
Generated /rust/tests/rustdoc-demo/target/doc/rustdoc_demo/index.html
versions:
- cargo 1.98.1 (797e8a9bc 2026-08-05)
- rustc 1.98.1 (48a229cea 2026-09-01)
- rustdoc 1.98.1 (48a229cea 2026-09-01)
@rustbot label T-rustdoc A-diagnostics A-suggestion-diagnostics D-invalid-suggestion
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported rustdoc::bare_urls warning with the Rust example and cargo doc, then trace URL detection and the automatic-link suggestion. Done means the warning span and suggested https://en.wikipedia.org/wiki/Rust_(programming_language) include the full URL through the closing parenthesis.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100