Skip to content

Commit

Permalink
Auto merge of #132549 - Zalathar:rust-string, r=cuviper
Browse files Browse the repository at this point in the history
Make `RustString` an extern type to avoid `improper_ctypes` warnings

Currently, any FFI function that uses `&RustString` needs to also add `#[ignore(improper_ctypes)]` to silence a warning.

The warning is not _completely_ bogus, because `RustString` contains `Vec<u8>` and therefore does not have a guaranteed layout. But we have no way of telling the lint that this doesn't matter, because the C++ code only uses that pointer opaquely and never relies on its underlying layout.

Ideally there would be some way to silence `improper_ctypes` at the type-definition site. But because there isn't, casting to and from a separate extern type is better than having to annotate every single use site.
  • Loading branch information
bors committed Nov 9, 2024
2 parents 6556e9d + e9c9cb5 commit cfb9a90
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit cfb9a90

Please sign in to comment.