about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-06-25 02:03:32 +0200
committerGitHub <noreply@github.com>2020-06-25 02:03:32 +0200
commit67db7a2d0553795d004e5e749e3ea73978c6f723 (patch)
treea051f230b799dd6f7374cebfa3534f3b30dda400 /src/libstd
parent67100f61e62a86f2bf9e38552ee138e231eddc74 (diff)
parent4504648090a9b8cae909424826dc4190f23df044 (diff)
downloadrust-67db7a2d0553795d004e5e749e3ea73978c6f723.tar.gz
rust-67db7a2d0553795d004e5e749e3ea73978c6f723.zip
Rollup merge of #72700 - davidtwco:issue-66220-improper-ctypes-declarations, r=lcnr,varkor
`improper_ctypes_definitions` lint

Addresses #19834, #66220, and #66373.

This PR takes another attempt at #65134 (reverted in #66378). Instead of modifying the existing `improper_ctypes` lint to consider `extern "C" fn` definitions in addition to `extern "C" {}` declarations, this PR adds a new lint - `improper_ctypes_definitions` - which only applies to `extern "C" fn` definitions.

In addition, the `improper_ctype_definitions` lint differs from `improper_ctypes` by considering `*T` and `&T` (where `T: Sized`) FFI-safe (addressing #66220).

There wasn't a clear consensus in #66220 (where the issues with #65134 were primarily discussed) on the approach to take, but there has [been some discussion in Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.2366220.20improper_ctypes.20definitions.20vs.20declarations/near/198903086). I fully expect that we'll want to iterate on this before landing.

cc @varkor + @shepmaster (from #19834) @hanna-kruppe (active in discussing #66220), @SimonSapin (#65134 caused problems for Servo, want to make sure that this PR doesn't)
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/sys/sgx/abi/mod.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/sys/sgx/abi/mod.rs b/src/libstd/sys/sgx/abi/mod.rs
index 87e7a5da2b7..5ef26d4cc4d 100644
--- a/src/libstd/sys/sgx/abi/mod.rs
+++ b/src/libstd/sys/sgx/abi/mod.rs
@@ -56,6 +56,7 @@ unsafe extern "C" fn tcs_init(secondary: bool) {
 // able to specify this
 #[cfg(not(test))]
 #[no_mangle]
+#[allow(improper_ctypes_definitions)]
 extern "C" fn entry(p1: u64, p2: u64, p3: u64, secondary: bool, p4: u64, p5: u64) -> (u64, u64) {
     // FIXME: how to support TLS in library mode?
     let tls = Box::new(tls::Tls::new());