Skip to content

Improve handling of rustdoc lints when used with raw doc fragments. #136400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025

Conversation

lolbinarycat
Copy link
Contributor

  1. rustdoc::bare_urls no longer outputs incoherent suggestions if source_span_for_markdown_range returns None, instead outputting no suggestion
  2. source_span_for_markdown_range has one more heuristic, so it will return None less often.
  3. add ui test to make sure we don't emit nonsense suggestions.

fixes #135851

@rustbot
Copy link
Collaborator

rustbot commented Feb 1, 2025

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Feb 1, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-link-lint-135851 branch from a9a435b to c6d7696 Compare February 3, 2025 19:23
@lolbinarycat
Copy link
Contributor Author

@fmease what module do you want me to move source_span_to_markdown_range into, or should that be left for a followup PR?

@lolbinarycat
Copy link
Contributor Author

@fmease reminder to look at this.

@lolbinarycat
Copy link
Contributor Author

@fmease it's been a week, are you going to get to this, or should I reroll reviewers?

@fmease fmease closed this Apr 2, 2025
@fmease fmease reopened this Apr 2, 2025
@fmease
Copy link
Member

fmease commented Apr 2, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 2, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 2, 2025
…1, r=<try>

Improve handling of rustdoc lints when used with raw doc fragments.

1. `rustdoc::bare_urls` no longer outputs incoherent suggestions if `source_span_for_markdown_range` returns None, instead outputting no suggestion
2. `source_span_for_markdown_range` has one more heuristic, so it will return `None` less often.
3. add ui test to make sure we don't emit nonsense suggestions.

fixes rust-lang#135851
@bors
Copy link
Collaborator

bors commented Apr 2, 2025

⌛ Trying commit c6d7696 with merge 75eefd1...

@bors
Copy link
Collaborator

bors commented Apr 2, 2025

☀️ Try build successful - checks-actions
Build commit: 75eefd1 (75eefd14476b7cd550f9b8b82f8fccfa949bf30e)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (75eefd1): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary -4.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.0% [-5.0%, -3.0%] 2
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 776.227s -> 775.389s (-0.11%)
Artifact size: 365.99 MiB -> 365.98 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 2, 2025
@lolbinarycat
Copy link
Contributor Author

@fmease all recommended changes added

Copy link
Member

@GuillaumeGomez GuillaumeGomez left a comment

Choose a reason for hiding this comment

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

Code logic is good, just some nits and then it's good to go.

@lolbinarycat lolbinarycat force-pushed the rustdoc-link-lint-135851 branch from fe5bccb to 0d3d650 Compare May 16, 2025 08:38
@lolbinarycat
Copy link
Contributor Author

Addressed all nits and squashed commits! @GuillaumeGomez @fmease

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-link-lint-135851 branch from 0d3d650 to ec390f0 Compare May 16, 2025 09:48
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-link-lint-135851 branch from ec390f0 to dce6e86 Compare May 21, 2025 14:52
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-link-lint-135851 branch from dce6e86 to c83a7b1 Compare May 21, 2025 16:04
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the rustdoc-link-lint-135851 branch 2 times, most recently from 52a0e28 to 314ac89 Compare May 22, 2025 17:06
@rust-log-analyzer

This comment has been minimized.

1. rustdoc::bare_urls doesn't output
   invalid suggestions if source_span_for_markdown_range
   fails to find a span

2. source_span_for_markdown_range tries harder to
   return a span by applying an additional diagnostic

fixes rust-lang#135851
@lolbinarycat lolbinarycat force-pushed the rustdoc-link-lint-135851 branch from 314ac89 to 3005a09 Compare May 22, 2025 17:31
@fmease fmease assigned GuillaumeGomez and unassigned fmease May 22, 2025
@GuillaumeGomez
Copy link
Member

Looks all good to me. This is a very nice improvement, thanks!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 22, 2025

📌 Commit 3005a09 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors bors 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 May 22, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 23, 2025
…851, r=GuillaumeGomez

Improve handling of rustdoc lints when used with raw doc fragments.

1. `rustdoc::bare_urls` no longer outputs incoherent suggestions if `source_span_for_markdown_range` returns None, instead outputting no suggestion
2. `source_span_for_markdown_range` has one more heuristic, so it will return `None` less often.
3. add ui test to make sure we don't emit nonsense suggestions.

fixes rust-lang#135851
bors added a commit to rust-lang-ci/rust that referenced this pull request May 23, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#136400 (Improve handling of rustdoc lints when used with raw doc fragments.)
 - rust-lang#140967 (Async drop poll shim for error dropee generates noop body)
 - rust-lang#141019 (Update std doctests for android)
 - rust-lang#141062 (Update IDEs to use rustfmt 2024, fix Zed settings)
 - rust-lang#141109 (discuss deadlocks in the std::io::pipe() example)
 - rust-lang#141126 (rustdoc JSON: Don't apply `#[repr]` privacy heuristics)
 - rust-lang#141376 (Rename `kw::Empty` as `sym::empty`.)
 - rust-lang#141383 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request May 23, 2025
Rollup of 7 pull requests

Successful merges:

 - #136400 (Improve handling of rustdoc lints when used with raw doc fragments.)
 - #140967 (Async drop poll shim for error dropee generates noop body)
 - #141019 (Update std doctests for android)
 - #141109 (discuss deadlocks in the std::io::pipe() example)
 - #141126 (rustdoc JSON: Don't apply `#[repr]` privacy heuristics)
 - #141376 (Rename `kw::Empty` as `sym::empty`.)
 - #141383 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1c2ea28 into rust-lang:master May 23, 2025
6 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 23, 2025
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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's automatic link suggestion is syntactically invalid when the link is in a #[doc] attribute
8 participants