Skip to content

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

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Enselic:dropped-mutex-guard
Mar 20, 2026
Merged

tests: Activate must_not_suspend test for MutexGuard dropped before await#154059
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Enselic:dropped-mutex-guard

Conversation

@Enselic

@EnselicEnselic commented Mar 18, 2026

Copy link
Copy Markdown
Member

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 except the "inactive" one, so let's simply activate it.

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
|
@rustbotrustbot 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
Copy Markdown
Collaborator

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

@Kivooeo

Copy link
Copy Markdown
Member

r? me @bors r+ rollup

@rust-bors

rust-borsBot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 45b22ef has been approved by Kivooeo

It is now in the queue for this repository.

@rust-borsrust-borsBot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 19, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 19, 2026
…ooeo
tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`
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
<details>
<summary>git log e4133ba..13e6f24 --no-merges --oneline </summary>
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
</details>
of which 286502c (rust-lang#107421) seems most likely. I can't find an existing test except the "inactive" one, so let's simply activate it.
Closesrust-lang#89562 which is where the activated test comes from. The test was originally added in rust-lang#89826.
Tracking issue:
- rust-lang#83310
rust-borsBot pushed a commit that referenced this pull request Mar 19, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153556 (`impl` restriction lowering)
- #153992 (bootstrap: Optionally print a backtrace if a command fails)
- #154019 (two smaller feature cleanups)
- #154059 (tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`)
- #154075 (Rewrite `query_ensure_result`.)
- #154082 (Updates derive_where and removes workaround)
- #154084 (Preserve braces around `self` in use tree pretty printing)
- #154086 (Insert space after float literal ending with `.` in pretty printer)
- #154087 (Fix whitespace after fragment specifiers in macro pretty printing)
rust-borsBot pushed a commit that referenced this pull request Mar 19, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153556 (`impl` restriction lowering)
- #153992 (bootstrap: Optionally print a backtrace if a command fails)
- #154019 (two smaller feature cleanups)
- #154059 (tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`)
- #154075 (Rewrite `query_ensure_result`.)
- #154082 (Updates derive_where and removes workaround)
- #154084 (Preserve braces around `self` in use tree pretty printing)
- #154086 (Insert space after float literal ending with `.` in pretty printer)
- #154087 (Fix whitespace after fragment specifiers in macro pretty printing)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 19, 2026
…ooeo
tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`
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
<details>
<summary>git log e4133ba..13e6f24 --no-merges --oneline </summary>
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
</details>
of which 286502c (rust-lang#107421) seems most likely. I can't find an existing test except the "inactive" one, so let's simply activate it.
Closesrust-lang#89562 which is where the activated test comes from. The test was originally added in rust-lang#89826.
Tracking issue:
- rust-lang#83310
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 19, 2026
…ooeo
tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`
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
<details>
<summary>git log e4133ba..13e6f24 --no-merges --oneline </summary>
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
</details>
of which 286502c (rust-lang#107421) seems most likely. I can't find an existing test except the "inactive" one, so let's simply activate it.
Closesrust-lang#89562 which is where the activated test comes from. The test was originally added in rust-lang#89826.
Tracking issue:
- rust-lang#83310
rust-borsBot pushed a commit that referenced this pull request Mar 20, 2026
…uwer
Rollup of 12 pull requests
Successful merges:
- #152909 (sess: `-Zbranch-protection` is a target modifier)
- #153556 (`impl` restriction lowering)
- #154048 (Don't emit rustdoc `missing_doc_code_examples` lint on impl items)
- #153992 (bootstrap: Optionally print a backtrace if a command fails)
- #154019 (two smaller feature cleanups)
- #154059 (tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`)
- #154075 (Rewrite `query_ensure_result`.)
- #154082 (Updates derive_where and removes workaround)
- #154084 (Preserve braces around `self` in use tree pretty printing)
- #154086 (Insert space after float literal ending with `.` in pretty printer)
- #154087 (Fix whitespace after fragment specifiers in macro pretty printing)
- #154109 (tests: Add regression test for async closures involving HRTBs)
@ZalatharZalathar mentioned this pull request Mar 20, 2026
rust-borsBot pushed a commit that referenced this pull request Mar 20, 2026
Rollup of 15 pull requests
Successful merges:
- #152909 (sess: `-Zbranch-protection` is a target modifier)
- #153556 (`impl` restriction lowering)
- #154048 (Don't emit rustdoc `missing_doc_code_examples` lint on impl items)
- #150935 (Introduce #[diagnostic::on_move(message)])
- #152973 (remove -Csoft-float)
- #153862 (Rename `cycle_check` to `find_cycle`)
- #153992 (bootstrap: Optionally print a backtrace if a command fails)
- #154019 (two smaller feature cleanups)
- #154059 (tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`)
- #154075 (Rewrite `query_ensure_result`.)
- #154082 (Updates derive_where and removes workaround)
- #154084 (Preserve braces around `self` in use tree pretty printing)
- #154086 (Insert space after float literal ending with `.` in pretty printer)
- #154087 (Fix whitespace after fragment specifiers in macro pretty printing)
- #154109 (tests: Add regression test for async closures involving HRTBs)
@rust-bors
rust-borsBot merged commit a194bea into rust-lang:mainMar 20, 2026
11 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Mar 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tidyArea: The tidy toolS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant 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

4 participants

@Enselic@rustbot@Kivooeo@adwinwhite