about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoão Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>2020-10-07 22:49:50 -0300
committerJoão Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>2020-10-07 22:49:50 -0300
commit15150c07eaeec50138a9c96c5bdecbdf92c3101e (patch)
tree48d62d646771cc201b51afc57dccd5e6204a2a60
parent738ed383066a561ae4f3ef0a6a2d570eaba7b6fa (diff)
downloadrust-15150c07eaeec50138a9c96c5bdecbdf92c3101e.tar.gz
rust-15150c07eaeec50138a9c96c5bdecbdf92c3101e.zip
clippy_lint: Test for BoxedLocal false-positive in C-FFI and fix C-FFI Abi comparison.
-rw-r--r--clippy_lints/src/escape.rs2
-rw-r--r--tests/ui/escape_analysis.rs5
2 files changed, 6 insertions, 1 deletions
diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs
index ffe81b3966c..b222475486d 100644
--- a/clippy_lints/src/escape.rs
+++ b/clippy_lints/src/escape.rs
@@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
         hir_id: HirId,
     ) {
         if let Some(header) = fn_kind.header() {
-            if header.abi == Abi::Cdecl {
+            if header.abi == Abi::C {
                 return;
             }
         }
diff --git a/tests/ui/escape_analysis.rs b/tests/ui/escape_analysis.rs
index c0a52d832c0..377a0fb502f 100644
--- a/tests/ui/escape_analysis.rs
+++ b/tests/ui/escape_analysis.rs
@@ -174,3 +174,8 @@ mod issue_3739 {
         };
     }
 }
+
+/// Issue #5542
+///
+/// This shouldn't warn for `boxed_local` as it is a function implemented in C.
+pub extern "C" fn do_now_warn_me(_c_pointer: Box<String>) -> () {}