Skip to content

fix rustc_lint_defs doctest issues - #161880

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
RalfJung:rustc_lint_defs-doctests
Aug 29, 2026
Merged

fix rustc_lint_defs doctest issues#161880
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
RalfJung:rustc_lint_defs-doctests

Conversation

@RalfJung

@RalfJung RalfJung commented Aug 27, 2026

Copy link
Copy Markdown
Member

Some of these doctests should fail, but due to various complications they accidentally pass when executed in "merged" rustdoc mode. Mark them as fail, which leads to them being run as separate doctests, and then they behave as expected.

See Zulip for the journey of discovery that led to this. ;)

@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 Aug 27, 2026
@rustbot

rustbot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 18 candidates

@RalfJung RalfJung changed the title Rustc lint defs doctests fix rustc_lint_defs doctest issues Aug 27, 2026
@RalfJung
RalfJung force-pushed the rustc_lint_defs-doctests branch 2 times, most recently from 24fdac6 to af5a8af Compare August 27, 2026 18:59
Comment thread compiler/rustc_lint_defs/src/lib.rs Outdated
@RalfJung
RalfJung force-pushed the rustc_lint_defs-doctests branch from af5a8af to 5333d84 Compare August 27, 2026 19:19
/// ```rust,compile_fail
/// #![deny(warnings)]
/// fn foo() {}
/// struct non_standard_name;

@RalfJung RalfJung Aug 27, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I changed which warning we trigger because rustdoc can inject both allow(unused) and allow(non_snake_case) depending on circumstances, making them not reliable examples here.

View changes since the review

@RalfJung
RalfJung force-pushed the rustc_lint_defs-doctests branch from 5333d84 to a0ec511 Compare August 27, 2026 19:25

@JonathanBrouwer JonathanBrouwer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rust-bors

rust-bors Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a0ec511 has been approved by JonathanBrouwer

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 Aug 28, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
… r=JonathanBrouwer

fix rustc_lint_defs doctest issues

Some of these doctests should fail, but due to various complications they accidentally pass when executed in "merged" rustdoc mode. Mark them as fail, which leads to them being run as separate doctests, and then they behave as expected.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Strange.20behavior.20for.20rustc_builtin_lints.20doctests/with/619604902) for the journey of discovery that led to this. ;)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
… r=JonathanBrouwer

fix rustc_lint_defs doctest issues

Some of these doctests should fail, but due to various complications they accidentally pass when executed in "merged" rustdoc mode. Mark them as fail, which leads to them being run as separate doctests, and then they behave as expected.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Strange.20behavior.20for.20rustc_builtin_lints.20doctests/with/619604902) for the journey of discovery that led to this. ;)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
… r=JonathanBrouwer

fix rustc_lint_defs doctest issues

Some of these doctests should fail, but due to various complications they accidentally pass when executed in "merged" rustdoc mode. Mark them as fail, which leads to them being run as separate doctests, and then they behave as expected.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Strange.20behavior.20for.20rustc_builtin_lints.20doctests/with/619604902) for the journey of discovery that led to this. ;)
rust-bors Bot pushed a commit that referenced this pull request Aug 28, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #160170 (Refactored docs for `std::fs::set_permissions_nofollow` + fix BSD-based systems to use fchmodat with AT_SYMLINK_NOFOLLOW flag)
 - #160594 (attach global target features to module-level assembly)
 - #161858 (fix ICE in generic_const_parameter_types with inherents)
 - #161353 (Add test for parallel compiler reproducible build)
 - #161377 ([bootstrap] Don't reverse the order of dylib search path entries)
 - #161804 (Document PartialOrd behavior for Option<T> where T: PartialOrd)
 - #161865 (loongarch: support passing `u128`/`i128` to inline assembly)
 - #161877 (Do not load macro metadata for local definitions in rustdoc)
 - #161880 (fix rustc_lint_defs doctest issues)
 - #161883 (better deal with internal features being injected into doctests)
 - #161887 (std: uefi: fix File::seek returning the EOF sentinel)
 - #161897 (Reject contract attributes without arguments)
 - #161909 (Report the configured Polonius default in -Z help)
 - #161910 (Add rustdoc-html regression test for generated macro)
 - #161914 (Retroactively add relnotes for `bool::{ok_or,ok_or_else}` (1.98.0))
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
… r=JonathanBrouwer

