diff options
| author | Robin Kruppe <robin.kruppe@gmail.com> | 2018-02-14 23:11:29 +0100 |
|---|---|---|
| committer | Robin Kruppe <robin.kruppe@gmail.com> | 2018-02-15 19:49:50 +0100 |
| commit | 051ea5cc9bac00c7f588b4eae72b8a382d8ceb68 (patch) | |
| tree | a3011f11a8464e418db327a0513ef8dbaece16fc /src | |
| parent | 9d493c897b4382dc145b9448b3fafdfbbaecf528 (diff) | |
| download | rust-051ea5cc9bac00c7f588b4eae72b8a382d8ceb68.tar.gz rust-051ea5cc9bac00c7f588b4eae72b8a382d8ceb68.zip | |
[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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_lint/types.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/lint-ctypes.stderr | 2 |
2 files changed, 1 insertions, 3 deletions
diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 396d830d85b..ef9b3d38c63 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -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 { diff --git a/src/test/ui/lint-ctypes.stderr b/src/test/ui/lint-ctypes.stderr index 2abf08d55f7..748c311055f 100644 --- a/src/test/ui/lint-ctypes.stderr +++ b/src/test/ui/lint-ctypes.stderr @@ -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 |
