Rollup merge of #86517 - camsteffen:unused-unsafe-async, r=LeSeulArtichaut
Fix `unused_unsafe` around `await` Enables `unused_unsafe` lint for `unsafe { future.await }`. The existing test for this is `unsafe { println!() }`, so I assume that `println!` used to contain compiler-generated unsafe but this is no longer true, and so the existing test is broken. I replaced the test with `unsafe { ...await }`. I believe `await` is currently the only instance of compiler-generated unsafe. Reverts some parts of #85421, but the issue predates that PR.
This commit is contained in:
commit
8ec4e7dfdd
9 changed files with 43 additions and 25 deletions
|
@ -494,6 +494,8 @@ impl<'tcx> Body<'tcx> {
|
|||
#[derive(Copy, Clone, PartialEq, Eq, Debug, TyEncodable, TyDecodable, HashStable)]
|
||||
pub enum Safety {
|
||||
Safe,
|
||||
/// Unsafe because of compiler-generated unsafe code, like `await` desugaring
|
||||
BuiltinUnsafe,
|
||||
/// Unsafe because of an unsafe fn
|
||||
FnUnsafe,
|
||||
/// Unsafe because of an `unsafe` block
|
||||
|
|
|
@ -114,6 +114,7 @@ pub struct Adt<'tcx> {
|
|||
#[derive(Copy, Clone, Debug, HashStable)]
|
||||
pub enum BlockSafety {
|
||||
Safe,
|
||||
BuiltinUnsafe,
|
||||
ExplicitUnsafe(hir::HirId),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue