Skip to content

rustdoc: Revert "fix bare urls split text" - #162779

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lolbinarycat:rustdoc-revert-regex
Sep 15, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lolbinarycat:rustdoc-revert-regex

Conversation

@lolbinarycat

Copy link
Copy Markdown
Contributor

This reverts commit d4e6b8f.

Reverted commit contains incorrect comments,
does not implement all the functionality it claims to, and lacks test coverage.

If someone wishes to re-add the functionality, it should be done as postprocessing after the regex match, as regex is not capable of handling arbitrary nesting of matched pairs. Additionally, future PRs attempting to reinstate this should frame it as a change to a fuzzy heuristic, not as a simple "fix".

r? @GuillaumeGomez

This reverts commit d4e6b8f.

Reverted commit contains incorrect comments,
does not implement all the functionality it claims to,
and lacks test coverage.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 14, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member

It was merged in #162381.

cc @notriddle so you're aware of this.

Thanks for noticing this issue @lolbinarycat !

@GuillaumeGomez

Copy link
Copy Markdown
Member

r=me once CI pass

@notriddle

Copy link
Copy Markdown
Contributor

incorrect comments

Which comments? This one?

    // pulldown-cmark can split a URL into multiple `Text` events while processing
    // characters such as `_` according to CommonMark's emphasis rules.
    // `TextMergeWithOffset` merges these events so we can check the complete URL.
That comment is true.

Given the URL from the test case, we can see it happen with the pulldown-cmark CLI. That's why the lint emits a bad suggestion in #162345

$ git clone https://github.com/pulldown-cmark/pulldown-cmark.git
$ cd pulldown-cmark
$ cargo run --release -- --events
https://en.wikipedia.org/wiki/Rust_(programming_language)
^D
0..58: Start(Paragraph)
0..34: Text(Borrowed("https://en.wikipedia.org/wiki/Rust"))
34..35: Text(Borrowed("_"))
35..57: Text(Borrowed("(programming_language)"))
0..58: End(Paragraph)
EOF

Or are you talking about this one?

        // Match URL characters and balanced parenthesized segments, without
        // consuming a trailing `)` that belongs to the surrounding prose.

That one is a bit confusing. The parens are balanced, since the regex won't match a lone paren, but they can't be nested, because regex can't represent recursive grammars.

It does, indeed, correctly handle a trailing ) that belongs to surrounding prose.

regex is not capable of handling arbitrary nesting of matched pairs

I knew that the improved regex only handled a single pair of nested parens. I also know that multiple levels of nesting are rare, and Wikipedia article URLs are common.

@notriddle

Copy link
Copy Markdown
Contributor

In any case, if you would prefer a version of this code that handles nested parens, I can write it. I'll also add more test cases.

@notriddle notriddle closed this Sep 14, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 14, 2026
@notriddle notriddle reopened this Sep 14, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 14, 2026
@notriddle

notriddle commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@bors r=GuillaumeGomez,notriddle

Sorry about closing the PR. Wrong button.

@rust-bors

rust-bors Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 711a32b has been approved by GuillaumeGomez,notriddle

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 14, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 15, 2026
… r=GuillaumeGomez,notriddle

rustdoc: Revert "fix bare urls split text"

This reverts commit d4e6b8f.

Reverted commit contains incorrect comments,
does not implement all the functionality it claims to, and lacks test coverage.

If someone wishes to re-add the functionality, it should be done as postprocessing after the regex match, as regex is not capable of handling arbitrary nesting of matched pairs.  Additionally, future PRs attempting to reinstate this should frame it as a change to a fuzzy heuristic, not as a simple "fix".

r? @GuillaumeGomez
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
Rollup of 7 pull requests

Successful merges:

 - #160911 (Remove d32 feature from 32-bit Arm targets)
 - #162771 (Filter do_not_recommend impls before handling a single candidate)
 - #162779 (rustdoc: Revert "fix bare urls split text")
 - #161612 (std: make a lot of items crate private)
 - #162372 (Clean up `test/rustdoc-html` folder by moving tests where appropriate)
 - #162643 (Fix `path_trailing_sep` methods for Windows verbatim paths)
 - #162784 (AGENTS.md: Permit local experimentation, per the online policy.)
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 15, 2026
… r=GuillaumeGomez,notriddle

rustdoc: Revert "fix bare urls split text"

This reverts commit d4e6b8f.

Reverted commit contains incorrect comments,
does not implement all the functionality it claims to, and lacks test coverage.

If someone wishes to re-add the functionality, it should be done as postprocessing after the regex match, as regex is not capable of handling arbitrary nesting of matched pairs.  Additionally, future PRs attempting to reinstate this should frame it as a change to a fuzzy heuristic, not as a simple "fix".

r? @GuillaumeGomez
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
Rollup of 10 pull requests

Successful merges:

 - #160911 (Remove d32 feature from 32-bit Arm targets)
 - #162771 (Filter do_not_recommend impls before handling a single candidate)
 - #162779 (rustdoc: Revert "fix bare urls split text")
 - #161548 (hir_typeck: Don't ICE on closures without drop location in closure capture lint)
 - #161612 (std: make a lot of items crate private)
 - #162204 (Suggest keyword order for `extern "C" const unsafe fn`)
 - #162372 (Clean up `test/rustdoc-html` folder by moving tests where appropriate)
 - #162638 (dont suggest changing the mutability of a borrow that comes from a macro)
 - #162643 (Fix `path_trailing_sep` methods for Windows verbatim paths)
 - #162784 (AGENTS.md: Permit local experimentation, per the online policy.)
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
Rollup of 10 pull requests

Successful merges:

 - #160911 (Remove d32 feature from 32-bit Arm targets)
 - #162771 (Filter do_not_recommend impls before handling a single candidate)
 - #162779 (rustdoc: Revert "fix bare urls split text")
 - #161548 (hir_typeck: Don't ICE on closures without drop location in closure capture lint)
 - #161612 (std: make a lot of items crate private)
 - #162204 (Suggest keyword order for `extern "C" const unsafe fn`)
 - #162372 (Clean up `test/rustdoc-html` folder by moving tests where appropriate)
 - #162638 (dont suggest changing the mutability of a borrow that comes from a macro)
 - #162643 (Fix `path_trailing_sep` methods for Windows verbatim paths)
 - #162784 (AGENTS.md: Permit local experimentation, per the online policy.)
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #160911 (Remove d32 feature from 32-bit Arm targets)
 - #161868 (libtest: never iterate over all tests in `--exact` mode)
 - #162771 (Filter do_not_recommend impls before handling a single candidate)
 - #162779 (rustdoc: Revert "fix bare urls split text")
 - #161548 (hir_typeck: Don't ICE on closures without drop location in closure capture lint)
 - #161612 (std: make a lot of items crate private)
 - #162204 (Suggest keyword order for `extern "C" const unsafe fn`)
 - #162372 (Clean up `test/rustdoc-html` folder by moving tests where appropriate)
 - #162638 (dont suggest changing the mutability of a borrow that comes from a macro)
 - #162643 (Fix `path_trailing_sep` methods for Windows verbatim paths)
 - #162654 (Improve Armv7-R documentation)
 - #162784 (AGENTS.md: Permit local experimentation, per the online policy.)
@GuillaumeGomez

Copy link
Copy Markdown
Member

In any case, if you would prefer a version of this code that handles nested parens, I can write it. I'll also add more test cases.

Personally I'd love to. Although not sure if regex is the right path for this. In any case, I trust your judgement, can't wait to see the improved version. =D

@rust-bors
rust-bors Bot merged commit 257f165 into rust-lang:main Sep 15, 2026
26 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 15, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
Rollup merge of #162779 - lolbinarycat:rustdoc-revert-regex, r=GuillaumeGomez,notriddle

rustdoc: Revert "fix bare urls split text"

This reverts commit d4e6b8f.

Reverted commit contains incorrect comments,
does not implement all the functionality it claims to, and lacks test coverage.

If someone wishes to re-add the functionality, it should be done as postprocessing after the regex match, as regex is not capable of handling arbitrary nesting of matched pairs.  Additionally, future PRs attempting to reinstate this should frame it as a change to a fuzzy heuristic, not as a simple "fix".

r? @GuillaumeGomez
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.

4 participants