Skip to content

rustdoc: account for nested parens and split text events in bare urls lint - #162835

Merged
rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
notriddle:notriddle/parens-bare-url
Sep 21, 2026
Merged

rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
notriddle:notriddle/parens-bare-url

Conversation

@notriddle

Copy link
Copy Markdown
Contributor

Improve the rustdoc::bare_urls lint handling of underscores and parenthesis.

This re-does #162381, but it has more test cases, and it handles nesting correctly.

r? @lolbinarycat

Fixes #162345

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 16, 2026
@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Sep 16, 2026
@lolbinarycat

Copy link
Copy Markdown
Contributor

there should be a commend somewhere saying we are assuming all bare urls will have balanced parens. this is a heirustic we are using that will be correct in the vast majority of cases, not a hard and fast rule.

@lolbinarycat lolbinarycat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identified one longstanding bug, and some missing test coverage.

View changes since this review

Comment thread src/librustdoc/passes/lint/bare_urls.rs
Comment thread src/librustdoc/passes/lint/bare_urls.rs
Comment thread src/librustdoc/passes/lint/bare_urls.rs
@lolbinarycat

Copy link
Copy Markdown
Contributor

Thanks!

@bors r+

@rust-bors

rust-bors Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a83dd65 has been approved by lolbinarycat

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 20, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 21, 2026
…l, r=lolbinarycat

rustdoc: account for nested parens and split text events in bare urls lint

Improve the `rustdoc::bare_urls` lint handling of underscores and parenthesis.

This re-does rust-lang#162381, but it has more test cases, and it handles nesting correctly.

r? @lolbinarycat

Fixes rust-lang#162345
rust-bors Bot pushed a commit that referenced this pull request Sep 21, 2026
Rollup of 15 pull requests

Successful merges:

 - #161051 (When error from local macro, include macro def span)
 - #162750 (add case mapping fast paths for Latin-1)
 - #162831 (Do not continue past `rustc_resolve` when encountering duplicated items)
 - #162835 (rustdoc: account for nested parens and split text events in bare urls lint)
 - #163044 (Report runtime range endpoints for runtime values)
 - #163062 (Use x30 register name with LLVM 23+)
 - #158102 (When compiling without a specified `--edition`, emit a note)
 - #162984 (Windows: don't error if `access_mode` is set on `OpenOptions`)
 - #163005 (Avoid unreachable integer underflow check in `CStr::count_bytes()`)
 - #163019 (Prepare for the introduction of forced keywords (`k#`))
 - #163020 (Dir: fix fallback impl for remove_dir)
 - #163047 (Use verbose suggestion for `mut binding` instead of `&mut binding`)
 - #163075 (Fix ArgAttributes mismatches in ABI UI tests for LoongArch64 and RiscV64)
 - #163079 (enable `f128` from `u64`/`i64` test)
 - #163082 (Remove `TypeChecker::root_cx`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 21, 2026
…l, r=lolbinarycat

rustdoc: account for nested parens and split text events in bare urls lint

Improve the `rustdoc::bare_urls` lint handling of underscores and parenthesis.

This re-does rust-lang#162381, but it has more test cases, and it handles nesting correctly.

r? @lolbinarycat

Fixes rust-lang#162345
rust-bors Bot pushed a commit that referenced this pull request Sep 21, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #161051 (When error from local macro, include macro def span)
 - #161629 (Streamline `StateDiffCollector`)
 - #162750 (add case mapping fast paths for Latin-1)
 - #162831 (Do not continue past `rustc_resolve` when encountering duplicated items)
 - #162835 (rustdoc: account for nested parens and split text events in bare urls lint)
 - #162952 (Depend on lockfiles to prevent GC of the current session)
 - #163044 (Report runtime range endpoints for runtime values)
 - #163062 (Use x30 register name with LLVM 23+)
 - #158102 (When compiling without a specified `--edition`, emit a note)
 - #162939 (Declare multi-kind constants for MacroKinds)
 - #162984 (Windows: don't error if `access_mode` is set on `OpenOptions`)
 - #163005 (Avoid unreachable integer underflow check in `CStr::count_bytes()`)
 - #163019 (Prepare for the introduction of forced keywords (`k#`))
 - #163020 (Dir: fix fallback impl for remove_dir)
 - #163047 (Use verbose suggestion for `mut binding` instead of `&mut binding`)
 - #163075 (Fix ArgAttributes mismatches in ABI UI tests for LoongArch64 and RiscV64)
 - #163079 (enable `f128` from `u64`/`i64` test)
 - #163082 (Remove `TypeChecker::root_cx`)
rust-bors Bot pushed a commit that referenced this pull request Sep 21, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - #161051 (When error from local macro, include macro def span)
 - #161629 (Streamline `StateDiffCollector`)
 - #162750 (add case mapping fast paths for Latin-1)
 - #162831 (Do not continue past `rustc_resolve` when encountering duplicated items)
 - #162835 (rustdoc: account for nested parens and split text events in bare urls lint)
 - #162952 (Depend on lockfiles to prevent GC of the current session)
 - #163044 (Report runtime range endpoints for runtime values)
 - #163062 (Use x30 register name with LLVM 23+)
 - #163091 (miri subtree update)
 - #162939 (Declare multi-kind constants for MacroKinds)
 - #162984 (Windows: don't error if `access_mode` is set on `OpenOptions`)
 - #163005 (Avoid unreachable integer underflow check in `CStr::count_bytes()`)
 - #163019 (Prepare for the introduction of forced keywords (`k#`))
 - #163020 (Dir: fix fallback impl for remove_dir)
 - #163041 (Be more explicit on suggestion type without changing how they are rendered)
 - #163047 (Use verbose suggestion for `mut binding` instead of `&mut binding`)
 - #163075 (Fix ArgAttributes mismatches in ABI UI tests for LoongArch64 and RiscV64)
 - #163079 (enable `f128` from `u64`/`i64` test)
 - #163082 (Remove `TypeChecker::root_cx`)
@rust-bors
rust-bors Bot merged commit ff6bd7b into rust-lang:main Sep 21, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 21, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 21, 2026
Rollup merge of #162835 - notriddle:notriddle/parens-bare-url, r=lolbinarycat

rustdoc: account for nested parens and split text events in bare urls lint

Improve the `rustdoc::bare_urls` lint handling of underscores and parenthesis.

This re-does #162381, but it has more test cases, and it handles nesting correctly.

r? @lolbinarycat

Fixes #162345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustdoc::bare_urls URL detection cuts off on underscore

3 participants