about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-04-13 09:47:00 +0200
committerSamuel Tardieu <sam@rfc1149.net>2025-04-15 20:33:01 +0200
commitc7640e0f83e51f8c26452a35bab22d079af75d0a (patch)
treee3d7e12067bc7c1c142f60c65066ddf87ec97151 /tests
parentecd20250bc2f98770ecf04b7bf62e740b3a09729 (diff)
downloadrust-c7640e0f83e51f8c26452a35bab22d079af75d0a.tar.gz
rust-c7640e0f83e51f8c26452a35bab22d079af75d0a.zip
Run UI tests with edition 2024 by default
The `ui_test` crate still uses 2021 as the default edition for running
rustc-like tests. This creates an unwelcome discrepancy between
`cargo dev lint` which uses Rust 2024 by default, and running UI tests
through `compile-test`.
Diffstat (limited to 'tests')
-rw-r--r--tests/compile-test.rs2
-rw-r--r--tests/ui/checked_unwrap/simple_conditionals.stderr3
2 files changed, 3 insertions, 2 deletions
diff --git a/tests/compile-test.rs b/tests/compile-test.rs
index 0f75914335b..6d391bd622a 100644
--- a/tests/compile-test.rs
+++ b/tests/compile-test.rs
@@ -14,6 +14,7 @@ use pulldown_cmark::{Options, Parser, html};
 use serde::Deserialize;
 use test_utils::IS_RUSTC_TEST_SUITE;
 use ui_test::custom_flags::Flag;
+use ui_test::custom_flags::edition::Edition;
 use ui_test::custom_flags::rustfix::RustfixMode;
 use ui_test::spanned::Spanned;
 use ui_test::{Args, CommandBuilder, Config, Match, error_on_output_conflict, status_emitter};
@@ -156,6 +157,7 @@ impl TestContext {
             ..Config::rustc(Path::new("tests").join(test_dir))
         };
         let defaults = config.comment_defaults.base();
+        defaults.set_custom("edition", Edition("2024".into()));
         defaults.exit_status = None.into();
         if mandatory_annotations {
             defaults.require_annotations = Some(Spanned::dummy(true)).into();
diff --git a/tests/ui/checked_unwrap/simple_conditionals.stderr b/tests/ui/checked_unwrap/simple_conditionals.stderr
index c17eaef2326..bdac1e42309 100644
--- a/tests/ui/checked_unwrap/simple_conditionals.stderr
+++ b/tests/ui/checked_unwrap/simple_conditionals.stderr
@@ -244,8 +244,7 @@ LL |         if X.is_some() {
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
-   = note: `-D static-mut-refs` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(static_mut_refs)]`
+   = note: `#[deny(static_mut_refs)]` on by default
 
 error: aborting due to 26 previous errors