Skip to content

tests: Activate must_not_suspend test for MutexGuard dropped before await#154059

Open
Enselic wants to merge 1 commit intorust-lang:mainfrom
Enselic:dropped-mutex-guard
Open

tests: Activate must_not_suspend test for MutexGuard dropped before await#154059
Enselic wants to merge 1 commit intorust-lang:mainfrom
Enselic:dropped-mutex-guard

Conversation

@Enselic
Copy link
Member

@Enselic Enselic commented Mar 18, 2026

After bisect it turns out that the test passes in nightly-2023-09-24 but fails 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
   |

That leaves us with

git log e4133ba..13e6f24 --no-merges --oneline

bffb346 Make test more robust to opts.
44ac8dc Remove GeneratorWitness and rename GeneratorWitnessMIR.
855a75b Remove useless wrapper.
baa64b0 Remove dead error code.
6aa1268 Bless clippy.
d989e14 Bless mir-opt
211d2ed Bless tests.
286502c Enable drop_tracking_mir by default.
a626caa Revert duplication of tests.
ff03204 Fold lifetimes before substitution.
9450b75 Do not construct def_path_str for MustNotSuspend.
58ef3a0 diagnostics: simpler 83556 handling by bailing out
79d6853 Check types live across yields in generators too
c21867f Check that closure's by-value captures are sized
d3dea30 Point at cause of expectation of break value when possible
4ed4913 Merge ExternProviders into the general Providers struct
2ba911c Have a single struct for queries and hook
9090ed8 Fix test on targets with crt-static default
5db9a5e Update cargo
9defc97 Add tracing instrumentation, just like queries automatically add it
2157f31 Add a way to decouple the implementation and the declaration of a TyCtxt method.
d5ec9af Add test to guard against VecDeque optimization regression
3799af3 diagnostics: avoid mismatch between variance index and hir generic
34c248d compiletest: load supports-xray from target spec
64e27cb compiletest: load supported sanitizers from target spec
bc7bb3c compiletest: use builder pattern to construct Config in tests

of which 286502c (#107421) seems most likely. I can't find an existing test so let's activate the one we have.

Closes #89562 which is where the activated test comes from. The test was originally added in #89826.

Tracking issue:

…wait

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
       |
@rustbot rustbot added A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 18, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 18, 2026

r? @adwinwhite

rustbot has assigned @adwinwhite.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 15 candidates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New must_not_suspend lint triggers even when value has been moved

3 participants