diff --git a/docs/errors/nested_type.md b/docs/errors/nested_type.md index 78d6e098b..5e9e6e526 100644 --- a/docs/errors/nested_type.md +++ b/docs/errors/nested_type.md @@ -21,27 +21,7 @@ mod outer_type { } ``` -This will fail if the `mod outer_type` name is not unique, and due to -b/481667188: if the `Inner` type is a forward declaration, which is completed -outside of the `OuterType` type. If that happens, `Inner` will not receive -bindings. - -## Fix - -### Type Alias {#alias} - -The most general fix, which will ensure `Inner` gets bindings if it can, is to -move it outside of `OuterType`: - -```c++ -struct Inner {}; -struct OuterType { - using Inner = Inner; -}; -``` - -Even if the bindings for the `using Inner = Inner;` fail for any of the above -reasons, the top-level `struct Inner` will still receive bindings, if it can. +This will fail if the `mod outer_type` name is not unique. ### Disambiguate the names {#disambiguate} @@ -59,19 +39,3 @@ struct OuterImpl { using OuterType = OuterImpl; ``` - -### b/481667188: Complete the type - -TODO(b/481667188): Completing the type inside the class should not be necessary. - -For now, avoid this pattern if `Inner` is meant to be used from Rust: - -```c++ -struct OuterType { - struct Inner; -}; -struct OuterType::Inner {...}; -``` - -Defining the complete type inside of `OuterType` will work, as will the general -[type alias solution](#alias) above. diff --git a/rs_bindings_from_cc/test/golden/nested_types.h b/rs_bindings_from_cc/test/golden/nested_types.h index 156efba82..fd652f962 100644 --- a/rs_bindings_from_cc/test/golden/nested_types.h +++ b/rs_bindings_from_cc/test/golden/nested_types.h @@ -91,7 +91,6 @@ struct Bar {}; } // namespace no_longer_top_level -// TODO(b/481667188): Nested should get bindings. struct ContainsForwardDeclared { struct Nested; }; diff --git a/rs_bindings_from_cc/test/golden/nested_types_rs_api.rs b/rs_bindings_from_cc/test/golden/nested_types_rs_api.rs index a55365b01..667a80d3a 100644 --- a/rs_bindings_from_cc/test/golden/nested_types_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/nested_types_rs_api.rs @@ -777,7 +777,6 @@ pub mod no_longer_top_level { // namespace no_longer_top_level -/// TODO(b/481667188): Nested should get bindings. #[derive(Clone, Copy, ::ctor::MoveAndAssignViaCopy)] #[repr(C)] ///CRUBIT_ANNOTATE: cpp_type=ContainsForwardDeclared