Make some lint doctests compatible with --stage=0#130353
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 15, 2024
Merged
Make some lint doctests compatible with --stage=0#130353bors merged 1 commit intorust-lang:masterfrom
--stage=0#130353bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
|
rustbot has assigned @michaelwoerister. Use |
Member
Author
|
I originally did things the other way in #130345, but when splitting this off into its own PR it occurred to me that this way is nicer. |
jieyouxu
approved these changes
Sep 15, 2024
Member
jieyouxu
left a comment
There was a problem hiding this comment.
Oh right, this is indeed unfortunate...
Member
|
Thanks! |
Collaborator
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Sep 15, 2024
Make some lint doctests compatible with `--stage=0` Currently, running `x test compiler --stage=0` (with `rust.parallel-compiler=false` to avoid other problems) results in two failures, because these lint doctests aren't compatible with the current stage0 compiler. In theory, the more “correct” solution would be to wrap the opening triple-backtick line in `#[cfg_attr(not(bootstrap), doc = "..."]`. However, that causes a few practical problems: - `tidy` doesn't understand that syntax, and miscounts the number of backticks in the comment block. - `lint-docs` doesn't understand that syntax, and thinks it's trying to declare the lint name. - Working around the above problems would cause more work and more confusion for whoever does the next bootstrap beta bump. So instead this PR adds some bootstrap gates inside the individual doctests, which end up producing the desired behaviour, and are straightforward to remove.
This was referenced Sep 15, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 15, 2024
Rollup of 6 pull requests Successful merges: - rust-lang#130042 (properly handle EOF in BufReader::peek) - rust-lang#130061 (Add `NonNull` convenience methods to `Box` and `Vec`) - rust-lang#130202 (set `download-ci-llvm = true` by default on "library" and "tools" profiles) - rust-lang#130214 (MaybeUninit::zeroed: mention that padding is not zeroed) - rust-lang#130353 (Make some lint doctests compatible with `--stage=0`) - rust-lang#130370 (unstable-book: `trait_upcasting` example should not have `#![allow(incomplete_features)]`) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 15, 2024
Rollup of 6 pull requests Successful merges: - rust-lang#130042 (properly handle EOF in BufReader::peek) - rust-lang#130061 (Add `NonNull` convenience methods to `Box` and `Vec`) - rust-lang#130202 (set `download-ci-llvm = true` by default on "library" and "tools" profiles) - rust-lang#130214 (MaybeUninit::zeroed: mention that padding is not zeroed) - rust-lang#130353 (Make some lint doctests compatible with `--stage=0`) - rust-lang#130370 (unstable-book: `trait_upcasting` example should not have `#![allow(incomplete_features)]`) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 15, 2024
Rollup merge of rust-lang#130353 - Zalathar:lint-zero, r=jieyouxu Make some lint doctests compatible with `--stage=0` Currently, running `x test compiler --stage=0` (with `rust.parallel-compiler=false` to avoid other problems) results in two failures, because these lint doctests aren't compatible with the current stage0 compiler. In theory, the more “correct” solution would be to wrap the opening triple-backtick line in `#[cfg_attr(not(bootstrap), doc = "..."]`. However, that causes a few practical problems: - `tidy` doesn't understand that syntax, and miscounts the number of backticks in the comment block. - `lint-docs` doesn't understand that syntax, and thinks it's trying to declare the lint name. - Working around the above problems would cause more work and more confusion for whoever does the next bootstrap beta bump. So instead this PR adds some bootstrap gates inside the individual doctests, which end up producing the desired behaviour, and are straightforward to remove.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, running
x test compiler --stage=0(withrust.parallel-compiler=falseto avoid other problems) results in two failures, because these lint doctests aren't compatible with the current stage0 compiler.In theory, the more “correct” solution would be to wrap the opening triple-backtick line in
#[cfg_attr(not(bootstrap), doc = "..."]. However, that causes a few practical problems:tidydoesn't understand that syntax, and miscounts the number of backticks in the comment block.lint-docsdoesn't understand that syntax, and thinks it's trying to declare the lint name.So instead this PR adds some bootstrap gates inside the individual doctests, which end up producing the desired behaviour, and are straightforward to remove.