fix rustc_lint_defs doctest issues

Some of these doctests should fail, but due to various complications they accidentally pass when executed in "merged" rustdoc mode. Mark them as fail, which leads to them being run as separate doctests, and then they behave as expected.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Strange.20behavior.20for.20rustc_builtin_lints.20doctests/with/619604902) for the journey of discovery that led to this. ;)
rust-bors Bot pushed a commit that referenced this pull request Aug 28, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #160170 (Refactored docs for `std::fs::set_permissions_nofollow` + fix BSD-based systems to use fchmodat with AT_SYMLINK_NOFOLLOW flag)
 - #161945 (std: optimise IO error formatting)
 - #160594 (attach global target features to module-level assembly)
 - #161577 (implement [u8]::split_ascii_whitespace)
 - #161858 (fix ICE in generic_const_parameter_types with inherents)
 - #161377 ([bootstrap] Don't reverse the order of dylib search path entries)
 - #161804 (Document PartialOrd behavior for Option<T> where T: PartialOrd)
 - #161865 (loongarch: support passing `u128`/`i128` to inline assembly)
 - #161877 (Do not load macro metadata for local definitions in rustdoc)
 - #161880 (fix rustc_lint_defs doctest issues)
 - #161883 (better deal with internal features being injected into doctests)
 - #161887 (std: uefi: fix File::seek returning the EOF sentinel)
 - #161897 (Reject contract attributes without arguments)
 - #161909 (Report the configured Polonius default in -Z help)
 - #161910 (Add rustdoc-html regression test for generated macro)
 - #161914 (Retroactively add relnotes for `bool::{ok_or,ok_or_else}` (1.98.0))
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
… r=JonathanBrouwer

fix rustc_lint_defs doctest issues

Some of these doctests should fail, but due to various complications they accidentally pass when executed in "merged" rustdoc mode. Mark them as fail, which leads to them being run as separate doctests, and then they behave as expected.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Strange.20behavior.20for.20rustc_builtin_lints.20doctests/with/619604902) for the journey of discovery that led to this. ;)
rust-bors Bot pushed a commit that referenced this pull request Aug 29, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #161945 (std: optimise IO error formatting)
 - #160594 (attach global target features to module-level assembly)
 - #161577 (implement [u8]::split_ascii_whitespace)
 - #161858 (fix ICE in generic_const_parameter_types with inherents)
 - #161377 ([bootstrap] Don't reverse the order of dylib search path entries)
 - #161702 (Use `drop_guard` in some places in {core,alloc,std})
 - #161804 (Document PartialOrd behavior for Option<T> where T: PartialOrd)
 - #161865 (loongarch: support passing `u128`/`i128` to inline assembly)
 - #161877 (Do not load macro metadata for local definitions in rustdoc)
 - #161880 (fix rustc_lint_defs doctest issues)
 - #161883 (better deal with internal features being injected into doctests)
 - #161887 (std: uefi: fix File::seek returning the EOF sentinel)
 - #161897 (Reject contract attributes without arguments)
 - #161909 (Report the configured Polonius default in -Z help)
 - #161910 (Add rustdoc-html regression test for generated macro)
 - #161914 (Retroactively add relnotes for `bool::{ok_or,ok_or_else}` (1.98.0))
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 29, 2026
… r=JonathanBrouwer

fix rustc_lint_defs doctest issues

Some of these doctests should fail, but due to various complications they accidentally pass when executed in "merged" rustdoc mode. Mark them as fail, which leads to them being run as separate doctests, and then they behave as expected.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Strange.20behavior.20for.20rustc_builtin_lints.20doctests/with/619604902) for the journey of discovery that led to this. ;)
rust-bors Bot pushed a commit that referenced this pull request Aug 29, 2026
Rollup of 17 pull requests

