about summary refs log tree commit diff
path: root/compiler/rustc_mir/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-06-22 20:01:05 +0900
committerGitHub <noreply@github.com>2021-06-22 20:01:05 +0900
commit8ec4e7dfdd5b90aa8867bf07e4d68f57908b080e (patch)
tree5e8e26643667d41959435fd8212835c4c33ba366 /compiler/rustc_mir/src
parent8af9339e49304f504d6c1c6c2210c44bbed45fc4 (diff)
parentb07bb6d698d842f05b1664b8824671080274d53d (diff)
downloadrust-8ec4e7dfdd5b90aa8867bf07e4d68f57908b080e.tar.gz
rust-8ec4e7dfdd5b90aa8867bf07e4d68f57908b080e.zip
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.
Diffstat (limited to 'compiler/rustc_mir/src')
-rw-r--r--compiler/rustc_mir/src/transform/check_unsafety.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_mir/src/transform/check_unsafety.rs b/compiler/rustc_mir/src/transform/check_unsafety.rs
index 324a5257f5d..103ddda1a1d 100644
--- a/compiler/rustc_mir/src/transform/check_unsafety.rs
+++ b/compiler/rustc_mir/src/transform/check_unsafety.rs
@@ -321,6 +321,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
                 }
                 false
             }
+            Safety::BuiltinUnsafe => true,
             Safety::ExplicitUnsafe(hir_id) => {
                 // mark unsafe block as used if there are any unsafe operations inside
                 if !violations.is_empty() {