Rollup merge of #140348 - ehuss:lint-docs-edition, r=compiler-errors

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 https://github.com/rust-lang/rust/pull/133349.

Some docs needed to add the `edition` attribute since they were assuming a particular edition, but were missing the explicit annotation.

This also includes a commit to simplify the edition handling in lint-docs.
This commit is contained in:
Matthias Krüger
2025-04-27 16:09:00 +02:00
committed by GitHub
4 changed files with 12 additions and 18 deletions

View File

@@ -948,7 +948,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust,compile_fail
/// ```rust,compile_fail,edition2021
/// #[no_mangle]
/// const FOO: i32 = 5;
/// ```

View File

@@ -41,7 +41,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust,compile_fail
/// ```rust,compile_fail,edition2021
/// # #![deny(impl_trait_overcaptures)]
/// # use std::fmt::Display;
/// let mut x = vec![];

View File

@@ -1424,7 +1424,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust,compile_fail
/// ```rust,compile_fail,edition2021
/// macro_rules! foo {
/// () => {};
/// ($name) => { };
@@ -4128,7 +4128,7 @@ declare_lint! {
///
/// ### Example
///
/// ```rust,compile_fail
/// ```rust,compile_fail,edition2021
/// #![deny(dependency_on_unit_never_type_fallback)]
/// fn main() {
/// if true {