Successful merges:

 - #161945 (std: optimise IO error formatting)
 - #160594 (attach global target features to module-level assembly)
 - #161577 (implement [u8]::split_ascii_whitespace)
 - #161858 (fix ICE in generic_const_parameter_types with inherents)
 - #161377 ([bootstrap] Don't reverse the order of dylib search path entries)
 - #161804 (Document PartialOrd behavior for Option<T> where T: PartialOrd)
 - #161865 (loongarch: support passing `u128`/`i128` to inline assembly)
 - #161877 (Do not load macro metadata for local definitions in rustdoc)
 - #161880 (fix rustc_lint_defs doctest issues)
 - #161883 (better deal with internal features being injected into doctests)
 - #161887 (std: uefi: fix File::seek returning the EOF sentinel)
 - #161897 (Reject contract attributes without arguments)
 - #161909 (Report the configured Polonius default in -Z help)
 - #161910 (Add rustdoc-html regression test for generated macro)
 - #161914 (Retroactively add relnotes for `bool::{ok_or,ok_or_else}` (1.98.0))
 - #161924 (Windows: document that `normalize_lexically` converts `/` to `\`)
 - #161927 (Change `rustc_middle/src/hooks/mod.rs` to `hooks.rs`)
rust-bors Bot pushed a commit that referenced this pull request Aug 29, 2026
Rollup of 17 pull requests

Successful merges:

 - #161945 (std: optimise IO error formatting)
 - #160594 (attach global target features to module-level assembly)
 - #161577 (implement [u8]::split_ascii_whitespace)
 - #161858 (fix ICE in generic_const_parameter_types with inherents)
 - #161377 ([bootstrap] Don't reverse the order of dylib search path entries)
 - #161804 (Document PartialOrd behavior for Option<T> where T: PartialOrd)
 - #161865 (loongarch: support passing `u128`/`i128` to inline assembly)
 - #161877 (Do not load macro metadata for local definitions in rustdoc)
 - #161880 (fix rustc_lint_defs doctest issues)
 - #161883 (better deal with internal features being injected into doctests)
 - #161887 (std: uefi: fix File::seek returning the EOF sentinel)
 - #161897 (Reject contract attributes without arguments)
 - #161909 (Report the configured Polonius default in -Z help)
 - #161910 (Add rustdoc-html regression test for generated macro)
 - #161914 (Retroactively add relnotes for `bool::{ok_or,ok_or_else}` (1.98.0))
 - #161924 (Windows: document that `normalize_lexically` converts `/` to `\`)
 - #161927 (Change `rustc_middle/src/hooks/mod.rs` to `hooks.rs`)
rust-bors Bot pushed a commit that referenced this pull request Aug 29, 2026
Rollup of 17 pull requests

Successful merges:

 - #161945 (std: optimise IO error formatting)
 - #160594 (attach global target features to module-level assembly)
 - #161577 (implement [u8]::split_ascii_whitespace)
 - #161858 (fix ICE in generic_const_parameter_types with inherents)
 - #161377 ([bootstrap] Don't reverse the order of dylib search path entries)
 - #161804 (Document PartialOrd behavior for Option<T> where T: PartialOrd)
 - #161865 (loongarch: support passing `u128`/`i128` to inline assembly)
 - #161877 (Do not load macro metadata for local definitions in rustdoc)
 - #161880 (fix rustc_lint_defs doctest issues)
 - #161883 (better deal with internal features being injected into doctests)
 - #161887 (std: uefi: fix File::seek returning the EOF sentinel)
 - #161888 (compiler: Allow safestack to be togglable via #[sanitize(safestack = "...")])
 - #161897 (Reject contract attributes without arguments)
 - #161910 (Add rustdoc-html regression test for generated macro)
 - #161914 (Retroactively add relnotes for `bool::{ok_or,ok_or_else}` (1.98.0))
 - #161924 (Windows: document that `normalize_lexically` converts `/` to `\`)
 - #161927 (Change `rustc_middle/src/hooks/mod.rs` to `hooks.rs`)
@rust-bors
rust-bors Bot merged commit 1ebcedc into rust-lang:main Aug 29, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 29, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 29, 2026
Rollup merge of #161880 - RalfJung:rustc_lint_defs-doctests, r=JonathanBrouwer

fix rustc_lint_defs doctest issues

Some of these doctests should fail, but due to various complications they accidentally pass when executed in "merged" rustdoc mode. Mark them as fail, which leads to them being run as separate doctests, and then they behave as expected.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Strange.20behavior.20for.20rustc_builtin_lints.20doctests/with/619604902) for the journey of discovery that led to this. ;)
@RalfJung
RalfJung deleted the rustc_lint_defs-doctests branch August 29, 2026 21:07
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.

4 participants