diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2024-09-15 12:14:57 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-15 12:14:57 +1000 |
| commit | 12fb8e45c22aa25b106c489174759cc19888f436 (patch) | |
| tree | 1dbb477fa362e6c4a6fb2127583bfab8b85eb104 | |
| parent | 06489875329e5c9ee646f939bbda8c5e62646a16 (diff) | |
| parent | 14ed979cdfda34c468e0abaad9e3c981205a7bac (diff) | |
| download | rust-12fb8e45c22aa25b106c489174759cc19888f436.tar.gz rust-12fb8e45c22aa25b106c489174759cc19888f436.zip | |
Rollup merge of #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.
| -rw-r--r-- | compiler/rustc_lint/src/if_let_rescope.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_lint_defs/src/builtin.rs | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/if_let_rescope.rs b/compiler/rustc_lint/src/if_let_rescope.rs index 5b65541bea6..7138d40a48f 100644 --- a/compiler/rustc_lint/src/if_let_rescope.rs +++ b/compiler/rustc_lint/src/if_let_rescope.rs @@ -24,7 +24,7 @@ declare_lint! { /// ### Example /// /// ```rust,edition2021 - /// #![feature(if_let_rescope)] + /// #![cfg_attr(not(bootstrap), feature(if_let_rescope))] // Simplify this in bootstrap bump. /// #![warn(if_let_rescope)] /// #![allow(unused_variables)] /// diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index f42f35c594b..9b6d63c2ef4 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -1870,6 +1870,7 @@ declare_lint! { /// ### Example /// /// ```rust,compile_fail + /// # #[cfg_attr(bootstrap)] compile_error!(); // Remove this in bootstrap bump. /// #![deny(elided_named_lifetimes)] /// struct Foo; /// impl Foo { |
