Skip to content

Commit 12fb8e4

Browse files
authored
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.
2 parents 0648987 + 14ed979 commit 12fb8e4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

compiler/rustc_lint/src/if_let_rescope.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ declare_lint! {
2424
/// ### Example
2525
///
2626
/// ```rust,edition2021
27-
/// #![feature(if_let_rescope)]
27+
/// #![cfg_attr(not(bootstrap), feature(if_let_rescope))] // Simplify this in bootstrap bump.
2828
/// #![warn(if_let_rescope)]
2929
/// #![allow(unused_variables)]
3030
///

compiler/rustc_lint_defs/src/builtin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,7 @@ declare_lint! {
18701870
/// ### Example
18711871
///
18721872
/// ```rust,compile_fail
1873+
/// # #[cfg_attr(bootstrap)] compile_error!(); // Remove this in bootstrap bump.
18731874
/// #![deny(elided_named_lifetimes)]
18741875
/// struct Foo;
18751876
/// impl Foo {

0 commit comments

Comments
 (0)