From 45b22efe06630703e20de19c589299e6a592469e Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Wed, 18 Mar 2026 21:29:45 +0100 Subject: [PATCH] tests: Activate must_not_suspend test for MutexGuard dropped before await The test pass in `nightly-2023-09-24` but fail in `nightly-2023-09-23`: $ rustc +nightly-2023-09-23 --edition 2018 tests/ui/lint/must_not_suspend/mutex-guard-dropped-before-await.rs error: `MutexGuard` held across a suspend point, but should not be --> tests/ui/lint/must_not_suspend/mutex-guard-dropped-before-await.rs:13:9 | 13 | let lock = foo.lock().unwrap(); | ^^^^ ... 18 | bar().await; | ----- the value is held across this suspend point | --- src/tools/tidy/src/issues.txt | 1 - .../{issue-89562.rs => mutex-guard-dropped-before-await.rs} | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) rename tests/ui/lint/must_not_suspend/{issue-89562.rs => mutex-guard-dropped-before-await.rs} (67%) diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 668a8abf1d8bb..a9dc449afa835 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -1476,7 +1476,6 @@ ui/lint/issue-97094.rs ui/lint/issue-99387.rs ui/lint/let_underscore/issue-119696-err-on-fn.rs ui/lint/let_underscore/issue-119697-extra-let.rs -ui/lint/must_not_suspend/issue-89562.rs ui/lint/unused/issue-103320-must-use-ops.rs ui/lint/unused/issue-104397.rs ui/lint/unused/issue-105061-array-lint.rs diff --git a/tests/ui/lint/must_not_suspend/issue-89562.rs b/tests/ui/lint/must_not_suspend/mutex-guard-dropped-before-await.rs similarity index 67% rename from tests/ui/lint/must_not_suspend/issue-89562.rs rename to tests/ui/lint/must_not_suspend/mutex-guard-dropped-before-await.rs index 99a548130720f..d1c48c3c51457 100644 --- a/tests/ui/lint/must_not_suspend/issue-89562.rs +++ b/tests/ui/lint/must_not_suspend/mutex-guard-dropped-before-await.rs @@ -1,9 +1,13 @@ +//! Regression test for + //@ edition:2018 //@ run-pass +#![feature(must_not_suspend)] +#![deny(must_not_suspend)] + use std::sync::Mutex; -// Copied from the issue. Allow-by-default for now, so run-pass pub async fn foo() { let foo = Mutex::new(1); let lock = foo.lock().unwrap();