[improper_ctypes] Don't suggest raw pointers when encountering trait objects

It's unhelpful since raw pointers to trait objects are also FFI-unsafe and casting to a thin raw pointer loses the vtable. There are working solutions that _involve_ raw pointers but they're too complex to explain in one line and have serious trade offs.
This commit is contained in:
Robin Kruppe 2018-02-14 23:11:29 +01:00
parent 9d493c897b
commit 051ea5cc9b
2 changed files with 1 additions and 3 deletions

View File

@ -577,7 +577,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
ty::TyDynamic(..) => FfiUnsafe {
ty: ty,
reason: "trait objects have no C equivalent",
help: Some("consider using a raw pointer instead"),
help: None,
},
ty::TyStr => FfiUnsafe {

View File

@ -78,8 +78,6 @@ error: `extern` block uses type `std::clone::Clone` which is not FFI-safe: trait
|
62 | pub fn trait_type(p: &Clone); //~ ERROR uses type `std::clone::Clone`
| ^^^^^^
|
= help: consider using a raw pointer instead
error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout
--> $DIR/lint-ctypes.rs:63:26