Skip to content

rustdoc::bare_urls includes trailing . in the detected URL #159480

Closed

Description

@estebank

Code

#![deny(rustdoc::bare_urls)]
/// Visit https://example.com/docs.
//~^ ERROR this URL is not a hyperlink
pub fn documentation() {}

Current output

error: this URL is not a hyperlink
  --> $DIR/bare-url-trailing-period.rs:11:11
   |
LL | /// Visit https://example.com/docs.
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: bare URLs are not automatically turned into clickable links
note: the lint level is defined here
  --> $DIR/bare-url-trailing-period.rs:3:9
   |
LL | #![deny(rustdoc::bare_urls)]
   |         ^^^^^^^^^^^^^^^^^^
help: use an automatic link instead
   |
LL | /// Visit <https://example.com/docs.>
   |           +                         +

Desired output

error: this URL is not a hyperlink
  --> $DIR/bare-url-trailing-period.rs:11:11
   |
LL | /// Visit https://example.com/docs.
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: bare URLs are not automatically turned into clickable links
note: the lint level is defined here
  --> $DIR/bare-url-trailing-period.rs:3:9
   |
LL | #![deny(rustdoc::bare_urls)]
   |         ^^^^^^^^^^^^^^^^^^
help: use an automatic link instead
   |
LL | /// Visit <https://example.com/docs>.
   |           +                        +

Rationale and extra context

Periods are valid in URLs, but very uncommon as the last character in one. Modify the link parser to exclude trailing ..

Other cases

Rust Version

1.97

Anything else?

No response

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
    A-diagnosticsArea: Messages for errors, warnings, and lints
    P-lowLow priority
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.
    on Jul 18, 2026
  2. added a commit that references this issue on Jul 20, 2026
    a4b0989
  3. added a commit that references this issue on Jul 21, 2026
    652b5ed
  4. added a commit that references this issue on Jul 21, 2026
    47cdb93
  5. added a commit that references this issue on Jul 22, 2026
    5cd6d5f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions