You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for custom DropImpl in CRUBIT_OWNED_POINTEE and refactor IR.
- Support an optional second argument in CRUBIT_OWNED_POINTEE to specify
a custom DropImpl method name.
- Refactor Crubit IR to group owned_ptr_type and drop_impl into a single
OwnedPtrConfig struct.
- Apply default value of "DropImpl" at annotation parsing time.
- Add GetAnnotationWithStringArgs helper in common/annotation_reader.h
and use it in cxx_record.cc.
PiperOrigin-RevId: 894250803
let owned_type_def = owned_type_name.as_ref().map(|owned_type_name| {
607
+
let owned_type_def = owned_ptr_config.as_ref().map(|cfg| {
608
+
let owned_type_name = &cfg.owned_type_name;
609
+
let drop_meth = &cfg.drop_impl;
608
610
let doc_comment = format!(
609
-
"Wrapper for a C++ {} owned by Rust. \n\n Style guide: The C++ type to which this refers should be wrapped in an `Arc` or `Mutex` if it is not already thread-safe. \n\n THIS TYPE REQUIRES A MANUAL DROP IMPLEMENTATION. \n You MUST provide an `impl {} {{ pub fn DropImpl(&mut self) {{ ... }} }}` block in a separate Rust file (e.g., via `additional_rust_srcs`). Failure to do so will result in a compile-time error: `method not found in `{}``.",
610
-
ident, owned_type_name, owned_type_name
611
+
"Wrapper for a C++ {} owned by Rust. \n\n Style guide: The C++ type to which this refers should be wrapped in an `Arc` or `Mutex` if it is not already thread-safe. \n\n THIS TYPE REQUIRES A MANUAL DROP IMPLEMENTATION. \n You MUST provide an `impl {} {{ pub fn {}(&mut self) {{ ... }} }}` block in a separate Rust file (e.g., via `additional_rust_srcs`). Failure to do so will result in a compile-time error: `method not found in `{}``.",
0 commit comments