Partially-support nested type aliases: use the underlying type instead. This allows for functions and types which use those type aliases to be used, even if the type aliases themselves can't be used directly. This should help unblock the use of STL containers like `string_view`, where a bunch of member functions talk about the types `basic_string_view::size_type`, or `basic_string_view::value_type`, or `const_iterator`, etc. For example, string_view::size now has unsafe bindings, but did not before. PiperOrigin-RevId: 474279132
diff --git a/rs_bindings_from_cc/ir.rs b/rs_bindings_from_cc/ir.rs index bb10ce6..99c49c4 100644 --- a/rs_bindings_from_cc/ir.rs +++ b/rs_bindings_from_cc/ir.rs
@@ -487,6 +487,8 @@ pub owning_target: BazelLabel, pub doc_comment: Option<String>, pub underlying_type: MappedType, + pub source_loc: SourceLoc, + pub enclosing_record_id: Option<ItemId>, pub enclosing_namespace_id: Option<ItemId>, } @@ -519,6 +521,7 @@ pub owning_target: BazelLabel, #[serde(default)] pub child_item_ids: Vec<ItemId>, + pub enclosing_record_id: Option<ItemId>, pub enclosing_namespace_id: Option<ItemId>, pub is_inline: bool, } @@ -794,10 +797,9 @@ /// `self`, returns an error. pub fn record_for_member_func<'a>(&self, func: &'a Func) -> Result<Option<&Rc<Record>>> { if let Some(meta) = func.member_func_metadata.as_ref() { - Ok(Some( - self.find_decl(meta.record_id) - .with_context(|| format!("Failed to retrieve Record for MemberFuncMetadata of {:?}", func))?, - )) + Ok(Some(self.find_decl(meta.record_id).with_context(|| { + format!("Failed to retrieve Record for MemberFuncMetadata of {:?}", func) + })?)) } else { Ok(None) }