You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #8419 - flip1995:await_parking_alot, r=llogiq
Fix `await_holding_lock` not linting `parking_lot` Mutex/RwLock
This adds tests for `RwLock` and `parking_lot::{Mutex, RwLock}`, which were added before in 2dc8c08, but never tested in UI tests. I noticed this while reading [fasterthanli.me](https://fasterthanli.me/articles/a-rust-match-made-in-hell) latest blog post, complaining that Clippy doesn't catch this for `parking_lot`. (Too many people read his blog, he's too powerful)
Some more things:
- Adds a test for #6446
- Improves the lint message
changelog: [`await_holding_lock`]: Now also lints for `parking_lot::{Mutex, RwLock}`
"this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await",
126
-
ty_cause.scope_span.or(Some(span)),
127
-
"these are all the await points this lock is held through",
157
+
"this `MutexGuard` is held across an `await` point",
158
+
|diag| {
159
+
diag.help(
160
+
"consider using an async-aware `Mutex` type or ensuring the \
161
+
`MutexGuard` is dropped before calling await",
162
+
);
163
+
diag.span_note(
164
+
ty_cause.scope_span.unwrap_or(span),
165
+
"these are all the `await` points this lock is held through",
166
+
);
167
+
},
128
168
);
129
169
}
130
170
ifis_refcell_ref(cx, adt.did){
131
-
span_lint_and_note(
171
+
span_lint_and_then(
132
172
cx,
133
173
AWAIT_HOLDING_REFCELL_REF,
134
174
ty_cause.span,
135
-
"this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await",
136
-
ty_cause.scope_span.or(Some(span)),
137
-
"these are all the await points this ref is held through",
175
+
"this `RefCell` reference is held across an `await` point",
176
+
|diag| {
177
+
diag.help("ensure the reference is dropped before calling `await`");
178
+
diag.span_note(
179
+
ty_cause.scope_span.unwrap_or(span),
180
+
"these are all the `await` points this reference is held through",
0 commit comments