Skip to content

Commit 1f108fe

Browse files
committed
Update lint-docs to default to Rust 2024
This updates the lint-docs tool to default to the 2024 edition. The lint docs are supposed to illustrate the code with the latest edition, and I just forgot to update this in #133349. Some docs needed to add the `edition` attribute since they were assuming a particular edition, but were missing the explicit annotation.
1 parent 8608a3f commit 1f108fe

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

compiler/rustc_lint/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ declare_lint! {
948948
///
949949
/// ### Example
950950
///
951-
/// ```rust,compile_fail
951+
/// ```rust,compile_fail,edition2021
952952
/// #[no_mangle]
953953
/// const FOO: i32 = 5;
954954
/// ```

compiler/rustc_lint/src/impl_trait_overcaptures.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ declare_lint! {
4141
///
4242
/// ### Example
4343
///
44-
/// ```rust,compile_fail
44+
/// ```rust,compile_fail,edition2021
4545
/// # #![deny(impl_trait_overcaptures)]
4646
/// # use std::fmt::Display;
4747
/// let mut x = vec![];

compiler/rustc_lint_defs/src/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ declare_lint! {
14241424
///
14251425
/// ### Example
14261426
///
1427-
/// ```rust,compile_fail
1427+
/// ```rust,compile_fail,edition2021
14281428
/// macro_rules! foo {
14291429
/// () => {};
14301430
/// ($name) => { };
@@ -4128,7 +4128,7 @@ declare_lint! {
41284128
///
41294129
/// ### Example
41304130
///
4131-
/// ```rust,compile_fail
4131+
/// ```rust,compile_fail,edition2021
41324132
/// #![deny(dependency_on_unit_never_type_fallback)]
41334133
/// fn main() {
41344134
/// if true {

src/tools/lint-docs/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ impl<'a> LintExtractor<'a> {
449449
.filter_map(|opt| opt.strip_prefix("edition"))
450450
.next()
451451
// defaults to latest edition
452-
.unwrap_or("2021");
452+
.unwrap_or("2024");
453453
cmd.arg(format!("--edition={edition}"));
454454
// Just in case this is an unstable edition.
455455
cmd.arg("-Zunstable-options");

0 commit comments

Comments
 (0)