Closed
Description
#[doc = "https://rust-lang.org"]
pub fn doc_attribute() {}
/// https://rust-lang.org
pub fn doc_comment() {}
Running rustdoc
on that code produces the following output:
warning: this URL is not a hyperlink
--> issue.rs:1:9
|
1 | #[doc = "https://rust-lang.org"]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= 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 | #[doc = <"https://rust-lang.org">]
| + +
warning: this URL is not a hyperlink
--> issue.rs:4:5
|
4 | /// https://rust-lang.org
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: bare URLs are not automatically turned into clickable links
help: use an automatic link instead
|
4 | /// <https://rust-lang.org>
| + +
warning: 2 warnings emitted
The replacement suggestion is correct for the link in the doc comment, but syntactically incorrect for the one in the #[doc]
attribute - it should suggest #[doc = "<https://rust-lang.org>"]
instead.
The bug happens on both stable (rustdoc 1.84.0 (9fc6b4312 2025-01-07)
) and nightly (rustdoc 1.86.0-nightly (f3d1d47fd 2025-01-20)
).