Update must_not_suspend lint to traverse references
This commit is contained in:
parent
bdfc688558
commit
89d35060b9
2 changed files with 12 additions and 6 deletions
|
|
@ -489,6 +489,8 @@ pub fn check_must_not_suspend_ty<'tcx>(
|
|||
|
||||
let plural_suffix = pluralize!(data.plural_len);
|
||||
|
||||
debug!("Checking must_not_suspend for {}", ty);
|
||||
|
||||
match *ty.kind() {
|
||||
ty::Adt(..) if ty.is_box() => {
|
||||
let boxed_ty = ty.boxed_ty();
|
||||
|
|
@ -580,6 +582,10 @@ pub fn check_must_not_suspend_ty<'tcx>(
|
|||
},
|
||||
)
|
||||
}
|
||||
ty::Ref(_region, ty, _mutability) => {
|
||||
let descr_pre = &format!("{}reference{} to ", data.descr_pre, plural_suffix);
|
||||
check_must_not_suspend_ty(fcx, ty, hir_id, SuspendCheckData { descr_pre, ..data })
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: `Umm` held across a suspend point, but should not be
|
||||
--> $DIR/ref.rs:18:26
|
||||
error: reference to `Umm` held across a suspend point, but should not be
|
||||
--> $DIR/ref.rs:18:13
|
||||
|
|
||||
LL | let guard = &mut self.u;
|
||||
| ^^^^^^
|
||||
|
|
@ -13,15 +13,15 @@ note: the lint level is defined here
|
|||
LL | #![deny(must_not_suspend)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
note: You gotta use Umm's, ya know?
|
||||
--> $DIR/ref.rs:18:26
|
||||
--> $DIR/ref.rs:18:13
|
||||
|
|
||||
LL | let guard = &mut self.u;
|
||||
| ^^^^^^
|
||||
| ^^^^^
|
||||
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
|
||||
--> $DIR/ref.rs:18:26
|
||||
--> $DIR/ref.rs:18:13
|
||||
|
|
||||
LL | let guard = &mut self.u;
|
||||
| ^^^^^^
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue