diff --git a/common/code_gen_utils.rs b/common/code_gen_utils.rs index 91c35edf7..af717b289 100644 --- a/common/code_gen_utils.rs +++ b/common/code_gen_utils.rs @@ -378,12 +378,26 @@ impl NamespaceQualifier { /// Returns `foo::bar::baz::` (reporting errors for C++ keywords). pub fn format_for_cc(&self) -> Result { - let namespace_cc_idents = self.cc_idents()?; - Ok(quote! { #(#namespace_cc_idents::)* }) + let mut path = quote! {}; + for namespace in &self.namespaces { + let namespace = format_cc_ident(namespace)?; + path.extend(quote! { #namespace :: }); + } + for (_rs_name, cc_name) in &self.nested_records { + let cc_name = format_cc_type_name(cc_name)?; + path.extend(quote! { #cc_name ::}); + } + Ok(path) } - pub fn cc_idents(&self) -> Result> { - self.parts().map(|ns| format_cc_ident(ns)).collect() + /// Returns `foo::bar::baz::` (never reporting errors). + pub fn format_for_cc_debug(&self) -> String { + let mut path = String::new(); + for part in self.parts() { + path.push_str(part); + path.push_str("::"); + } + path } } diff --git a/rs_bindings_from_cc/generate_bindings/cpp_type_name.rs b/rs_bindings_from_cc/generate_bindings/cpp_type_name.rs index b296ae7a6..f58207705 100644 --- a/rs_bindings_from_cc/generate_bindings/cpp_type_name.rs +++ b/rs_bindings_from_cc/generate_bindings/cpp_type_name.rs @@ -137,25 +137,6 @@ pub fn format_cpp_type_inner( /// For example, for `namespace x { struct Y { using X = int; }; }`, the name /// for `X` is `x::Y::X`. pub fn tagless_cpp_type_name_for_item(item: &ir::Item, ir: &IR) -> Result { - /// Returns the namespace / class qualifiers necessary to access the item. - /// - /// For example, for `namespace x { struct Y { using X = int; }; }`, the prefix - /// for `X` is `x::Y::`. - fn cpp_qualified_path_prefix(item: &ir::Item, ir: &ir::IR) -> Result { - let Some(parent) = item.enclosing_item_id() else { - return Ok(quote! {}); - }; - let parent: &ir::Item = ir.find_decl(parent)?; - match parent { - ir::Item::Namespace(_) => Ok(ir.namespace_qualifier(item).format_for_cc()?), - ir::Item::Record(r) => { - let name = cpp_tagless_type_name_for_record(r, ir)?; - Ok(quote! {#name ::}) - } - _ => bail!("Unexpected enclosing item: {item:?}"), - } - } - match item { Item::IncompleteRecord(incomplete_record) => { let ident = expect_format_cc_type_name(incomplete_record.cc_name.identifier.as_ref()); @@ -165,12 +146,12 @@ pub fn tagless_cpp_type_name_for_item(item: &ir::Item, ir: &IR) -> Result cpp_tagless_type_name_for_record(record, ir), Item::Enum(enum_) => { let ident = expect_format_cc_type_name(&enum_.rs_name.identifier); - let namespace_qualifier = cpp_qualified_path_prefix(item, ir)?; + let namespace_qualifier = ir.namespace_qualifier(item).format_for_cc()?; Ok(quote! { #namespace_qualifier #ident }) } Item::TypeAlias(type_alias) => { let ident = expect_format_cc_type_name(&type_alias.cc_name.identifier); - let namespace_qualifier = cpp_qualified_path_prefix(item, ir)?; + let namespace_qualifier = ir.namespace_qualifier(item).format_for_cc()?; Ok(quote! { #namespace_qualifier #ident }) } Item::ExistingRustType(existing_rust_type) => existing_rust_type diff --git a/rs_bindings_from_cc/generate_bindings/generate_function.rs b/rs_bindings_from_cc/generate_bindings/generate_function.rs index 6d97c8a9d..c3f44e56e 100644 --- a/rs_bindings_from_cc/generate_bindings/generate_function.rs +++ b/rs_bindings_from_cc/generate_bindings/generate_function.rs @@ -865,11 +865,9 @@ fn api_func_shape_for_constructor( /// become a `RvalueReference<'_, T>`. /// /// Returns: -/// -/// * `Err(_)`: something went wrong importing this function. -/// * `Ok(None)`: the function imported as "nothing". (For example, a defaulted +/// * `None`: the function imported as "nothing". (For example, a defaulted /// destructor might be mapped to no `Drop` impl at all.) -/// * `Ok((func_name, impl_kind))`: The function name and ImplKind. +/// * `(func_name, impl_kind)`: The function name and ImplKind. fn api_func_shape( db: &dyn BindingsGenerator, func: &Func, @@ -877,14 +875,16 @@ fn api_func_shape( errors: &Errors, ) -> Option<(Ident, ImplKind)> { let ir = db.ir(); - let maybe_record = match ir.record_for_member_func(func).map(<&Rc>::try_from) { + let maybe_record = match func.enclosing_item_id.map(|id| ir.find_untyped_decl(id)) { None => None, - Some(Ok(record)) => Some(record), - // Functions whose record was replaced with some other IR Item type are ignored. - // This occurs for instance if you use crubit_internal_rust_type: member functions defined - // out-of-line, such as implicitly generated constructors, will still be present in the IR, - // but should be ignored. - Some(Err(_)) => return None, + Some(ir::Item::Namespace(_)) => None, + Some(ir::Item::Record(record)) => Some(record), + // If the record was replaced by an existing Rust type using `crubit_internal_rust_type`, + // don't generate any bindings for its functions. (That can't work!) + Some(ir::Item::ExistingRustType(_)) => return None, + // (This case should be impossible.) + // TODO(jeanpierreda): Add an error here. + Some(_) => return None, }; if is_friend_of_record_not_visible_by_adl(db, func, param_types) { @@ -2256,7 +2256,10 @@ fn has_copy_assignment_operator_from_const_reference( if first_param_type.is_err() { return false; }; - let Some(Item::Record(record)) = db.ir().record_for_member_func(copy_constructor) else { + let Some(parent_id) = copy_constructor.enclosing_item_id else { + return false; + }; + let Ok(record) = db.ir().find_decl::>(parent_id) else { return false; }; record diff --git a/rs_bindings_from_cc/generate_bindings/generate_function_thunk.rs b/rs_bindings_from_cc/generate_bindings/generate_function_thunk.rs index 70a04ed59..025035a83 100644 --- a/rs_bindings_from_cc/generate_bindings/generate_function_thunk.rs +++ b/rs_bindings_from_cc/generate_bindings/generate_function_thunk.rs @@ -61,11 +61,9 @@ pub fn can_skip_cc_thunk(db: &dyn BindingsGenerator, func: &Func) -> bool { // In terms of runtime performance, since this only occurs for virtual function // calls, which are already slow, it may not be such a big deal. We can // benchmark it later. :) - if let Some(meta) = &func.member_func_metadata { - if let Some(inst_meta) = &meta.instance_method_metadata { - if inst_meta.is_virtual { - return false; - } + if let Some(inst_meta) = &func.instance_method_metadata { + if inst_meta.is_virtual { + return false; } } // ## Custom calling convention requires a thunk. @@ -260,44 +258,32 @@ fn generate_function_assertation_for_identifier( let ir = db.ir(); let fn_ident = expect_format_cc_ident(&id.identifier); + let path_to_func = ir.namespace_qualifier(func).format_for_cc()?; + let implementation_function = quote! { :: #path_to_func #fn_ident }; let method_qualification; - let implementation_function; let member_function_prefix; let func_params; - if let Some(meta) = func.member_func_metadata.as_ref() { - let record: &Rc = ir.find_decl(meta.record_id)?; - let record_ident = expect_format_cc_type_name(record.cc_name.identifier.as_ref()); - let namespace_qualifier = ir.namespace_qualifier(record).format_for_cc()?; - if let Some(instance_method_metadata) = meta.instance_method_metadata.as_ref() { - let const_qualifier = if instance_method_metadata.is_const { - quote! {const} - } else { - quote! {} - }; - - method_qualification = match instance_method_metadata.reference { - ir::ReferenceQualification::Unqualified => const_qualifier, - ir::ReferenceQualification::LValue => { - quote! { #const_qualifier & } - } - ir::ReferenceQualification::RValue => { - quote! { #const_qualifier && } - } - }; - implementation_function = quote! { #namespace_qualifier #record_ident :: #fn_ident }; - member_function_prefix = quote! { :: #namespace_qualifier #record_ident :: }; - // The first parameter of instance methods is `this`. - func_params = &func.params[1..]; + if let Some(instance_method_metadata) = &func.instance_method_metadata { + let const_qualifier = if instance_method_metadata.is_const { + quote! {const} } else { - method_qualification = quote! {}; - implementation_function = quote! { #namespace_qualifier #record_ident :: #fn_ident }; - member_function_prefix = quote! {}; - func_params = &func.params[..]; - } + quote! {} + }; + + method_qualification = match instance_method_metadata.reference { + ir::ReferenceQualification::Unqualified => const_qualifier, + ir::ReferenceQualification::LValue => { + quote! { #const_qualifier & } + } + ir::ReferenceQualification::RValue => { + quote! { #const_qualifier && } + } + }; + member_function_prefix = path_to_func; + // The first parameter of instance methods is `this`. + func_params = &func.params[1..]; } else { - let namespace_qualifier = ir.namespace_qualifier(func).format_for_cc()?; method_qualification = quote! {}; - implementation_function = quote! { #namespace_qualifier #fn_ident }; member_function_prefix = quote! {}; func_params = &func.params[..]; } @@ -394,22 +380,11 @@ pub fn generate_function_thunk_impl( } UnqualifiedIdentifier::Identifier(id) => { let fn_ident = expect_format_cc_ident(&id.identifier); - match func.member_func_metadata.as_ref() { - Some(meta) => { - if meta.instance_method_metadata.is_some() { - quote! { #fn_ident } - } else { - let record: &Rc = ir.find_decl(meta.record_id)?; - let record_name = - expect_format_cc_type_name(record.cc_name.identifier.as_ref()); - let namespace_qualifier = ir.namespace_qualifier(record).format_for_cc()?; - quote! { #namespace_qualifier #record_name :: #fn_ident } - } - } - None => { - let namespace_qualifier = ir.namespace_qualifier(func).format_for_cc()?; - quote! { #namespace_qualifier #fn_ident } - } + let namespace_qualifier = ir.namespace_qualifier(func).format_for_cc()?; + if func.instance_method_metadata.is_some() { + quote! {#fn_ident} + } else { + quote! { #namespace_qualifier #fn_ident } } } // Use `destroy_at` to avoid needing to spell out the class name. Destructor identiifers @@ -419,8 +394,8 @@ pub fn generate_function_thunk_impl( // using destroy_at, we avoid needing to determine or remember what the correct spelling // is. Similar arguments apply to `construct_at`. UnqualifiedIdentifier::Constructor => { - if let Some(meta) = func.member_func_metadata.as_ref() { - let record: &Rc = ir.find_decl(meta.record_id)?; + if let Some(parent_id) = func.enclosing_item_id { + let record: &Rc = ir.find_decl(parent_id)?; if is_copy_constructor(func, record.id) && record.copy_constructor == SpecialMemberFunc::Unavailable { @@ -565,14 +540,12 @@ pub fn generate_function_thunk_impl( return_type_cpp_spelling.clone() }; - let mut this_ref_qualification = - func.member_func_metadata.as_ref().and_then(|meta| match &func.rs_name { - UnqualifiedIdentifier::Constructor | UnqualifiedIdentifier::Destructor => None, - UnqualifiedIdentifier::Identifier(_) | UnqualifiedIdentifier::Operator(_) => meta - .instance_method_metadata - .as_ref() - .map(|instance_method| instance_method.reference), - }); + let mut this_ref_qualification = match &func.rs_name { + UnqualifiedIdentifier::Constructor | UnqualifiedIdentifier::Destructor => None, + UnqualifiedIdentifier::Identifier(_) | UnqualifiedIdentifier::Operator(_) => { + func.instance_method_metadata.as_ref().map(|meta| meta.reference) + } + }; if func.cc_name.is_constructor() { this_ref_qualification = None; } diff --git a/rs_bindings_from_cc/importers/function.cc b/rs_bindings_from_cc/importers/function.cc index 31906d761..dc0993ce9 100644 --- a/rs_bindings_from_cc/importers/function.cc +++ b/rs_bindings_from_cc/importers/function.cc @@ -507,33 +507,28 @@ std::optional FunctionDeclImporter::Import( errors.Add(FormattedError::Static("Inline function is not defined")); } - std::optional member_func_metadata; + std::optional instance_metadata; if (auto* method_decl = clang::dyn_cast(function_decl)) { - std::optional instance_metadata; if (method_decl->isInstance()) { - MemberFuncMetadata::ReferenceQualification reference; + InstanceMethodMetadata::ReferenceQualification reference; switch (method_decl->getRefQualifier()) { case clang::RQ_LValue: - reference = MemberFuncMetadata::kLValue; + reference = InstanceMethodMetadata::kLValue; break; case clang::RQ_RValue: - reference = MemberFuncMetadata::kRValue; + reference = InstanceMethodMetadata::kRValue; break; case clang::RQ_None: - reference = MemberFuncMetadata::kUnqualified; + reference = InstanceMethodMetadata::kUnqualified; break; } - instance_metadata = MemberFuncMetadata::InstanceMethodMetadata{ + instance_metadata = InstanceMethodMetadata{ .reference = reference, .is_const = method_decl->isConst(), .is_virtual = method_decl->isVirtual(), }; } - - member_func_metadata = MemberFuncMetadata{ - .record_id = ictx_.GenerateItemId(method_decl->getParent()), - .instance_method_metadata = instance_metadata}; } if (!errors.error_set.empty()) { @@ -618,7 +613,7 @@ std::optional FunctionDeclImporter::Import( .params = std::move(params), .lifetime_params = std::move(lifetime_params), .is_inline = is_inline, - .member_func_metadata = std::move(member_func_metadata), + .instance_method_metadata = std::move(instance_metadata), .is_extern_c = function_decl->isExternC(), .is_noreturn = function_decl->isNoReturn(), .is_variadic = function_decl->isVariadic(), diff --git a/rs_bindings_from_cc/ir.cc b/rs_bindings_from_cc/ir.cc index 93639dd1d..93abb0a88 100644 --- a/rs_bindings_from_cc/ir.cc +++ b/rs_bindings_from_cc/ir.cc @@ -251,16 +251,16 @@ Identifier& TranslatedIdentifier::rs_identifier() { return cc_identifier; } -llvm::json::Value MemberFuncMetadata::InstanceMethodMetadata::ToJson() const { +llvm::json::Value InstanceMethodMetadata::ToJson() const { const char* reference_str = nullptr; switch (reference) { - case MemberFuncMetadata::kLValue: + case InstanceMethodMetadata::kLValue: reference_str = "LValue"; break; - case MemberFuncMetadata::kRValue: + case InstanceMethodMetadata::kRValue: reference_str = "RValue"; break; - case MemberFuncMetadata::kUnqualified: + case InstanceMethodMetadata::kUnqualified: reference_str = "Unqualified"; break; } @@ -272,13 +272,6 @@ llvm::json::Value MemberFuncMetadata::InstanceMethodMetadata::ToJson() const { }; } -llvm::json::Value MemberFuncMetadata::ToJson() const { - return llvm::json::Object{ - {"record_id", record_id}, - {"instance_method_metadata", instance_method_metadata}, - }; -} - llvm::json::Value ExistingRustType::ToJson() const { llvm::json::Object override{ {"rs_name", rs_name}, @@ -334,7 +327,7 @@ llvm::json::Value Func::ToJson() const { {"params", params}, {"lifetime_params", lifetime_params}, {"is_inline", is_inline}, - {"member_func_metadata", member_func_metadata}, + {"instance_method_metadata", instance_method_metadata}, {"is_extern_c", is_extern_c}, {"is_noreturn", is_noreturn}, {"is_variadic", is_variadic}, diff --git a/rs_bindings_from_cc/ir.h b/rs_bindings_from_cc/ir.h index 9bbaf226d..3871addf8 100644 --- a/rs_bindings_from_cc/ir.h +++ b/rs_bindings_from_cc/ir.h @@ -346,33 +346,20 @@ struct TranslatedIdentifier { Identifier& rs_identifier(); }; -struct MemberFuncMetadata { +// TODO(lukasza): Consider extracting a separate ConstructorMetadata struct to +// account for the fact that `is_const` and `is_virtual` never applies to +// constructors. +struct InstanceMethodMetadata { enum ReferenceQualification : char { kLValue, // void Foo() &; kRValue, // void Foo() &&; kUnqualified, // void Foo(); }; - - // TODO(lukasza): Consider extracting a separate ConstructorMetadata struct to - // account for the fact that `is_const` and `is_virtual` never applies to - // constructors. - struct InstanceMethodMetadata { - llvm::json::Value ToJson() const; - - ReferenceQualification reference = kUnqualified; - bool is_const = false; - bool is_virtual = false; - }; - llvm::json::Value ToJson() const; - // The type that this is a member function for. - ItemId record_id; - - // Qualifiers for the instance method. - // - // If null, this is a static method. - std::optional instance_method_metadata; + ReferenceQualification reference = kUnqualified; + bool is_const = false; + bool is_virtual = false; }; // A function involved in the bindings. @@ -388,8 +375,8 @@ struct Func { std::vector params; std::vector lifetime_params; bool is_inline; - // If null, this is not a member function. - std::optional member_func_metadata; + // If null, this is not an instance method. + std::optional instance_method_metadata; bool is_extern_c = false; bool is_noreturn = false; bool is_variadic = false; diff --git a/rs_bindings_from_cc/ir.rs b/rs_bindings_from_cc/ir.rs index 0706b2ad0..43851af1d 100644 --- a/rs_bindings_from_cc/ir.rs +++ b/rs_bindings_from_cc/ir.rs @@ -779,13 +779,6 @@ pub struct InstanceMethodMetadata { pub is_virtual: bool, } -#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize)] -#[serde(deny_unknown_fields)] -pub struct MemberFuncMetadata { - pub record_id: ItemId, - pub instance_method_metadata: Option, -} - #[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize)] #[serde(deny_unknown_fields)] pub struct FuncParam { @@ -828,7 +821,7 @@ pub struct Func { /// not originally part of the IR. pub lifetime_params: Vec, pub is_inline: bool, - pub member_func_metadata: Option, + pub instance_method_metadata: Option, pub is_extern_c: bool, pub is_noreturn: bool, pub is_variadic: bool, @@ -850,6 +843,11 @@ pub struct Func { pub safety_annotation: SafetyAnnotation, pub source_loc: Rc, pub id: ItemId, + /// The enclosing item ID. + /// + /// If this is a free function, then this will be None or a namespace. If this is + /// a member function, it will be a record type in C++, but might be an + /// `ExistingRustType` if it was renamed. pub enclosing_item_id: Option, /// If this function was declared as a `friend` inside of a record @@ -870,25 +868,31 @@ impl GenericItem for Func { Some(self.owning_target.clone()) } fn debug_name(&self, ir: &IR) -> Rc { - let record: Option> = ir.record_for_member_func(self).map(|r| r.debug_name(ir)); - let record: Option<&str> = record.as_deref(); + let mut name = ir.namespace_qualifier(self).format_for_cc_debug(); + let record_name = || -> Option> { + let record = ir.find_decl::>(self.enclosing_item_id?).ok()?; + Some(record.cc_name.identifier.clone()) + }; - let func_name = match &self.rs_name { - UnqualifiedIdentifier::Identifier(id) => id.identifier.to_string(), - UnqualifiedIdentifier::Operator(op) => op.cc_name(), + match &self.cc_name { + UnqualifiedIdentifier::Identifier(id) => { + name.push_str(&id.identifier); + } + UnqualifiedIdentifier::Operator(op) => { + name.push_str(&op.cc_name()); + } UnqualifiedIdentifier::Destructor => { - format!("~{}", record.expect("destructor must be associated with a record")) + name.push('~'); + name.push_str(&record_name().expect("destructor must be associated with a record")); } UnqualifiedIdentifier::Constructor => { - record.expect("constructor must be associated with a record").to_string() + name.push_str( + &record_name().expect("constructor must be associated with a record"), + ); } - }; - - if let Some(record_name) = record { - format!("{}::{}", record_name, func_name).into() - } else { - func_name.into() } + + name.into() } fn unsupported_kind(&self) -> UnsupportedItemKind { if self.cc_name == UnqualifiedIdentifier::Constructor { @@ -910,10 +914,7 @@ impl GenericItem for Func { impl Func { pub fn is_instance_method(&self) -> bool { - self.member_func_metadata - .as_ref() - .filter(|meta| meta.instance_method_metadata.is_some()) - .is_some() + self.instance_method_metadata.is_some() } } @@ -987,8 +988,9 @@ impl GenericItem for IncompleteRecord { fn owning_target(&self) -> Option { Some(self.owning_target.clone()) } - fn debug_name(&self, _: &IR) -> Rc { - self.cc_name.identifier.clone() + fn debug_name(&self, ir: &IR) -> Rc { + format!("{}{}", ir.namespace_qualifier(self).format_for_cc_debug(), self.cc_name.identifier) + .into() } fn unsupported_kind(&self) -> UnsupportedItemKind { self.record_type.unsupported_item_kind() @@ -1176,8 +1178,9 @@ impl GenericItem for Record { fn owning_target(&self) -> Option { Some(self.owning_target.clone()) } - fn debug_name(&self, _: &IR) -> Rc { - self.cc_name.identifier.clone() + fn debug_name(&self, ir: &IR) -> Rc { + format!("{}{}", ir.namespace_qualifier(self).format_for_cc_debug(), self.cc_name.identifier) + .into() } fn unsupported_kind(&self) -> UnsupportedItemKind { self.record_type.unsupported_item_kind() @@ -1325,8 +1328,9 @@ impl GenericItem for GlobalVar { fn owning_target(&self) -> Option { Some(self.owning_target.clone()) } - fn debug_name(&self, _: &IR) -> Rc { - self.rs_name.identifier.clone() + fn debug_name(&self, ir: &IR) -> Rc { + format!("{}{}", ir.namespace_qualifier(self).format_for_cc_debug(), self.cc_name.identifier) + .into() } fn unsupported_kind(&self) -> UnsupportedItemKind { UnsupportedItemKind::GlobalVar @@ -1370,8 +1374,9 @@ impl GenericItem for Enum { fn owning_target(&self) -> Option { Some(self.owning_target.clone()) } - fn debug_name(&self, _: &IR) -> Rc { - self.rs_name.identifier.clone() + fn debug_name(&self, ir: &IR) -> Rc { + format!("{}{}", ir.namespace_qualifier(self).format_for_cc_debug(), self.cc_name.identifier) + .into() } fn unsupported_kind(&self) -> UnsupportedItemKind { UnsupportedItemKind::Enum @@ -1419,8 +1424,9 @@ impl GenericItem for TypeAlias { fn owning_target(&self) -> Option { Some(self.owning_target.clone()) } - fn debug_name(&self, _: &IR) -> Rc { - self.rs_name.identifier.clone() + fn debug_name(&self, ir: &IR) -> Rc { + format!("{}{}", ir.namespace_qualifier(self).format_for_cc_debug(), self.cc_name.identifier) + .into() } fn unsupported_kind(&self) -> UnsupportedItemKind { UnsupportedItemKind::TypeAlias @@ -1546,6 +1552,7 @@ impl GenericItem for UnsupportedItem { None } fn debug_name(&self, _: &IR) -> Rc { + // Note: name is supposed to be populated with the `debug_name()` of the unsupported item. self.name.clone() } fn unsupported_kind(&self) -> UnsupportedItemKind { @@ -1640,7 +1647,7 @@ impl GenericItem for Comment { None } fn debug_name(&self, _: &IR) -> Rc { - "comment".into() + "".into() } fn unsupported_kind(&self) -> UnsupportedItemKind { UnsupportedItemKind::Other @@ -1680,8 +1687,9 @@ impl GenericItem for Namespace { fn owning_target(&self) -> Option { Some(self.owning_target.clone()) } - fn debug_name(&self, _: &IR) -> Rc { - self.rs_name.to_string().into() + fn debug_name(&self, ir: &IR) -> Rc { + format!("{}{}", ir.namespace_qualifier(self).format_for_cc_debug(), self.cc_name.identifier) + .into() } fn unsupported_kind(&self) -> UnsupportedItemKind { UnsupportedItemKind::Namespace @@ -1714,7 +1722,7 @@ impl GenericItem for UseMod { None } fn debug_name(&self, _: &IR) -> Rc { - format!("[internal] use mod {}::* = {}", self.mod_name, self.path).into() + format!("<[internal] use mod {}::* = {}>", self.mod_name, self.path).into() } fn unsupported_kind(&self) -> UnsupportedItemKind { UnsupportedItemKind::Other @@ -1750,8 +1758,8 @@ impl GenericItem for ExistingRustType { fn owning_target(&self) -> Option { Some(self.owning_target.clone()) } - fn debug_name(&self, _: &IR) -> Rc { - self.cc_name.clone() + fn debug_name(&self, ir: &IR) -> Rc { + format!("{}{}", ir.namespace_qualifier(self).format_for_cc_debug(), self.cc_name).into() } fn unsupported_kind(&self) -> UnsupportedItemKind { UnsupportedItemKind::Other @@ -2265,20 +2273,6 @@ impl IR { Ok(idx == last_item_idx) } - /// Returns the `Item` defining `func`, or `None` if `func` is not a - /// member function. - /// - /// Note that even if `func` is a member function, the associated record - /// might not be a Record IR Item (e.g. it has its type changed via - /// crubit_internal_rust_type). - pub fn record_for_member_func(&self, func: &Func) -> Option<&Item> { - if let Some(meta) = func.member_func_metadata.as_ref() { - Some(self.find_untyped_decl(meta.record_id)) - } else { - None - } - } - pub fn crate_root_path(&self) -> Option> { self.flat_ir.crate_root_path.clone() } diff --git a/rs_bindings_from_cc/ir_from_cc_test.rs b/rs_bindings_from_cc/ir_from_cc_test.rs index 045dfa0e6..9c532d4b3 100644 --- a/rs_bindings_from_cc/ir_from_cc_test.rs +++ b/rs_bindings_from_cc/ir_from_cc_test.rs @@ -58,7 +58,7 @@ fn test_function() { ], lifetime_params: [], is_inline: false, - member_func_metadata: None, + instance_method_metadata: None, is_extern_c: false, is_noreturn: false, is_variadic: false, @@ -1233,10 +1233,8 @@ fn test_typedef_of_full_template_specialization() -> Result<()> { mangled_name: "_ZNK23test_namespace_bindings8MyStructIiE8GetValueEv", ... doc_comment: Some("Doc comment of GetValue method."), ... is_inline: true, ... - member_func_metadata: Some(MemberFuncMetadata { - record_id: ItemId(#record_id), - instance_method_metadata: Some(InstanceMethodMetadata { ... }), ... - }), ... + instance_method_metadata: Some(InstanceMethodMetadata { ... }), ... + enclosing_item_id: Some(ItemId(#record_id)), ... } } ); @@ -1324,10 +1322,8 @@ fn test_typedef_for_explicit_template_specialization() -> Result<()> { mangled_name: "_ZNK23test_namespace_bindings8MyStructIiE8GetValueEv", ... doc_comment: Some("Doc comment of the GetValue method specialization for T=int."), ... is_inline: true, ... - member_func_metadata: Some(MemberFuncMetadata { - record_id: ItemId(#record_id), - instance_method_metadata: Some(InstanceMethodMetadata { ... }), ... - }), ... + instance_method_metadata: Some(InstanceMethodMetadata { ... }), ... + enclosing_item_id: Some(ItemId(#record_id)), ... } } ); @@ -1365,8 +1361,8 @@ fn test_multiple_typedefs_to_same_specialization() -> Result<()> { // Verify that there is only 1 function per instantiation. assert_eq!(2, functions.len()); - let rec_id1 = functions[0].member_func_metadata.as_ref().unwrap().record_id; - let rec_id2 = functions[1].member_func_metadata.as_ref().unwrap().record_id; + let rec_id1 = functions[0].enclosing_item_id.unwrap(); + let rec_id2 = functions[1].enclosing_item_id.unwrap(); assert_ne!(rec_id1, rec_id2); Ok(()) } @@ -1629,7 +1625,7 @@ fn test_fully_instantiated_template_in_function_return_type() -> Result<()> { }, params: [], ... is_inline: false, ... - member_func_metadata: None, ... + instance_method_metadata: None, ... has_c_calling_convention: true, ... is_member_or_descendant_of_class_template: false, ... } @@ -1683,7 +1679,7 @@ fn test_fully_instantiated_template_in_function_param_type() -> Result<()> { unknown_attr: None, }], ... is_inline: false, ... - member_func_metadata: None, ... + instance_method_metadata: None, ... has_c_calling_convention: true, ... is_member_or_descendant_of_class_template: false, ... } @@ -2698,14 +2694,9 @@ fn assert_member_function_with_predicate_has_instance_method_metadata = ir .functions() - .filter(|f| { + .filter_map(|f| { // Only SomeStruct member functions (excluding stddef.h stuff). - if let Some(Ok(r)) = ir.record_for_member_func(f).map(<&Rc>::try_from) { - r.rs_name.identifier.as_ref() == "SomeStruct" - } else { - false + let r = ir.find_decl::>(f.enclosing_item_id?).ok()?; + if r.rs_name.identifier.as_ref() != "SomeStruct" { + return None; + } + + match &f.rs_name { + UnqualifiedIdentifier::Operator(op) => Some(op.name.as_ref()), + _ => None, } - }) - .flat_map(|f| match &f.rs_name { - UnqualifiedIdentifier::Operator(op) => Some(op.name.as_ref()), - _ => None, }) .collect(); assert!(operator_names.contains("=")); diff --git a/rs_bindings_from_cc/test/annotations/do_not_bind_api_impl.cc b/rs_bindings_from_cc/test/annotations/do_not_bind_api_impl.cc index 223315faa..9576d53ba 100644 --- a/rs_bindings_from_cc/test/annotations/do_not_bind_api_impl.cc +++ b/rs_bindings_from_cc/test/annotations/do_not_bind_api_impl.cc @@ -41,8 +41,8 @@ __rust_thunk___ZN6crubit4test11DoNotBindFnENS0_23ArgumentToBoundOverloadE( crubit::test::DoNotBindFn(std::move(*__param_0)); } -static_assert((void (*)( - struct crubit::test::ArgumentToBoundOverload))&crubit::test::DoNotBindFn); +static_assert((void (*)(struct crubit::test::ArgumentToBoundOverload)) & + ::crubit::test::DoNotBindFn); static_assert(sizeof(struct crubit::test::StructWithDoNotBindConstructor) == 1); static_assert(alignof(struct crubit::test::StructWithDoNotBindConstructor) == @@ -70,8 +70,8 @@ __rust_thunk___ZN6crubit4test25StructWithDoNotBindMethod15DoNotBindMethodENS0_23 __this->DoNotBindMethod(std::move(*__param_0)); } -static_assert((void (::crubit::test::StructWithDoNotBindMethod::*)( - struct crubit::test::ArgumentToBoundOverload))&crubit::test:: - StructWithDoNotBindMethod::DoNotBindMethod); +static_assert((void (crubit::test::StructWithDoNotBindMethod::*)( + struct crubit::test::ArgumentToBoundOverload)) & + ::crubit::test::StructWithDoNotBindMethod::DoNotBindMethod); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/annotations/owned_ptr_api_impl.cc b/rs_bindings_from_cc/test/annotations/owned_ptr_api_impl.cc index b63522087..bc4b6387c 100644 --- a/rs_bindings_from_cc/test/annotations/owned_ptr_api_impl.cc +++ b/rs_bindings_from_cc/test/annotations/owned_ptr_api_impl.cc @@ -32,6 +32,6 @@ extern "C" void __rust_thunk___ZN5Thing5CloseEv(struct Thing* __this) { __this->Close(); } -static_assert((void (::Thing::*)())&Thing::Close); +static_assert((void (Thing::*)()) & ::Thing::Close); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/annotations/owned_ptr_user_api_impl.cc b/rs_bindings_from_cc/test/annotations/owned_ptr_user_api_impl.cc index 51eeffb78..5bb44e11c 100644 --- a/rs_bindings_from_cc/test/annotations/owned_ptr_user_api_impl.cc +++ b/rs_bindings_from_cc/test/annotations/owned_ptr_user_api_impl.cc @@ -19,12 +19,12 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wthread-safety-analysis" -static_assert((struct Thing * (*)(int)) & MakeOwnedThing); +static_assert((struct Thing * (*)(int)) & ::MakeOwnedThing); -static_assert((struct Thing * (*)(int)) & MakeThing); +static_assert((struct Thing * (*)(int)) & ::MakeThing); -static_assert((int (*)(struct Thing*))&ThingToValue); +static_assert((int (*)(struct Thing*)) & ::ThingToValue); -static_assert((int (*)(struct Thing*))&GetThingValue); +static_assert((int (*)(struct Thing*)) & ::GetThingValue); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/annotations/rust_name_api_impl.cc b/rs_bindings_from_cc/test/annotations/rust_name_api_impl.cc index e3792bf34..2049c7f7f 100644 --- a/rs_bindings_from_cc/test/annotations/rust_name_api_impl.cc +++ b/rs_bindings_from_cc/test/annotations/rust_name_api_impl.cc @@ -23,7 +23,7 @@ extern "C" void __rust_thunk___ZN6crubit4test13FreeFnOldNameEv() { crubit::test::FreeFnOldName(); } -static_assert((void (*)())&crubit::test::FreeFnOldName); +static_assert((void (*)()) & ::crubit::test::FreeFnOldName); static_assert(sizeof(struct crubit::test::StructOldName) == 1); static_assert(alignof(struct crubit::test::StructOldName) == 1); @@ -53,7 +53,7 @@ extern "C" void __rust_thunk___ZNK6crubit4test10SomeStruct13MethodOldNameEv( __this->MethodOldName(); } -static_assert((void (::crubit::test::SomeStruct::*)() const) & - crubit::test::SomeStruct::MethodOldName); +static_assert((void (crubit::test::SomeStruct::*)() const) & + ::crubit::test::SomeStruct::MethodOldName); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/function/inline/inline_api_impl.cc b/rs_bindings_from_cc/test/function/inline/inline_api_impl.cc index e5f4d0967..664804f27 100644 --- a/rs_bindings_from_cc/test/function/inline/inline_api_impl.cc +++ b/rs_bindings_from_cc/test/function/inline/inline_api_impl.cc @@ -23,7 +23,7 @@ extern "C" int __rust_thunk___Z18hello_world_inlinev() { return hello_world_inline(); } -static_assert((int (*)())&hello_world_inline); +static_assert((int (*)()) & ::hello_world_inline); static_assert(CRUBIT_SIZEOF(struct SomeStruct) == 4); static_assert(alignof(struct SomeStruct) == 4); @@ -38,19 +38,19 @@ extern "C" int __rust_thunk___Z24take_struct_by_const_ptrPK10SomeStruct( return take_struct_by_const_ptr(s); } -static_assert((int (*)(struct SomeStruct const*))&take_struct_by_const_ptr); +static_assert((int (*)(struct SomeStruct const*)) & ::take_struct_by_const_ptr); extern "C" unsigned int __rust_thunk___Z19double_unsigned_intj(unsigned int i) { return double_unsigned_int(i); } -static_assert((unsigned int (*)(unsigned int))&double_unsigned_int); +static_assert((unsigned int (*)(unsigned int)) & ::double_unsigned_int); extern "C" int __rust_thunk___ZN10namespaced24forward_declared_doublerEi( int x) { return namespaced::forward_declared_doubler(x); } -static_assert((int (*)(int))&namespaced::forward_declared_doubler); +static_assert((int (*)(int)) & ::namespaced::forward_declared_doubler); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/function/simple/simple_api_impl.cc b/rs_bindings_from_cc/test/function/simple/simple_api_impl.cc index d3fe178cf..14ba0c24c 100644 --- a/rs_bindings_from_cc/test/function/simple/simple_api_impl.cc +++ b/rs_bindings_from_cc/test/function/simple/simple_api_impl.cc @@ -19,35 +19,36 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wthread-safety-analysis" -static_assert((int (*)())&return_value); +static_assert((int (*)()) & ::return_value); -static_assert((int* (*)())&return_pointer); +static_assert((int* (*)()) & ::return_pointer); -static_assert((int& (*)())&return_reference); +static_assert((int& (*)()) & ::return_reference); -static_assert((void (*)(int*))&take_pointer); +static_assert((void (*)(int*)) & ::take_pointer); -static_assert((void (*)(int&))&take_reference); +static_assert((void (*)(int&)) & ::take_reference); -static_assert((int const* (*)(int const*)) & forward_pointer); +static_assert((int const* (*)(int const*)) & ::forward_pointer); -static_assert((int const& (*)(int const&)) & forward_reference); +static_assert((int const& (*)(int const&)) & ::forward_reference); -static_assert((int (*)(int, int))&multiply); +static_assert((int (*)(int, int)) & ::multiply); -static_assert((int (*)(int, int))&multiply_with_unnamed_parameters); +static_assert((int (*)(int, int)) & ::multiply_with_unnamed_parameters); -static_assert((int (*)(int, int, int))&multiply_with_keyword_named_parameters); +static_assert((int (*)(int, int, int)) & + ::multiply_with_keyword_named_parameters); -static_assert((int (*)())&llvm_no_mangle_marker); +static_assert((int (*)()) & ::llvm_no_mangle_marker); -static_assert((int (*)())&asm_name_with_dollar_sign); +static_assert((int (*)()) & ::asm_name_with_dollar_sign); static_assert((crubit::type_identity_t * (*)()) & - get_pointer_to_multiply_function); + ::get_pointer_to_multiply_function); static_assert((crubit::type_identity_t & (*)()) & - get_reference_to_multiply_function); + ::get_reference_to_multiply_function); extern "C" crubit::type_identity_t* __rust_thunk___Z39inline_get_pointer_to_multiply_functionv() { @@ -55,14 +56,14 @@ __rust_thunk___Z39inline_get_pointer_to_multiply_functionv() { } static_assert((crubit::type_identity_t * (*)()) & - inline_get_pointer_to_multiply_function); + ::inline_get_pointer_to_multiply_function); extern "C" int __rust_thunk___Z15apply_binary_opiiPFiiiE( int x, int y, crubit::type_identity_t* op) { return apply_binary_op(x, y, op); } -static_assert((int (*)( - int, int, crubit::type_identity_t*))&apply_binary_op); +static_assert((int (*)(int, int, crubit::type_identity_t*)) & + ::apply_binary_op); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/bridge_type_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/bridge_type_rs_api_impl.cc index 22727599c..cda4bbb8b 100644 --- a/rs_bindings_from_cc/test/golden/bridge_type_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/bridge_type_rs_api_impl.cc @@ -25,7 +25,7 @@ extern "C" void __rust_thunk___Z15ReturnCppStructv(void* __return) { cpp_to_rust_converter(&__original_cpp_struct, __return); } -static_assert((struct CppStruct (*)())&ReturnCppStruct); +static_assert((struct CppStruct (*)()) & ::ReturnCppStruct); extern "C" void rust_to_cpp_converter(void* rust_struct, void* cpp_struct); extern "C" void __rust_thunk___Z13TakeCppStruct9CppStruct(void* __param_0) { @@ -34,6 +34,6 @@ extern "C" void __rust_thunk___Z13TakeCppStruct9CppStruct(void* __param_0) { TakeCppStruct(std::move(*&(__converted___param_0.val))); } -static_assert((void (*)(struct CppStruct))&TakeCppStruct); +static_assert((void (*)(struct CppStruct)) & ::TakeCppStruct); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/c_abi_compatible_type_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/c_abi_compatible_type_rs_api_impl.cc index 11f0c28f6..cccb1a333 100644 --- a/rs_bindings_from_cc/test/golden/c_abi_compatible_type_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/c_abi_compatible_type_rs_api_impl.cc @@ -30,12 +30,12 @@ extern "C" MyI8 __rust_thunk___Z3ffi4MyI81X(MyI8 a, struct X* b) { return ffi(std::move(a), std::move(*b)); } -static_assert((MyI8 (*)(MyI8, struct X))&ffi); +static_assert((MyI8 (*)(MyI8, struct X)) & ::ffi); extern "C" void __rust_thunk___Z1fiPvi(MyTypedefDecl a, void* b, int c) { f(a, b, c); } -static_assert((void (*)(MyTypedefDecl, void*, int))&f); +static_assert((void (*)(MyTypedefDecl, void*, int)) & ::f); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/callables_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/callables_rs_api_impl.cc index 4108b5d9d..466ad2809 100644 --- a/rs_bindings_from_cc/test/golden/callables_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/callables_rs_api_impl.cc @@ -31,6 +31,6 @@ extern "C" int __rust_thunk___ZNK17NotCABICompatible3getEv( return __this->get(); } -static_assert((int (::NotCABICompatible::*)() const) & NotCABICompatible::get); +static_assert((int (NotCABICompatible::*)() const) & ::NotCABICompatible::get); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/clang_attrs_rs_api.rs b/rs_bindings_from_cc/test/golden/clang_attrs_rs_api.rs index bf75e0319..429d5e46f 100644 --- a/rs_bindings_from_cc/test/golden/clang_attrs_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/clang_attrs_rs_api.rs @@ -191,9 +191,9 @@ impl Default for HasCustomAlignmentWithGnuAttr { pub mod template_with_preferred_name { // Error while generating bindings for class 'template_with_preferred_name::SomeTemplate': // Class templates are not supported yet - // Error while generating bindings for type alias 'SpecializedTypeAlias': - // Can't generate bindings for SpecializedTypeAlias, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:clang_attrs_cc needs [//features:wrapper] for SpecializedTypeAlias (error: Can't generate bindings for template_with_preferred_name::SomeTemplate, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'template_with_preferred_name::SpecializedTypeAlias': + // Can't generate bindings for template_with_preferred_name::SpecializedTypeAlias, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:clang_attrs_cc needs [//features:wrapper] for template_with_preferred_name::SpecializedTypeAlias (error: Can't generate bindings for template_with_preferred_name::SomeTemplate, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:clang_attrs_cc needs [//features:wrapper] for template_with_preferred_name::SomeTemplate (crate::__CcTemplateInstN28template_with_preferred_name12SomeTemplateIiEE is a template instantiation) // //rs_bindings_from_cc/test/golden:clang_attrs_cc needs [//features:wrapper] for template_with_preferred_name::SomeTemplate (crate::__CcTemplateInstN28template_with_preferred_name12SomeTemplateIiEE is a template instantiation)) diff --git a/rs_bindings_from_cc/test/golden/comment_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/comment_rs_api_impl.cc index 445131745..e79232da8 100644 --- a/rs_bindings_from_cc/test/golden/comment_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/comment_rs_api_impl.cc @@ -29,7 +29,7 @@ extern "C" void __rust_thunk___ZN3FooC1Ev(struct Foo* __this) { extern "C" void __rust_thunk___Z3foov() { foo(); } -static_assert((void (*)())&foo); +static_assert((void (*)()) & ::foo); static_assert(CRUBIT_SIZEOF(struct Bar) == 4); static_assert(alignof(struct Bar) == 4); diff --git a/rs_bindings_from_cc/test/golden/compatibility_rs_api.rs b/rs_bindings_from_cc/test/golden/compatibility_rs_api.rs index 9d9fb3d3d..2287d81fa 100644 --- a/rs_bindings_from_cc/test/golden/compatibility_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/compatibility_rs_api.rs @@ -44,9 +44,9 @@ impl CompatibleType { } } -// Error while generating bindings for constructor 'CompatibleType::renamed_copy_constructor': -// Can't generate bindings for CompatibleType::renamed_copy_constructor, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:compatibility_cc needs [//features:experimental] for CompatibleType::renamed_copy_constructor (the type of __param_0 (parameter #1): references are not supported) +// Error while generating bindings for constructor 'CompatibleType::CompatibleType': +// Can't generate bindings for CompatibleType::CompatibleType, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:compatibility_cc needs [//features:experimental] for CompatibleType::CompatibleType (the type of __param_0 (parameter #1): references are not supported) // Error while generating bindings for function 'CompatibleType::operator=': // Can't generate bindings for CompatibleType::operator=, because of missing required features (crubit.rs-features): diff --git a/rs_bindings_from_cc/test/golden/composable_bridging_rs_api.rs b/rs_bindings_from_cc/test/golden/composable_bridging_rs_api.rs index 6b3385b7d..4be458766 100644 --- a/rs_bindings_from_cc/test/golden/composable_bridging_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/composable_bridging_rs_api.rs @@ -540,9 +540,9 @@ forward_declare::unsafe_define!( crate::__CcTemplateInstNSt3__u17basic_string_viewIwNS_11char_traitsIwEEEE ); -// Error while generating bindings for type alias 'traits_type': -// Can't generate bindings for traits_type, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for traits_type (error: Can't generate bindings for std::char_traits, because of missing required features (crubit.rs-features): +// Error while generating bindings for type alias 'std::basic_string_view>::traits_type': +// Can't generate bindings for std::basic_string_view>::traits_type, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::basic_string_view>::traits_type (error: Can't generate bindings for std::char_traits, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::char_traits (crate::__CcTemplateInstNSt3__u11char_traitsIwEE is a template instantiation)) // Error while generating bindings for type alias 'std::basic_string_view::value_type': @@ -566,22 +566,22 @@ forward_declare::unsafe_define!( // Error while generating bindings for type alias 'std::basic_string_view::iterator': // Unsupported type 'std::basic_string_view::const_iterator': Unsupported type 'const wchar_t': Unsupported type 'wchar_t': Unsupported builtin type -// Error while generating bindings for type alias 'const_reverse_iterator': -// Can't generate bindings for const_reverse_iterator, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): +// Error while generating bindings for type alias 'std::basic_string_view>::const_reverse_iterator': +// Can't generate bindings for std::basic_string_view>::const_reverse_iterator, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::basic_string_view>::const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::reverse_iterator (crate::__CcTemplateInstNSt3__u16reverse_iteratorIPKwEE is a template instantiation)) -// Error while generating bindings for type alias 'reverse_iterator': -// Can't generate bindings for reverse_iterator, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for reverse_iterator (error: Can't generate bindings for const_reverse_iterator, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): +// Error while generating bindings for type alias 'std::basic_string_view>::reverse_iterator': +// Can't generate bindings for std::basic_string_view>::reverse_iterator, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::basic_string_view>::reverse_iterator (error: Can't generate bindings for std::basic_string_view>::const_reverse_iterator, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::basic_string_view>::const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::reverse_iterator (crate::__CcTemplateInstNSt3__u16reverse_iteratorIPKwEE is a template instantiation))) -// Error while generating bindings for type alias 'size_type': -// Can't generate bindings for size_type, because it is unsupported: b/200067824: type definitions nested inside templated records are not yet supported +// Error while generating bindings for type alias 'std::basic_string_view>::size_type': +// Can't generate bindings for std::basic_string_view>::size_type, because it is unsupported: b/200067824: type definitions nested inside templated records are not yet supported -// Error while generating bindings for type alias 'difference_type': -// Can't generate bindings for difference_type, because it is unsupported: b/200067824: type definitions nested inside templated records are not yet supported +// Error while generating bindings for type alias 'std::basic_string_view>::difference_type': +// Can't generate bindings for std::basic_string_view>::difference_type, because it is unsupported: b/200067824: type definitions nested inside templated records are not yet supported // Error while generating bindings for global variable 'std::basic_string_view::npos': // static data members are not supported @@ -622,23 +622,23 @@ forward_declare::unsafe_define!( // Return type is not supported: Unsupported type 'std::basic_string_view::const_iterator': Unsupported type 'const wchar_t': Unsupported type 'wchar_t': Unsupported builtin type // Error while generating bindings for function 'std::basic_string_view>::rbegin': -// Cannot use an error type by value: Can't generate bindings for const_reverse_iterator, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): +// Cannot use an error type by value: Can't generate bindings for std::basic_string_view>::const_reverse_iterator, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::basic_string_view>::const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::reverse_iterator (crate::__CcTemplateInstNSt3__u16reverse_iteratorIPKwEE is a template instantiation)) // Error while generating bindings for function 'std::basic_string_view>::rend': -// Cannot use an error type by value: Can't generate bindings for const_reverse_iterator, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): +// Cannot use an error type by value: Can't generate bindings for std::basic_string_view>::const_reverse_iterator, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::basic_string_view>::const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::reverse_iterator (crate::__CcTemplateInstNSt3__u16reverse_iteratorIPKwEE is a template instantiation)) // Error while generating bindings for function 'std::basic_string_view>::crbegin': -// Cannot use an error type by value: Can't generate bindings for const_reverse_iterator, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): +// Cannot use an error type by value: Can't generate bindings for std::basic_string_view>::const_reverse_iterator, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::basic_string_view>::const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::reverse_iterator (crate::__CcTemplateInstNSt3__u16reverse_iteratorIPKwEE is a template instantiation)) // Error while generating bindings for function 'std::basic_string_view>::crend': -// Cannot use an error type by value: Can't generate bindings for const_reverse_iterator, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): +// Cannot use an error type by value: Can't generate bindings for std::basic_string_view>::const_reverse_iterator, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::basic_string_view>::const_reverse_iterator (error: Can't generate bindings for std::reverse_iterator, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:composable_bridging_cc needs [//features:wrapper] for std::reverse_iterator (crate::__CcTemplateInstNSt3__u16reverse_iteratorIPKwEE is a template instantiation)) // Error while generating bindings for function 'std::basic_string_view::size': diff --git a/rs_bindings_from_cc/test/golden/composable_bridging_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/composable_bridging_rs_api_impl.cc index 407bf2f1d..cbdaf66e5 100644 --- a/rs_bindings_from_cc/test/golden/composable_bridging_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/composable_bridging_rs_api_impl.cc @@ -25,7 +25,7 @@ extern "C" void __rust_thunk___Z15ReturnCppStructv( ::crubit::CppStructAbi(), __return_abi_buffer, ReturnCppStruct()); } -static_assert((struct CppStruct (*)())&ReturnCppStruct); +static_assert((struct CppStruct (*)()) & ::ReturnCppStruct); extern "C" void __rust_thunk___Z13TakeCppStruct9CppStruct( const unsigned char* __param_0) { @@ -33,7 +33,7 @@ extern "C" void __rust_thunk___Z13TakeCppStruct9CppStruct( ::crubit::CppStructAbi(), __param_0)); } -static_assert((void (*)(struct CppStruct))&TakeCppStruct); +static_assert((void (*)(struct CppStruct)) & ::TakeCppStruct); static_assert(CRUBIT_SIZEOF(struct Vec3) == 12); static_assert(alignof(struct Vec3) == 4); @@ -55,8 +55,8 @@ extern "C" void __rust_thunk___Z16MakeOptionalVec3fffb( __return_abi_buffer, MakeOptionalVec3(x, y, z, is_present)); } -static_assert((struct MyOption (*)(float, float, float, - bool))&MakeOptionalVec3); +static_assert((struct MyOption (*)(float, float, float, bool)) & + ::MakeOptionalVec3); extern "C" void __rust_thunk___Z11MapMultiply8MyOptionI4Vec3Ef( unsigned char* __return_abi_buffer, const unsigned char* v, float factor) { @@ -73,8 +73,8 @@ extern "C" void __rust_thunk___Z11MapMultiply8MyOptionI4Vec3Ef( factor)); } -static_assert((struct MyOption (*)(struct MyOption, - float))&MapMultiply); +static_assert((struct MyOption (*)(struct MyOption, float)) & + ::MapMultiply); extern "C" void __rust_thunk___Z14MakeMyI8Structv( unsigned char* __return_abi_buffer) { @@ -85,11 +85,12 @@ extern "C" void __rust_thunk___Z14MakeMyI8Structv( __return_abi_buffer, MakeMyI8Struct()); } -static_assert((struct MyOption (*)())&MakeMyI8Struct); +static_assert((struct MyOption (*)()) & ::MakeMyI8Struct); static_assert( - (void (*)(::rs_std::SliceRef>>))&InspectStringViews); + (void (*)(::rs_std::SliceRef< + class std::basic_string_view>>)) & + ::InspectStringViews); extern "C" void __rust_thunk___Z12MaybeVoidPtrv( unsigned char* __return_abi_buffer) { @@ -100,7 +101,7 @@ extern "C" void __rust_thunk___Z12MaybeVoidPtrv( __return_abi_buffer, MaybeVoidPtr()); } -static_assert((struct MyOption (*)())&MaybeVoidPtr); +static_assert((struct MyOption (*)()) & ::MaybeVoidPtr); extern "C" void __rust_thunk___Z40AcceptsSliceAndReturnsStatusErrorIfEmptyN6rs_std8SliceRefIKiEE( @@ -114,7 +115,8 @@ __rust_thunk___Z40AcceptsSliceAndReturnsStatusErrorIfEmptyN6rs_std8SliceRefIKiEE } static_assert((struct MyOption> (*)( - ::rs_std::SliceRef))&AcceptsSliceAndReturnsStatusErrorIfEmpty); + ::rs_std::SliceRef)) & + ::AcceptsSliceAndReturnsStatusErrorIfEmpty); extern "C" void __rust_thunk___Z16ReturnsCStrArrayv( unsigned char* __return_abi_buffer) { @@ -125,7 +127,7 @@ extern "C" void __rust_thunk___Z16ReturnsCStrArrayv( __return_abi_buffer, ReturnsCStrArray()); } -static_assert((struct MyOption (*)())&ReturnsCStrArray); +static_assert((struct MyOption (*)()) & ::ReturnsCStrArray); static_assert( CRUBIT_SIZEOF( diff --git a/rs_bindings_from_cc/test/golden/doc_comment_rs_api.rs b/rs_bindings_from_cc/test/golden/doc_comment_rs_api.rs index deb5ca497..c6339d6fc 100644 --- a/rs_bindings_from_cc/test/golden/doc_comment_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/doc_comment_rs_api.rs @@ -324,8 +324,9 @@ pub type MyTypeAlias = crate::DocCommentSlashes; // Class templates are not supported yet // Error while generating bindings for type alias 'ConcreteNestedStruct': -// Can't generate bindings for NestedStruct, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:doc_comment_cc needs [//features:wrapper] for NestedStruct (incomplete type) +// Can't generate bindings for ConcreteNestedStruct, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:doc_comment_cc needs [//features:wrapper] for ConcreteNestedStruct (error: Can't generate bindings for OuterTemplate::NestedStruct, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:doc_comment_cc needs [//features:wrapper] for OuterTemplate::NestedStruct (incomplete type)) // Error while generating bindings for struct 'MyTemplate': // Can't generate bindings for MyTemplate, because of missing required features (crubit.rs-features): diff --git a/rs_bindings_from_cc/test/golden/doc_comment_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/doc_comment_rs_api_impl.cc index 80156f6b8..ffe3bfd3f 100644 --- a/rs_bindings_from_cc/test/golden/doc_comment_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/doc_comment_rs_api_impl.cc @@ -22,13 +22,13 @@ static_assert(CRUBIT_SIZEOF(struct DocCommentSlashes) == 4); static_assert(alignof(struct DocCommentSlashes) == 4); static_assert(CRUBIT_OFFSET_OF(i, struct DocCommentSlashes) == 0); -static_assert((int (::DocCommentSlashes::*)() const) & - DocCommentSlashes::get_field_value); +static_assert((int (DocCommentSlashes::*)() const) & + ::DocCommentSlashes::get_field_value); -static_assert( - (void (::DocCommentSlashes::*)(int))&DocCommentSlashes::set_field_value); +static_assert((void (DocCommentSlashes::*)(int)) & + ::DocCommentSlashes::set_field_value); -static_assert((int (*)())&DocCommentSlashes::static_method); +static_assert((int (*)()) & ::DocCommentSlashes::static_method); static_assert(CRUBIT_SIZEOF(struct DocCommentBang) == 4); static_assert(alignof(struct DocCommentBang) == 4); @@ -67,6 +67,6 @@ extern "C" void __rust_thunk___ZN16MultilineOneStarC1Ev( extern "C" int __rust_thunk___Z3foov() { return foo(); } -static_assert((int (*)())&foo); +static_assert((int (*)()) & ::foo); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/escaping_keywords_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/escaping_keywords_rs_api_impl.cc index f9b48db99..c81590ff7 100644 --- a/rs_bindings_from_cc/test/golden/escaping_keywords_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/escaping_keywords_rs_api_impl.cc @@ -26,6 +26,6 @@ extern "C" void __rust_thunk___ZN4typeC1Ev(struct type* __this) { crubit::construct_at(__this); } -static_assert((void (*)(int))&impl); +static_assert((void (*)(int)) & ::impl); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/inheritance_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/inheritance_rs_api_impl.cc index c6287bac0..f496ffb0c 100644 --- a/rs_bindings_from_cc/test/golden/inheritance_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/inheritance_rs_api_impl.cc @@ -81,14 +81,14 @@ extern "C" void __rust_thunk___ZN11MethodBase1C1Ev(class MethodBase1* __this) { crubit::construct_at(__this); } -static_assert((void (::MethodBase1::*)())&MethodBase1::Public); +static_assert((void (MethodBase1::*)()) & ::MethodBase1::Public); -static_assert( - (void (::MethodBase1::*)(class MethodBase1 const*))&MethodBase1::Equals); +static_assert((void (MethodBase1::*)(class MethodBase1 const*)) & + ::MethodBase1::Equals); -static_assert((void (::MethodBase1::*)())&MethodBase1::Colliding1); +static_assert((void (MethodBase1::*)()) & ::MethodBase1::Colliding1); -static_assert((void (::MethodBase1::*)())&MethodBase1::Colliding2); +static_assert((void (MethodBase1::*)()) & ::MethodBase1::Colliding2); static_assert(sizeof(class MethodBase2) == 1); static_assert(alignof(class MethodBase2) == 1); @@ -97,9 +97,9 @@ extern "C" void __rust_thunk___ZN11MethodBase2C1Ev(class MethodBase2* __this) { crubit::construct_at(__this); } -static_assert((void (::MethodBase2::*)())&MethodBase2::Colliding1); +static_assert((void (MethodBase2::*)()) & ::MethodBase2::Colliding1); -static_assert((void (::MethodBase2::*)())&MethodBase2::Colliding2); +static_assert((void (MethodBase2::*)()) & ::MethodBase2::Colliding2); static_assert(sizeof(class MethodDerived) == 1); static_assert(alignof(class MethodDerived) == 1); diff --git a/rs_bindings_from_cc/test/golden/item_order_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/item_order_rs_api_impl.cc index 114b0910b..a223c8161 100644 --- a/rs_bindings_from_cc/test/golden/item_order_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/item_order_rs_api_impl.cc @@ -28,7 +28,7 @@ extern "C" void __rust_thunk___ZN11FirstStructC1Ev(struct FirstStruct* __this) { extern "C" int __rust_thunk___Z10first_funcv() { return first_func(); } -static_assert((int (*)())&first_func); +static_assert((int (*)()) & ::first_func); static_assert(CRUBIT_SIZEOF(struct SecondStruct) == 4); static_assert(alignof(struct SecondStruct) == 4); @@ -41,6 +41,6 @@ extern "C" void __rust_thunk___ZN12SecondStructC1Ev( extern "C" int __rust_thunk___Z11second_funcv() { return second_func(); } -static_assert((int (*)())&second_func); +static_assert((int (*)()) & ::second_func); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/lifetimes_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/lifetimes_rs_api_impl.cc index ad6e258a4..f122eb3d7 100644 --- a/rs_bindings_from_cc/test/golden/lifetimes_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/lifetimes_rs_api_impl.cc @@ -16,17 +16,18 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wthread-safety-analysis" -static_assert((void (*)(crubit::type_identity_t*))&AddHook); +static_assert((void (*)(crubit::type_identity_t*)) & ::AddHook); -static_assert((void (*)(crubit::type_identity_t*))&AddHookWithTypedef); +static_assert((void (*)(crubit::type_identity_t*)) & + ::AddHookWithTypedef); -static_assert((void (*)(crubit::type_identity_t&))&AddAnotherHook); +static_assert((void (*)(crubit::type_identity_t&)) & ::AddAnotherHook); -static_assert( - (void (*)(crubit::type_identity_t&))&AddAnotherHookWithTypedef); +static_assert((void (*)(crubit::type_identity_t&)) & + ::AddAnotherHookWithTypedef); -static_assert((void (*)(int*))&ConsumeArray); +static_assert((void (*)(int*)) & ::ConsumeArray); -static_assert((void (*)(int*))&ConsumeArrayWithTypedef); +static_assert((void (*)(int*)) & ::ConsumeArrayWithTypedef); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/method_qualifiers_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/method_qualifiers_rs_api_impl.cc index da44429ed..7ba444238 100644 --- a/rs_bindings_from_cc/test/golden/method_qualifiers_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/method_qualifiers_rs_api_impl.cc @@ -25,15 +25,15 @@ extern "C" void __rust_thunk___ZN9NoninlineC1Ev(struct Noninline* __this) { crubit::construct_at(__this); } -static_assert((void (::Noninline::*)())&Noninline::UnqualifiedMethod); +static_assert((void (Noninline::*)()) & ::Noninline::UnqualifiedMethod); -static_assert((void (::Noninline::*)() &)&Noninline::LvalueMethod); +static_assert((void (Noninline::*)() &)&::Noninline::LvalueMethod); -static_assert((void (::Noninline::*)() const&)&Noninline::LvalueMethodConst); +static_assert((void (Noninline::*)() const&)&::Noninline::LvalueMethodConst); -static_assert((void (::Noninline::*)() &&)&Noninline::RvalueMethod); +static_assert((void (Noninline::*)() &&)&::Noninline::RvalueMethod); -static_assert((void (::Noninline::*)() const&&)&Noninline::RvalueMethodConst); +static_assert((void (Noninline::*)() const&&)&::Noninline::RvalueMethodConst); static_assert(sizeof(struct Inline) == 1); static_assert(alignof(struct Inline) == 1); @@ -47,34 +47,34 @@ extern "C" void __rust_thunk___ZN6Inline17UnqualifiedMethodEv( __this->UnqualifiedMethod(); } -static_assert((void (::Inline::*)())&Inline::UnqualifiedMethod); +static_assert((void (Inline::*)()) & ::Inline::UnqualifiedMethod); extern "C" void __rust_thunk___ZNR6Inline12LvalueMethodEv( struct Inline* __this) { __this->LvalueMethod(); } -static_assert((void (::Inline::*)() &)&Inline::LvalueMethod); +static_assert((void (Inline::*)() &)&::Inline::LvalueMethod); extern "C" void __rust_thunk___ZNKR6Inline17LvalueMethodConstEv( struct Inline const* __this) { __this->LvalueMethodConst(); } -static_assert((void (::Inline::*)() const&)&Inline::LvalueMethodConst); +static_assert((void (Inline::*)() const&)&::Inline::LvalueMethodConst); extern "C" void __rust_thunk___ZNO6Inline12RvalueMethodEv( struct Inline* __this) { std::move(*__this).RvalueMethod(); } -static_assert((void (::Inline::*)() &&)&Inline::RvalueMethod); +static_assert((void (Inline::*)() &&)&::Inline::RvalueMethod); extern "C" void __rust_thunk___ZNKO6Inline17RvalueMethodConstEv( struct Inline const* __this) { std::move(*__this).RvalueMethodConst(); } -static_assert((void (::Inline::*)() const&&)&Inline::RvalueMethodConst); +static_assert((void (Inline::*)() const&&)&::Inline::RvalueMethodConst); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/namespace_rs_api.rs b/rs_bindings_from_cc/test/golden/namespace_rs_api.rs index aa395e3e6..4f7c9e6c4 100644 --- a/rs_bindings_from_cc/test/golden/namespace_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/namespace_rs_api.rs @@ -41,23 +41,23 @@ pub mod test_namespace_bindings { } } - // Error while generating bindings for constructor 'S::S': - // Can't generate bindings for S::S, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::S (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings::S::S': + // Can't generate bindings for test_namespace_bindings::S::S, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings::S::S (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for constructor 'S::S': - // Can't generate bindings for S::S, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::S (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings::S::S': + // Can't generate bindings for test_namespace_bindings::S::S, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings::S::S (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'S::operator=': - // Can't generate bindings for S::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings::S::operator=': + // Can't generate bindings for test_namespace_bindings::S::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings::S::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings::S::operator= (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'S::operator=': - // Can't generate bindings for S::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings::S::operator=': + // Can't generate bindings for test_namespace_bindings::S::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings::S::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings::S::operator= (the type of __param_0 (parameter #1): references are not supported) /// Free comment inside namespace #[inline(always)] @@ -136,23 +136,23 @@ pub mod test_namespace_bindings_reopened { } } - // Error while generating bindings for constructor 'S::S': - // Can't generate bindings for S::S, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::S (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings_reopened::inner::S::S': + // Can't generate bindings for test_namespace_bindings_reopened::inner::S::S, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_reopened::inner::S::S (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for constructor 'S::S': - // Can't generate bindings for S::S, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::S (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings_reopened::inner::S::S': + // Can't generate bindings for test_namespace_bindings_reopened::inner::S::S, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_reopened::inner::S::S (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'S::operator=': - // Can't generate bindings for S::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings_reopened::inner::S::operator=': + // Can't generate bindings for test_namespace_bindings_reopened::inner::S::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_reopened::inner::S::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_reopened::inner::S::operator= (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'S::operator=': - // Can't generate bindings for S::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for S::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings_reopened::inner::S::operator=': + // Can't generate bindings for test_namespace_bindings_reopened::inner::S::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_reopened::inner::S::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_reopened::inner::S::operator= (the type of __param_0 (parameter #1): references are not supported) #[inline(always)] pub fn z(mut s: crate::test_namespace_bindings_reopened::inner::S) { @@ -197,23 +197,23 @@ pub mod test_namespace_bindings_inline { } } - // Error while generating bindings for constructor 'StructInInlineNamespace::StructInInlineNamespace': - // Can't generate bindings for StructInInlineNamespace::StructInInlineNamespace, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for StructInInlineNamespace::StructInInlineNamespace (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings_inline::inner::StructInInlineNamespace::StructInInlineNamespace': + // Can't generate bindings for test_namespace_bindings_inline::inner::StructInInlineNamespace::StructInInlineNamespace, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_inline::inner::StructInInlineNamespace::StructInInlineNamespace (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for constructor 'StructInInlineNamespace::StructInInlineNamespace': - // Can't generate bindings for StructInInlineNamespace::StructInInlineNamespace, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for StructInInlineNamespace::StructInInlineNamespace (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings_inline::inner::StructInInlineNamespace::StructInInlineNamespace': + // Can't generate bindings for test_namespace_bindings_inline::inner::StructInInlineNamespace::StructInInlineNamespace, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_inline::inner::StructInInlineNamespace::StructInInlineNamespace (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'StructInInlineNamespace::operator=': - // Can't generate bindings for StructInInlineNamespace::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for StructInInlineNamespace::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for StructInInlineNamespace::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings_inline::inner::StructInInlineNamespace::operator=': + // Can't generate bindings for test_namespace_bindings_inline::inner::StructInInlineNamespace::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_inline::inner::StructInInlineNamespace::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_inline::inner::StructInInlineNamespace::operator= (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'StructInInlineNamespace::operator=': - // Can't generate bindings for StructInInlineNamespace::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for StructInInlineNamespace::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for StructInInlineNamespace::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings_inline::inner::StructInInlineNamespace::operator=': + // Can't generate bindings for test_namespace_bindings_inline::inner::StructInInlineNamespace::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_inline::inner::StructInInlineNamespace::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:namespace_cc needs [//features:experimental] for test_namespace_bindings_inline::inner::StructInInlineNamespace::operator= (the type of __param_0 (parameter #1): references are not supported) } #[allow(unused_imports)] pub use inner::*; diff --git a/rs_bindings_from_cc/test/golden/namespace_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/namespace_rs_api_impl.cc index 16ab11975..9db5ae23e 100644 --- a/rs_bindings_from_cc/test/golden/namespace_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/namespace_rs_api_impl.cc @@ -32,17 +32,17 @@ extern "C" int __rust_thunk___ZN23test_namespace_bindings1fENS_1SE( return test_namespace_bindings::f(std::move(*s)); } -static_assert( - (int (*)(struct test_namespace_bindings::S))&test_namespace_bindings::f); +static_assert((int (*)(struct test_namespace_bindings::S)) & + ::test_namespace_bindings::f); extern "C" void __rust_thunk___ZN23test_namespace_bindings15inline_functionEv() { test_namespace_bindings::inline_function(); } -static_assert((void (*)())&test_namespace_bindings::inline_function); +static_assert((void (*)()) & ::test_namespace_bindings::inline_function); -static_assert((void (*)())&test_namespace_bindings::inner::i); +static_assert((void (*)()) & ::test_namespace_bindings::inner::i); extern "C" void __rust_thunk___Z8identityN23test_namespace_bindings1SE( struct test_namespace_bindings::S* __return, @@ -50,10 +50,11 @@ extern "C" void __rust_thunk___Z8identityN23test_namespace_bindings1SE( new (__return) auto(identity(std::move(*s))); } -static_assert((struct test_namespace_bindings::S (*)( - struct test_namespace_bindings::S))&identity); +static_assert( + (struct test_namespace_bindings::S (*)(struct test_namespace_bindings::S)) & + ::identity); -static_assert((void (*)())&test_namespace_bindings_reopened::x); +static_assert((void (*)()) & ::test_namespace_bindings_reopened::x); static_assert(sizeof(struct test_namespace_bindings_reopened::inner::S) == 1); static_assert(alignof(struct test_namespace_bindings_reopened::inner::S) == 1); @@ -63,7 +64,7 @@ extern "C" void __rust_thunk___ZN32test_namespace_bindings_reopened5inner1SC1Ev( crubit::construct_at(__this); } -static_assert((void (*)())&test_namespace_bindings_reopened::y); +static_assert((void (*)()) & ::test_namespace_bindings_reopened::y); extern "C" void __rust_thunk___ZN32test_namespace_bindings_reopened5inner1zENS0_1SE( @@ -71,8 +72,8 @@ __rust_thunk___ZN32test_namespace_bindings_reopened5inner1zENS0_1SE( test_namespace_bindings_reopened::inner::z(std::move(*s)); } -static_assert((void (*)(struct test_namespace_bindings_reopened::inner:: - S))&test_namespace_bindings_reopened::inner::z); +static_assert((void (*)(struct test_namespace_bindings_reopened::inner::S)) & + ::test_namespace_bindings_reopened::inner::z); static_assert(sizeof(struct test_namespace_bindings_inline::inner:: StructInInlineNamespace) == 1); @@ -92,9 +93,9 @@ __rust_thunk___Z43useStructInInlineNamespaceWithFullQualifierN30test_namespace_b useStructInInlineNamespaceWithFullQualifier(std::move(*s)); } -static_assert((void (*)( - struct test_namespace_bindings_inline::inner:: - StructInInlineNamespace))&useStructInInlineNamespaceWithFullQualifier); +static_assert((void (*)(struct test_namespace_bindings_inline::inner:: + StructInInlineNamespace)) & + ::useStructInInlineNamespaceWithFullQualifier); extern "C" void __rust_thunk___Z45useStructInInlineNamespaceSkipInlineQualifierN30test_namespace_bindings_inline5inner23StructInInlineNamespaceE( @@ -102,12 +103,12 @@ __rust_thunk___Z45useStructInInlineNamespaceSkipInlineQualifierN30test_namespace useStructInInlineNamespaceSkipInlineQualifier(std::move(*s)); } -static_assert((void (*)( - struct test_namespace_bindings_inline::inner:: - StructInInlineNamespace))&useStructInInlineNamespaceSkipInlineQualifier); +static_assert((void (*)(struct test_namespace_bindings_inline::inner:: + StructInInlineNamespace)) & + ::useStructInInlineNamespaceSkipInlineQualifier); extern "C" void __rust_thunk___ZN4impl3fooEv() { impl::foo(); } -static_assert((void (*)())&impl::foo); +static_assert((void (*)()) & ::impl::foo); #pragma clang diagnostic pop 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 7adc0dc04..7619ffd8d 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 @@ -122,7 +122,7 @@ impl Default for already_snake_case { } } -// Error while generating bindings for struct 'Inner': +// Error while generating bindings for struct 'already_snake_case::Inner': // parent record has nested items, but the module to contain them could not be generated because another item named `already_snake_case` already exists #[derive(Clone, Copy, ::ctor::MoveAndAssignViaCopy)] @@ -151,7 +151,7 @@ impl Default for ConflictingSnakeCaseNames { } } -// Error while generating bindings for struct 'Inner': +// Error while generating bindings for struct 'ConflictingSnakeCaseNames::Inner': // records ["ConflictingSnakeCaseNames", "ConflictingSnakeCaseNames_"] all have nested items, but all map to the same nested module name: `conflicting_snake_case_names` #[derive(Clone, Copy, ::ctor::MoveAndAssignViaCopy)] @@ -182,7 +182,7 @@ impl Default for ConflictingSnakeCaseNames_ { } } -// Error while generating bindings for struct 'Inner': +// Error while generating bindings for struct 'ConflictingSnakeCaseNames_::Inner': // records ["ConflictingSnakeCaseNames", "ConflictingSnakeCaseNames_"] all have nested items, but all map to the same nested module name: `conflicting_snake_case_names` #[derive(Clone, Copy, ::ctor::MoveAndAssignViaCopy)] @@ -292,7 +292,7 @@ impl Default for SameNameAsNamespace { } } -// Error while generating bindings for struct 'Inner': +// Error while generating bindings for struct 'SameNameAsNamespace::Inner': // parent record has nested items, but the module to contain them could not be generated because another item named `same_name_as_namespace` already exists // namespace same_name_as_namespace @@ -382,7 +382,7 @@ pub mod no_longer_top_level { } } - // Error while generating bindings for struct 'Inner': + // Error while generating bindings for struct 'no_longer_top_level::already_snake_case::Inner': // parent record has nested items, but the module to contain them could not be generated because another item named `already_snake_case` already exists #[derive(Clone, Copy, ::ctor::MoveAndAssignViaCopy)] @@ -411,7 +411,7 @@ pub mod no_longer_top_level { } } - // Error while generating bindings for struct 'Inner': + // Error while generating bindings for struct 'no_longer_top_level::ConflictingSnakeCaseNames::Inner': // records ["ConflictingSnakeCaseNames", "ConflictingSnakeCaseNames_"] all have nested items, but all map to the same nested module name: `conflicting_snake_case_names` #[derive(Clone, Copy, ::ctor::MoveAndAssignViaCopy)] @@ -440,7 +440,7 @@ pub mod no_longer_top_level { } } - // Error while generating bindings for struct 'Inner': + // Error while generating bindings for struct 'no_longer_top_level::ConflictingSnakeCaseNames_::Inner': // records ["ConflictingSnakeCaseNames", "ConflictingSnakeCaseNames_"] all have nested items, but all map to the same nested module name: `conflicting_snake_case_names` #[derive(Clone, Copy, ::ctor::MoveAndAssignViaCopy)] @@ -554,7 +554,7 @@ pub mod no_longer_top_level { } } - // Error while generating bindings for struct 'Inner': + // Error while generating bindings for struct 'no_longer_top_level::SameNameAsNamespace::Inner': // parent record has nested items, but the module to contain them could not be generated because another item named `same_name_as_namespace` already exists // namespace same_name_as_namespace diff --git a/rs_bindings_from_cc/test/golden/no_elided_lifetimes_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/no_elided_lifetimes_rs_api_impl.cc index b192cd130..270d7e75f 100644 --- a/rs_bindings_from_cc/test/golden/no_elided_lifetimes_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/no_elided_lifetimes_rs_api_impl.cc @@ -18,7 +18,7 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wthread-safety-analysis" -static_assert((int& (*)(int&)) & free_function); +static_assert((int& (*)(int&)) & ::free_function); static_assert(sizeof(struct S) == 1); static_assert(alignof(struct S) == 1); @@ -27,9 +27,9 @@ extern "C" void __rust_thunk___ZN1SC1Ev(struct S* __this) { crubit::construct_at(__this); } -static_assert((int& (::S::*)(int&, int&) const) & S::const_method); +static_assert((int& (S::*)(int&, int&) const) & ::S::const_method); -static_assert((int& (::S::*)(int&, int&)) & S::method); +static_assert((int& (S::*)(int&, int&)) & ::S::method); static_assert(sizeof(struct TriviallyCopyableButNontriviallyDestructible) == 1); static_assert(alignof(struct TriviallyCopyableButNontriviallyDestructible) == @@ -49,7 +49,7 @@ __rust_thunk___ZN44TriviallyCopyableButNontriviallyDestructibleC1ERKS_( crubit::construct_at(__this, *__param_0); } -static_assert((void (*)(int*))&take_pointer); +static_assert((void (*)(int*)) & ::take_pointer); static_assert(CRUBIT_SIZEOF(class WrappedValue) == 4); static_assert(alignof(class WrappedValue) == 4); diff --git a/rs_bindings_from_cc/test/golden/no_unique_address_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/no_unique_address_rs_api_impl.cc index 45ef1275e..94ca14626 100644 --- a/rs_bindings_from_cc/test/golden/no_unique_address_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/no_unique_address_rs_api_impl.cc @@ -32,7 +32,7 @@ extern "C" void __rust_thunk___ZN6Struct4MakeEic(struct Struct* __return, new (__return) auto(Struct::Make(f1, f2)); } -static_assert((struct Struct (*)(int, char))&Struct::Make); +static_assert((struct Struct (*)(int, char)) & ::Struct::Make); static_assert(CRUBIT_SIZEOF(struct PaddingBetweenFields) == 8); static_assert(alignof(struct PaddingBetweenFields) == 4); @@ -49,8 +49,8 @@ extern "C" void __rust_thunk___ZN20PaddingBetweenFields4MakeEci( new (__return) auto(PaddingBetweenFields::Make(f1, f2)); } -static_assert( - (struct PaddingBetweenFields (*)(char, int))&PaddingBetweenFields::Make); +static_assert((struct PaddingBetweenFields (*)(char, int)) & + ::PaddingBetweenFields::Make); static_assert(CRUBIT_SIZEOF(struct FieldInTailPadding_InnerStruct) == 8); static_assert(alignof(struct FieldInTailPadding_InnerStruct) == 4); diff --git a/rs_bindings_from_cc/test/golden/noexcept_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/noexcept_rs_api_impl.cc index ddd8b3270..c9b9c0537 100644 --- a/rs_bindings_from_cc/test/golden/noexcept_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/noexcept_rs_api_impl.cc @@ -25,18 +25,18 @@ extern "C" void __rust_thunk___ZN9SomeClassC1Ev(class SomeClass* __this) { crubit::construct_at(__this); } -static_assert((void (*)(int, char))&SomeClass::create); +static_assert((void (*)(int, char)) & ::SomeClass::create); -static_assert((void (::SomeClass::*)())&SomeClass::no_except_member); +static_assert((void (SomeClass::*)()) & ::SomeClass::no_except_member); -static_assert((void (::SomeClass::*)())&SomeClass::no_except_true_member); +static_assert((void (SomeClass::*)()) & ::SomeClass::no_except_true_member); -static_assert((void (::SomeClass::*)())&SomeClass::no_except_false_member); +static_assert((void (SomeClass::*)()) & ::SomeClass::no_except_false_member); -static_assert((void (*)())&no_except); +static_assert((void (*)()) & ::no_except); -static_assert((void (*)())&no_except_true); +static_assert((void (*)()) & ::no_except_true); -static_assert((void (*)())&no_except_false); +static_assert((void (*)()) & ::no_except_false); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/nontrivial_type_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/nontrivial_type_rs_api_impl.cc index 67497b156..9f64d3b7b 100644 --- a/rs_bindings_from_cc/test/golden/nontrivial_type_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/nontrivial_type_rs_api_impl.cc @@ -28,14 +28,14 @@ extern "C" void __rust_thunk___ZN10NontrivialaSEf(struct Nontrivial* __return, new (__return) auto(__this->operator=(__param_0)); } -static_assert((void (::Nontrivial::*)())&Nontrivial::Unqualified); +static_assert((void (Nontrivial::*)()) & ::Nontrivial::Unqualified); -static_assert((void (::Nontrivial::*)() const) & Nontrivial::ConstQualified); +static_assert((void (Nontrivial::*)() const) & ::Nontrivial::ConstQualified); -static_assert((void (::Nontrivial::*)() &)&Nontrivial::LvalueRefQualified); +static_assert((void (Nontrivial::*)() &)&::Nontrivial::LvalueRefQualified); -static_assert((void (::Nontrivial::*)() - const&)&Nontrivial::ConstLvalueRefQualified); +static_assert((void (Nontrivial::*)() + const&)&::Nontrivial::ConstLvalueRefQualified); static_assert(CRUBIT_SIZEOF(struct NontrivialInline) == 4); static_assert(alignof(struct NontrivialInline) == 4); @@ -66,8 +66,8 @@ extern "C" void __rust_thunk___ZN16NontrivialInline14MemberFunctionEv( __this->MemberFunction(); } -static_assert( - (void (::NontrivialInline::*)())&NontrivialInline::MemberFunction); +static_assert((void (NontrivialInline::*)()) & + ::NontrivialInline::MemberFunction); static_assert(CRUBIT_SIZEOF(struct NontrivialMembers) == 4); static_assert(alignof(struct NontrivialMembers) == 4); @@ -88,30 +88,31 @@ static_assert(CRUBIT_SIZEOF(struct NontrivialUnpin) == 4); static_assert(alignof(struct NontrivialUnpin) == 4); static_assert(CRUBIT_OFFSET_OF(field, struct NontrivialUnpin) == 0); -static_assert((void (::NontrivialUnpin::*)())&NontrivialUnpin::MemberFunction); +static_assert((void (NontrivialUnpin::*)()) & + ::NontrivialUnpin::MemberFunction); extern "C" void __rust_thunk___Z12TakesByValue10Nontrivial( struct Nontrivial* __return, struct Nontrivial* nontrivial) { new (__return) auto(TakesByValue(std::move(*nontrivial))); } -static_assert((struct Nontrivial (*)(struct Nontrivial))&TakesByValue); +static_assert((struct Nontrivial (*)(struct Nontrivial)) & ::TakesByValue); extern "C" void __rust_thunk___Z18TakesByValueInline16NontrivialInline( struct NontrivialInline* __return, struct NontrivialInline* nontrivial) { new (__return) auto(TakesByValueInline(std::move(*nontrivial))); } -static_assert( - (struct NontrivialInline (*)(struct NontrivialInline))&TakesByValueInline); +static_assert((struct NontrivialInline (*)(struct NontrivialInline)) & + ::TakesByValueInline); extern "C" void __rust_thunk___Z17TakesByValueUnpin15NontrivialUnpin( struct NontrivialUnpin* __return, struct NontrivialUnpin* nontrivial) { new (__return) auto(TakesByValueUnpin(std::move(*nontrivial))); } -static_assert( - (struct NontrivialUnpin (*)(struct NontrivialUnpin))&TakesByValueUnpin); +static_assert((struct NontrivialUnpin (*)(struct NontrivialUnpin)) & + ::TakesByValueUnpin); static_assert(sizeof(struct NontrivialByValue) == 1); static_assert(alignof(struct NontrivialByValue) == 1); @@ -125,13 +126,13 @@ extern "C" void __rust_thunk___ZN17NontrivialByValueaSE10Nontrivial( static_assert(sizeof(struct Nonmovable) == 1); static_assert(alignof(struct Nonmovable) == 1); -static_assert((void (::Nonmovable::*)())&Nonmovable::MemberFunction); +static_assert((void (Nonmovable::*)()) & ::Nonmovable::MemberFunction); extern "C" void __rust_thunk___Z24ReturnsNonmovableByValuev( struct Nonmovable* __return) { new (__return) auto(ReturnsNonmovableByValue()); } -static_assert((struct Nonmovable (*)())&ReturnsNonmovableByValue); +static_assert((struct Nonmovable (*)()) & ::ReturnsNonmovableByValue); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/overloads_rs_api.rs b/rs_bindings_from_cc/test/golden/overloads_rs_api.rs index c4ff099a7..6ab61e9c7 100644 --- a/rs_bindings_from_cc/test/golden/overloads_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/overloads_rs_api.rs @@ -82,15 +82,15 @@ impl Default for Foo { } } -// Error while generating bindings for function 'Foo::BarBridgedInt': -// Can't generate bindings for Foo::BarBridgedInt, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:overloads_cc needs [//features:wrapper] for Foo::BarBridgedInt (the type of __param_0 (parameter #1): error: Can't generate bindings for Sizeof, because of missing required features (crubit.rs-features): +// Error while generating bindings for function 'Foo::Bar': +// Can't generate bindings for Foo::Bar, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:overloads_cc needs [//features:wrapper] for Foo::Bar (the type of __param_0 (parameter #1): error: Can't generate bindings for Sizeof, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:overloads_cc needs [//features:wrapper] for Sizeof (crate::__CcTemplateInst6SizeofIiE is a template instantiation) // //rs_bindings_from_cc/test/golden:overloads_cc needs [//features:wrapper] for Sizeof (crate::__CcTemplateInst6SizeofIiE is a template instantiation)) -// Error while generating bindings for function 'Foo::BarBridgedFloat': -// Can't generate bindings for Foo::BarBridgedFloat, because of missing required features (crubit.rs-features): -// //rs_bindings_from_cc/test/golden:overloads_cc needs [//features:wrapper] for Foo::BarBridgedFloat (the type of __param_0 (parameter #1): error: Can't generate bindings for Sizeof, because of missing required features (crubit.rs-features): +// Error while generating bindings for function 'Foo::Bar': +// Can't generate bindings for Foo::Bar, because of missing required features (crubit.rs-features): +// //rs_bindings_from_cc/test/golden:overloads_cc needs [//features:wrapper] for Foo::Bar (the type of __param_0 (parameter #1): error: Can't generate bindings for Sizeof, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:overloads_cc needs [//features:wrapper] for Sizeof (crate::__CcTemplateInst6SizeofIfE is a template instantiation) // //rs_bindings_from_cc/test/golden:overloads_cc needs [//features:wrapper] for Sizeof (crate::__CcTemplateInst6SizeofIfE is a template instantiation)) diff --git a/rs_bindings_from_cc/test/golden/overloads_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/overloads_rs_api_impl.cc index 3254e5c84..7b39c048d 100644 --- a/rs_bindings_from_cc/test/golden/overloads_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/overloads_rs_api_impl.cc @@ -18,15 +18,15 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wthread-safety-analysis" -static_assert((void (*)())&Overload2); +static_assert((void (*)()) & ::Overload2); -static_assert((void (*)(int))&Overlaod2); +static_assert((void (*)(int)) & ::Overlaod2); extern "C" void __rust_thunk___Z20AlsoTemplateOverloadv() { AlsoTemplateOverload(); } -static_assert((void (*)())&AlsoTemplateOverload); +static_assert((void (*)()) & ::AlsoTemplateOverload); static_assert(sizeof(class Foo) == 1); static_assert(alignof(class Foo) == 1); @@ -35,6 +35,6 @@ extern "C" void __rust_thunk___ZN3FooC1Ev(class Foo* __this) { crubit::construct_at(__this); } -static_assert((void (::Foo::*)(int))&Foo::Bar); +static_assert((void (Foo::*)(int)) & ::Foo::Bar); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/overloads_unsupported_template_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/overloads_unsupported_template_rs_api_impl.cc index 5f9942b3e..f38b65efd 100644 --- a/rs_bindings_from_cc/test/golden/overloads_unsupported_template_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/overloads_unsupported_template_rs_api_impl.cc @@ -18,6 +18,6 @@ extern "C" void __rust_thunk___Z8Overloadv() { Overload(); } -static_assert((void (*)())&Overload); +static_assert((void (*)()) & ::Overload); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/polymorphic_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/polymorphic_rs_api_impl.cc index 2359586f4..baaada145 100644 --- a/rs_bindings_from_cc/test/golden/polymorphic_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/polymorphic_rs_api_impl.cc @@ -44,7 +44,7 @@ extern "C" void __rust_thunk___ZN16PolymorphicBase23FooEv( __this->Foo(); } -static_assert((void (::PolymorphicBase2::*)())&PolymorphicBase2::Foo); +static_assert((void (PolymorphicBase2::*)()) & ::PolymorphicBase2::Foo); extern "C" void __rust_thunk___ZN16PolymorphicBase2D1Ev( class PolymorphicBase2* __this) { diff --git a/rs_bindings_from_cc/test/golden/private_members_rs_api.rs b/rs_bindings_from_cc/test/golden/private_members_rs_api.rs index 93e53a9be..3ff6d69be 100644 --- a/rs_bindings_from_cc/test/golden/private_members_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/private_members_rs_api.rs @@ -61,23 +61,23 @@ pub mod test_namespace_bindings { } } - // Error while generating bindings for constructor 'SomeClass::SomeClass': - // Can't generate bindings for SomeClass::SomeClass, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for SomeClass::SomeClass (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings::SomeClass::SomeClass': + // Can't generate bindings for test_namespace_bindings::SomeClass::SomeClass, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for test_namespace_bindings::SomeClass::SomeClass (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for constructor 'SomeClass::SomeClass': - // Can't generate bindings for SomeClass::SomeClass, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for SomeClass::SomeClass (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings::SomeClass::SomeClass': + // Can't generate bindings for test_namespace_bindings::SomeClass::SomeClass, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for test_namespace_bindings::SomeClass::SomeClass (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'SomeClass::operator=': - // Can't generate bindings for SomeClass::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for SomeClass::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for SomeClass::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings::SomeClass::operator=': + // Can't generate bindings for test_namespace_bindings::SomeClass::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for test_namespace_bindings::SomeClass::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for test_namespace_bindings::SomeClass::operator= (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'SomeClass::operator=': - // Can't generate bindings for SomeClass::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for SomeClass::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for SomeClass::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings::SomeClass::operator=': + // Can't generate bindings for test_namespace_bindings::SomeClass::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for test_namespace_bindings::SomeClass::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:private_members_cc needs [//features:experimental] for test_namespace_bindings::SomeClass::operator= (the type of __param_0 (parameter #1): references are not supported) } // namespace test_namespace_bindings diff --git a/rs_bindings_from_cc/test/golden/private_members_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/private_members_rs_api_impl.cc index 31e8863d2..3f18bbfe1 100644 --- a/rs_bindings_from_cc/test/golden/private_members_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/private_members_rs_api_impl.cc @@ -28,11 +28,10 @@ extern "C" void __rust_thunk___ZN23test_namespace_bindings9SomeClassC1Ev( crubit::construct_at(__this); } -static_assert( - (void (::test_namespace_bindings::SomeClass::*)())&test_namespace_bindings:: - SomeClass::public_method); +static_assert((void (test_namespace_bindings::SomeClass::*)()) & + ::test_namespace_bindings::SomeClass::public_method); -static_assert( - (void (*)())&test_namespace_bindings::SomeClass::public_static_method); +static_assert((void (*)()) & + ::test_namespace_bindings::SomeClass::public_static_method); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/static_methods_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/static_methods_rs_api_impl.cc index f086a08ad..d0644ab78 100644 --- a/rs_bindings_from_cc/test/golden/static_methods_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/static_methods_rs_api_impl.cc @@ -30,9 +30,9 @@ extern "C" void __rust_thunk___ZN9SomeClass21static_factory_methodEi( new (__return) auto(SomeClass::static_factory_method(initial_value_of_field)); } -static_assert((class SomeClass (*)(int))&SomeClass::static_factory_method); +static_assert((class SomeClass (*)(int)) & ::SomeClass::static_factory_method); -static_assert((int (*)(int, - int))&SomeClass::static_method_that_multiplies_its_args); +static_assert((int (*)(int, int)) & + ::SomeClass::static_method_that_multiplies_its_args); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/template_inst_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/template_inst_rs_api_impl.cc index f0ac87c69..6a5badf4c 100644 --- a/rs_bindings_from_cc/test/golden/template_inst_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/template_inst_rs_api_impl.cc @@ -23,7 +23,7 @@ extern "C" void __rust_thunk___Z13GetMyTemplatev( new (__return) auto(GetMyTemplate()); } -static_assert((struct MyTemplate (*)())&GetMyTemplate); +static_assert((struct MyTemplate (*)()) & ::GetMyTemplate); static_assert(CRUBIT_SIZEOF(struct MyTemplate) == 4); static_assert(alignof(struct MyTemplate) == 4); diff --git a/rs_bindings_from_cc/test/golden/templates_rs_api.rs b/rs_bindings_from_cc/test/golden/templates_rs_api.rs index 6fdd87b74..b21738ea4 100644 --- a/rs_bindings_from_cc/test/golden/templates_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/templates_rs_api.rs @@ -60,15 +60,15 @@ pub mod test_namespace_bindings { // Error while generating bindings for class 'test_namespace_bindings::MyTemplate': // Class templates are not supported yet - // Error while generating bindings for type alias 'MyTypeAlias': - // Can't generate bindings for MyTypeAlias, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for MyTypeAlias (error: Can't generate bindings for test_namespace_bindings::MyTemplate, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::MyTypeAlias': + // Can't generate bindings for test_namespace_bindings::MyTypeAlias, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyTypeAlias (error: Can't generate bindings for test_namespace_bindings::MyTemplate, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyTemplate (crate::__CcTemplateInstN23test_namespace_bindings10MyTemplateIiEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyTemplate (crate::__CcTemplateInstN23test_namespace_bindings10MyTemplateIiEE is a template instantiation)) - // Error while generating bindings for type alias 'OtherTypeAliasInSameTarget': - // Can't generate bindings for OtherTypeAliasInSameTarget, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for OtherTypeAliasInSameTarget (error: Can't generate bindings for test_namespace_bindings::MyTemplate, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::OtherTypeAliasInSameTarget': + // Can't generate bindings for test_namespace_bindings::OtherTypeAliasInSameTarget, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::OtherTypeAliasInSameTarget (error: Can't generate bindings for test_namespace_bindings::MyTemplate, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyTemplate (crate::__CcTemplateInstN23test_namespace_bindings10MyTemplateIiEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyTemplate (crate::__CcTemplateInstN23test_namespace_bindings10MyTemplateIiEE is a template instantiation)) @@ -98,48 +98,48 @@ pub mod test_namespace_bindings { } } - // Error while generating bindings for constructor 'TemplateParam::TemplateParam': - // Can't generate bindings for TemplateParam::TemplateParam, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for TemplateParam::TemplateParam (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings::TemplateParam::TemplateParam': + // Can't generate bindings for test_namespace_bindings::TemplateParam::TemplateParam, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for test_namespace_bindings::TemplateParam::TemplateParam (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for constructor 'TemplateParam::TemplateParam': - // Can't generate bindings for TemplateParam::TemplateParam, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for TemplateParam::TemplateParam (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'test_namespace_bindings::TemplateParam::TemplateParam': + // Can't generate bindings for test_namespace_bindings::TemplateParam::TemplateParam, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for test_namespace_bindings::TemplateParam::TemplateParam (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'TemplateParam::operator=': - // Can't generate bindings for TemplateParam::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for TemplateParam::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for TemplateParam::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings::TemplateParam::operator=': + // Can't generate bindings for test_namespace_bindings::TemplateParam::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for test_namespace_bindings::TemplateParam::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for test_namespace_bindings::TemplateParam::operator= (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'TemplateParam::operator=': - // Can't generate bindings for TemplateParam::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for TemplateParam::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for TemplateParam::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'test_namespace_bindings::TemplateParam::operator=': + // Can't generate bindings for test_namespace_bindings::TemplateParam::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for test_namespace_bindings::TemplateParam::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for test_namespace_bindings::TemplateParam::operator= (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for type alias 'TemplateWithStructTemplateParam': - // Can't generate bindings for TemplateWithStructTemplateParam, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for TemplateWithStructTemplateParam (error: Can't generate bindings for test_namespace_bindings::MyTemplate, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::TemplateWithStructTemplateParam': + // Can't generate bindings for test_namespace_bindings::TemplateWithStructTemplateParam, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::TemplateWithStructTemplateParam (error: Can't generate bindings for test_namespace_bindings::MyTemplate, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyTemplate (crate::__CcTemplateInstN23test_namespace_bindings10MyTemplateINS_13TemplateParamEEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyTemplate (crate::__CcTemplateInstN23test_namespace_bindings10MyTemplateINS_13TemplateParamEEE is a template instantiation)) - // Error while generating bindings for type alias 'ParamFromDifferentScope': - // Can't generate bindings for ParamFromDifferentScope, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for ParamFromDifferentScope (error: Can't generate bindings for test_namespace_bindings::MyTemplate, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::ParamFromDifferentScope': + // Can't generate bindings for test_namespace_bindings::ParamFromDifferentScope, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::ParamFromDifferentScope (error: Can't generate bindings for test_namespace_bindings::MyTemplate, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyTemplate (crate::__CcTemplateInstN23test_namespace_bindings10MyTemplateI14DifferentScopeEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyTemplate (crate::__CcTemplateInstN23test_namespace_bindings10MyTemplateI14DifferentScopeEE is a template instantiation)) // Error while generating bindings for class 'test_namespace_bindings::TemplateWithTwoParams': // Class templates are not supported yet - // Error while generating bindings for type alias 'AliasToTemplateWithTwoParams': - // Can't generate bindings for AliasToTemplateWithTwoParams, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for AliasToTemplateWithTwoParams (error: Can't generate bindings for test_namespace_bindings::TemplateWithTwoParams, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::AliasToTemplateWithTwoParams': + // Can't generate bindings for test_namespace_bindings::AliasToTemplateWithTwoParams, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::AliasToTemplateWithTwoParams (error: Can't generate bindings for test_namespace_bindings::TemplateWithTwoParams, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::TemplateWithTwoParams (crate::__CcTemplateInstN23test_namespace_bindings21TemplateWithTwoParamsIifEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::TemplateWithTwoParams (crate::__CcTemplateInstN23test_namespace_bindings21TemplateWithTwoParamsIifEE is a template instantiation)) - // Error while generating bindings for type alias 'AliasToTemplateOfATemplate': - // Can't generate bindings for AliasToTemplateOfATemplate, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for AliasToTemplateOfATemplate (error: Can't generate bindings for test_namespace_bindings::TemplateWithTwoParams, int>, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::AliasToTemplateOfATemplate': + // Can't generate bindings for test_namespace_bindings::AliasToTemplateOfATemplate, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::AliasToTemplateOfATemplate (error: Can't generate bindings for test_namespace_bindings::TemplateWithTwoParams, int>, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::TemplateWithTwoParams, int> (crate::__CcTemplateInstN23test_namespace_bindings21TemplateWithTwoParamsINS0_IiiEEiEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::TemplateWithTwoParams, int> (crate::__CcTemplateInstN23test_namespace_bindings21TemplateWithTwoParamsINS0_IiiEEiEE is a template instantiation)) @@ -152,9 +152,9 @@ pub mod test_namespace_bindings { // Explicit class template specialization with definition should be imported // even when not instantiated if there is a type alias for it. - // Error while generating bindings for type alias 'MyCharStruct': - // Can't generate bindings for MyCharStruct, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for MyCharStruct (error: Can't generate bindings for test_namespace_bindings::MyStruct, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::MyCharStruct': + // Can't generate bindings for test_namespace_bindings::MyCharStruct, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyCharStruct (error: Can't generate bindings for test_namespace_bindings::MyStruct, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyStruct (crate::__CcTemplateInstN23test_namespace_bindings8MyStructIcEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for test_namespace_bindings::MyStruct (crate::__CcTemplateInstN23test_namespace_bindings8MyStructIcEE is a template instantiation)) @@ -191,9 +191,9 @@ pub mod template_template_params { // Error while generating bindings for class // Error while generating bindings for class 'template_template_params::MyTemplate': // Class templates are not supported yet - // Error while generating bindings for type alias 'MyTypeAlias': - // Can't generate bindings for MyTypeAlias, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for MyTypeAlias (error: Can't generate bindings for template_template_params::MyTemplate, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'template_template_params::MyTypeAlias': + // Can't generate bindings for template_template_params::MyTypeAlias, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for template_template_params::MyTypeAlias (error: Can't generate bindings for template_template_params::MyTemplate, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for template_template_params::MyTemplate (crate::__CcTemplateInstN24template_template_params10MyTemplateINS_6PolicyEEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for template_template_params::MyTemplate (crate::__CcTemplateInstN24template_template_params10MyTemplateINS_6PolicyEEE is a template instantiation)) } @@ -203,9 +203,9 @@ pub mod template_template_params { // Error while generating bindings for class pub mod forward_declared_template { // Error while generating bindings for class 'forward_declared_template::ForwardDeclaredTemplate': // Class templates are not supported yet - // Error while generating bindings for type alias 'TypeAliasToForwardDeclaredTemplate': - // Can't generate bindings for TypeAliasToForwardDeclaredTemplate, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for TypeAliasToForwardDeclaredTemplate (error: Can't generate bindings for forward_declared_template::ForwardDeclaredTemplate, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'forward_declared_template::TypeAliasToForwardDeclaredTemplate': + // Can't generate bindings for forward_declared_template::TypeAliasToForwardDeclaredTemplate, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for forward_declared_template::TypeAliasToForwardDeclaredTemplate (error: Can't generate bindings for forward_declared_template::ForwardDeclaredTemplate, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:wrapper] for forward_declared_template::ForwardDeclaredTemplate (incomplete type)) } @@ -225,23 +225,23 @@ pub mod private_classes { type Kind = ::cxx::kind::Trivial; } - // Error while generating bindings for constructor 'HasPrivateType::HasPrivateType': - // Can't generate bindings for HasPrivateType::HasPrivateType, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for HasPrivateType::HasPrivateType (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'private_classes::HasPrivateType::HasPrivateType': + // Can't generate bindings for private_classes::HasPrivateType::HasPrivateType, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for private_classes::HasPrivateType::HasPrivateType (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for constructor 'HasPrivateType::HasPrivateType': - // Can't generate bindings for HasPrivateType::HasPrivateType, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for HasPrivateType::HasPrivateType (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'private_classes::HasPrivateType::HasPrivateType': + // Can't generate bindings for private_classes::HasPrivateType::HasPrivateType, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for private_classes::HasPrivateType::HasPrivateType (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'HasPrivateType::operator=': - // Can't generate bindings for HasPrivateType::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for HasPrivateType::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for HasPrivateType::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'private_classes::HasPrivateType::operator=': + // Can't generate bindings for private_classes::HasPrivateType::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for private_classes::HasPrivateType::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for private_classes::HasPrivateType::operator= (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'HasPrivateType::operator=': - // Can't generate bindings for HasPrivateType::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for HasPrivateType::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for HasPrivateType::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'private_classes::HasPrivateType::operator=': + // Can't generate bindings for private_classes::HasPrivateType::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for private_classes::HasPrivateType::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:templates_cc needs [//features:experimental] for private_classes::HasPrivateType::operator= (the type of __param_0 (parameter #1): references are not supported) } // namespace private_classes diff --git a/rs_bindings_from_cc/test/golden/templates_source_order_rs_api.rs b/rs_bindings_from_cc/test/golden/templates_source_order_rs_api.rs index d75621bac..c58e065d9 100644 --- a/rs_bindings_from_cc/test/golden/templates_source_order_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/templates_source_order_rs_api.rs @@ -104,21 +104,21 @@ pub mod test_namespace_bindings { } } - // Error while generating bindings for type alias 'Alias7': - // Can't generate bindings for Alias7, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for Alias7 (error: Can't generate bindings for MyTemplate, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::Alias7': + // Can't generate bindings for test_namespace_bindings::Alias7, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for test_namespace_bindings::Alias7 (error: Can't generate bindings for MyTemplate, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for MyTemplate (crate::__CcTemplateInst10MyTemplateIcE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for MyTemplate (crate::__CcTemplateInst10MyTemplateIcE is a template instantiation)) - // Error while generating bindings for type alias 'Alias8': - // Can't generate bindings for Alias8, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for Alias8 (error: Can't generate bindings for MyTemplate, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::Alias8': + // Can't generate bindings for test_namespace_bindings::Alias8, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for test_namespace_bindings::Alias8 (error: Can't generate bindings for MyTemplate, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for MyTemplate (crate::__CcTemplateInst10MyTemplateIN23test_namespace_bindings5InnerEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for MyTemplate (crate::__CcTemplateInst10MyTemplateIN23test_namespace_bindings5InnerEE is a template instantiation)) - // Error while generating bindings for type alias 'Alias9': - // Can't generate bindings for Alias9, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for Alias9 (error: Can't generate bindings for MyTemplate>, because of missing required features (crubit.rs-features): + // Error while generating bindings for type alias 'test_namespace_bindings::Alias9': + // Can't generate bindings for test_namespace_bindings::Alias9, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for test_namespace_bindings::Alias9 (error: Can't generate bindings for MyTemplate>, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for MyTemplate> (crate::__CcTemplateInst10MyTemplateIS_IN23test_namespace_bindings5InnerEEE is a template instantiation) // //rs_bindings_from_cc/test/golden:templates_source_order_cc needs [//features:wrapper] for MyTemplate> (crate::__CcTemplateInst10MyTemplateIS_IN23test_namespace_bindings5InnerEEE is a template instantiation)) } diff --git a/rs_bindings_from_cc/test/golden/trivial_type_rs_api.rs b/rs_bindings_from_cc/test/golden/trivial_type_rs_api.rs index 8df69ebd7..f79aee399 100644 --- a/rs_bindings_from_cc/test/golden/trivial_type_rs_api.rs +++ b/rs_bindings_from_cc/test/golden/trivial_type_rs_api.rs @@ -61,31 +61,31 @@ pub mod ns { } } - // Error while generating bindings for constructor 'Trivial::Trivial': - // Can't generate bindings for Trivial::Trivial, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for Trivial::Trivial (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'ns::Trivial::Trivial': + // Can't generate bindings for ns::Trivial::Trivial, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::Trivial::Trivial (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for constructor 'Trivial::Trivial': - // Can't generate bindings for Trivial::Trivial, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for Trivial::Trivial (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for constructor 'ns::Trivial::Trivial': + // Can't generate bindings for ns::Trivial::Trivial, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::Trivial::Trivial (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'Trivial::operator=': - // Can't generate bindings for Trivial::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for Trivial::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for Trivial::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'ns::Trivial::operator=': + // Can't generate bindings for ns::Trivial::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::Trivial::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::Trivial::operator= (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'Trivial::operator=': - // Can't generate bindings for Trivial::operator=, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for Trivial::operator= (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for Trivial::operator= (the type of __param_0 (parameter #1): references are not supported) + // Error while generating bindings for function 'ns::Trivial::operator=': + // Can't generate bindings for ns::Trivial::operator=, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::Trivial::operator= (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::Trivial::operator= (the type of __param_0 (parameter #1): references are not supported) - // Error while generating bindings for function 'Trivial::RvalueRefQualified': - // Can't generate bindings for Trivial::RvalueRefQualified, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for Trivial::RvalueRefQualified (the type of __this (parameter #0): references are not supported) + // Error while generating bindings for function 'ns::Trivial::RvalueRefQualified': + // Can't generate bindings for ns::Trivial::RvalueRefQualified, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::Trivial::RvalueRefQualified (the type of __this (parameter #0): references are not supported) - // Error while generating bindings for function 'Trivial::ConstRvalueRefQualified': - // Can't generate bindings for Trivial::ConstRvalueRefQualified, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for Trivial::ConstRvalueRefQualified (the type of __this (parameter #0): references are not supported) + // Error while generating bindings for function 'ns::Trivial::ConstRvalueRefQualified': + // Can't generate bindings for ns::Trivial::ConstRvalueRefQualified, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::Trivial::ConstRvalueRefQualified (the type of __this (parameter #0): references are not supported) #[inline(always)] pub fn TakesByValue(mut trivial: crate::ns::Trivial) -> crate::ns::Trivial { @@ -99,25 +99,25 @@ pub mod ns { } } - // Error while generating bindings for function 'TakesByReference': - // Can't generate bindings for TakesByReference, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for TakesByReference (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for TakesByReference (the type of trivial (parameter #0): references are not supported) - - // Error while generating bindings for function 'TakesByConstReference': - // Can't generate bindings for TakesByConstReference, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for TakesByConstReference (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for TakesByConstReference (the type of trivial (parameter #0): references are not supported) - - // Error while generating bindings for function 'TakesByRvalueReference': - // Can't generate bindings for TakesByRvalueReference, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for TakesByRvalueReference (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for TakesByRvalueReference (the type of trivial (parameter #0): references are not supported) - - // Error while generating bindings for function 'TakesByConstRvalueReference': - // Can't generate bindings for TakesByConstRvalueReference, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for TakesByConstRvalueReference (return type: references are not supported) - // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for TakesByConstRvalueReference (the type of trivial (parameter #0): references are not supported) + // Error while generating bindings for function 'ns::TakesByReference': + // Can't generate bindings for ns::TakesByReference, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::TakesByReference (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::TakesByReference (the type of trivial (parameter #0): references are not supported) + + // Error while generating bindings for function 'ns::TakesByConstReference': + // Can't generate bindings for ns::TakesByConstReference, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::TakesByConstReference (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::TakesByConstReference (the type of trivial (parameter #0): references are not supported) + + // Error while generating bindings for function 'ns::TakesByRvalueReference': + // Can't generate bindings for ns::TakesByRvalueReference, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::TakesByRvalueReference (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::TakesByRvalueReference (the type of trivial (parameter #0): references are not supported) + + // Error while generating bindings for function 'ns::TakesByConstRvalueReference': + // Can't generate bindings for ns::TakesByConstRvalueReference, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::TakesByConstRvalueReference (return type: references are not supported) + // //rs_bindings_from_cc/test/golden:trivial_type_cc needs [//features:experimental] for ns::TakesByConstRvalueReference (the type of trivial (parameter #0): references are not supported) } // namespace ns diff --git a/rs_bindings_from_cc/test/golden/trivial_type_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/trivial_type_rs_api_impl.cc index dfbeb2b6f..842944758 100644 --- a/rs_bindings_from_cc/test/golden/trivial_type_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/trivial_type_rs_api_impl.cc @@ -26,20 +26,21 @@ extern "C" void __rust_thunk___ZN2ns7TrivialC1Ev(struct ns::Trivial* __this) { crubit::construct_at(__this); } -static_assert((void (::ns::Trivial::*)())&ns::Trivial::Unqualified); +static_assert((void (ns::Trivial::*)()) & ::ns::Trivial::Unqualified); -static_assert((void (::ns::Trivial::*)() const) & ns::Trivial::ConstQualified); +static_assert((void (ns::Trivial::*)() const) & ::ns::Trivial::ConstQualified); -static_assert((void (::ns::Trivial::*)() &)&ns::Trivial::LvalueRefQualified); +static_assert((void (ns::Trivial::*)() &)&::ns::Trivial::LvalueRefQualified); -static_assert((void (::ns::Trivial::*)() - const&)&ns::Trivial::ConstLvalueRefQualified); +static_assert((void (ns::Trivial::*)() + const&)&::ns::Trivial::ConstLvalueRefQualified); extern "C" void __rust_thunk___ZN2ns12TakesByValueENS_7TrivialE( struct ns::Trivial* __return, struct ns::Trivial* trivial) { new (__return) auto(ns::TakesByValue(std::move(*trivial))); } -static_assert((struct ns::Trivial (*)(struct ns::Trivial))&ns::TakesByValue); +static_assert((struct ns::Trivial (*)(struct ns::Trivial)) & + ::ns::TakesByValue); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/typedefs_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/typedefs_rs_api_impl.cc index 717102779..48e2edc80 100644 --- a/rs_bindings_from_cc/test/golden/typedefs_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/typedefs_rs_api_impl.cc @@ -47,6 +47,6 @@ extern "C" void __rust_thunk___ZN14SomeOtherUnionC1Ev(SomeOtherUnion* __this) { crubit::construct_at(__this); } -static_assert((SomeStruct::nested_type (*)())&FunctionUsingNestedType); +static_assert((SomeStruct::nested_type (*)()) & ::FunctionUsingNestedType); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/types_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/types_rs_api_impl.cc index 71ebe11ce..972d96d9f 100644 --- a/rs_bindings_from_cc/test/golden/types_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/types_rs_api_impl.cc @@ -92,7 +92,7 @@ extern "C" void __rust_thunk___Z21VoidReturningFunctionv() { VoidReturningFunction(); } -static_assert((void (*)())&VoidReturningFunction); +static_assert((void (*)()) & ::VoidReturningFunction); extern "C" crubit::type_identity_t* __rust_thunk___Z32FunctionPointerReturningFunctionv() { @@ -100,13 +100,13 @@ __rust_thunk___Z32FunctionPointerReturningFunctionv() { } static_assert((crubit::type_identity_t * (*)()) & - FunctionPointerReturningFunction); + ::FunctionPointerReturningFunction); extern "C" void* __rust_thunk___Z24FunctionWithVoidPointersPvPKv( void* __param_0, void const* __param_1) { return FunctionWithVoidPointers(__param_0, __param_1); } -static_assert((void* (*)(void*, void const*)) & FunctionWithVoidPointers); +static_assert((void* (*)(void*, void const*)) & ::FunctionWithVoidPointers); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/unsafe_attrs_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/unsafe_attrs_rs_api_impl.cc index ef0effa6b..fdcf8c1d7 100644 --- a/rs_bindings_from_cc/test/golden/unsafe_attrs_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/unsafe_attrs_rs_api_impl.cc @@ -18,22 +18,22 @@ extern "C" bool __rust_thunk___ZL11ReturnsTruev() { return ReturnsTrue(); } -static_assert((bool (*)())&ReturnsTrue); +static_assert((bool (*)()) & ::ReturnsTrue); extern "C" bool __rust_thunk___ZL12ReturnsFalsev() { return ReturnsFalse(); } -static_assert((bool (*)())&ReturnsFalse); +static_assert((bool (*)()) & ::ReturnsFalse); -static_assert((void (*)())&TotallySafe); +static_assert((void (*)()) & ::TotallySafe); -static_assert((void (*)(void*))&TotallyUnsafe); +static_assert((void (*)(void*)) & ::TotallyUnsafe); -static_assert((void (*)())&SafeSignatureButAnnotatedUnsafe); +static_assert((void (*)()) & ::SafeSignatureButAnnotatedUnsafe); -static_assert((void (*)())&SafeSignatureButAnnotatedSafe); +static_assert((void (*)()) & ::SafeSignatureButAnnotatedSafe); -static_assert((void (*)(void*))&UnsafeSignatureButAnnotatedUnsafe); +static_assert((void (*)(void*)) & ::UnsafeSignatureButAnnotatedUnsafe); -static_assert((void (*)(void*))&UnsafeSignatureButAnnotatedSafe); +static_assert((void (*)(void*)) & ::UnsafeSignatureButAnnotatedSafe); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/unsafe_types_transitive_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/unsafe_types_transitive_rs_api_impl.cc index 1e10f45a5..b56faac0f 100644 --- a/rs_bindings_from_cc/test/golden/unsafe_types_transitive_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/unsafe_types_transitive_rs_api_impl.cc @@ -59,14 +59,14 @@ extern "C" void __rust_thunk___ZN5UnionC1Ev(union Union* __this) { crubit::construct_at(__this); } -static_assert((int (*)(int*))&DerefPointer); +static_assert((int (*)(int*)) & ::DerefPointer); extern "C" int __rust_thunk___Z18DerefPublicPointer13PublicPointer( struct PublicPointer* p) { return DerefPublicPointer(std::move(*p)); } -static_assert((int (*)(struct PublicPointer))&DerefPublicPointer); +static_assert((int (*)(struct PublicPointer)) & ::DerefPublicPointer); extern "C" int __rust_thunk___Z28DerefTransitivePublicPointer23TransitivePublicPointer( @@ -74,13 +74,13 @@ __rust_thunk___Z28DerefTransitivePublicPointer23TransitivePublicPointer( return DerefTransitivePublicPointer(std::move(*p)); } -static_assert( - (int (*)(struct TransitivePublicPointer))&DerefTransitivePublicPointer); +static_assert((int (*)(struct TransitivePublicPointer)) & + ::DerefTransitivePublicPointer); extern "C" int __rust_thunk___Z9ReadUnion5Union(union Union* u) { return ReadUnion(std::move(*u)); } -static_assert((int (*)(union Union))&ReadUnion); +static_assert((int (*)(union Union)) & ::ReadUnion); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/golden/user_of_imported_type_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/user_of_imported_type_rs_api_impl.cc index 9c971f5a5..a718d4bbe 100644 --- a/rs_bindings_from_cc/test/golden/user_of_imported_type_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/user_of_imported_type_rs_api_impl.cc @@ -23,7 +23,8 @@ extern "C" void __rust_thunk___Z16UsesImportedTypeN2ns7TrivialE( new (__return) auto(UsesImportedType(std::move(*t))); } -static_assert((struct ns::Trivial (*)(struct ns::Trivial))&UsesImportedType); +static_assert((struct ns::Trivial (*)(struct ns::Trivial)) & + ::UsesImportedType); static_assert(CRUBIT_SIZEOF(struct UserOfImportedType) == 8); static_assert(alignof(struct UserOfImportedType) == 8); diff --git a/rs_bindings_from_cc/test/golden/user_of_unsupported_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/user_of_unsupported_rs_api_impl.cc index 81baec621..8c66ba38d 100644 --- a/rs_bindings_from_cc/test/golden/user_of_unsupported_rs_api_impl.cc +++ b/rs_bindings_from_cc/test/golden/user_of_unsupported_rs_api_impl.cc @@ -23,6 +23,7 @@ extern "C" void __rust_thunk___Z23UseNontrivialCustomType20NontrivialCustomType( UseNontrivialCustomType(std::move(*non_trivial_custom_type)); } -static_assert((void (*)(struct NontrivialCustomType))&UseNontrivialCustomType); +static_assert((void (*)(struct NontrivialCustomType)) & + ::UseNontrivialCustomType); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/namespace/inline/inline_api_impl.cc b/rs_bindings_from_cc/test/namespace/inline/inline_api_impl.cc index f017a6908..7e2420386 100644 --- a/rs_bindings_from_cc/test/namespace/inline/inline_api_impl.cc +++ b/rs_bindings_from_cc/test/namespace/inline/inline_api_impl.cc @@ -33,31 +33,31 @@ extern "C" int __rust_thunk___ZN3foo7inline115GetStructValue1EPKNS0_8MyStructE( return foo::inline1::GetStructValue1(s); } -static_assert((int (*)( - struct foo::inline1::MyStruct const*))&foo::inline1::GetStructValue1); +static_assert((int (*)(struct foo::inline1::MyStruct const*)) & + ::foo::inline1::GetStructValue1); extern "C" int __rust_thunk___ZN3foo7inline115GetStructValue2EPKNS0_8MyStructE( struct foo::inline1::MyStruct const* s) { return foo::inline1::GetStructValue2(s); } -static_assert((int (*)( - struct foo::inline1::MyStruct const*))&foo::inline1::GetStructValue2); +static_assert((int (*)(struct foo::inline1::MyStruct const*)) & + ::foo::inline1::GetStructValue2); extern "C" int __rust_thunk___ZN3foo7inline115GetStructValue3EPKNS0_8MyStructE( struct foo::inline1::MyStruct const* s) { return foo::inline1::GetStructValue3(s); } -static_assert((int (*)( - struct foo::inline1::MyStruct const*))&foo::inline1::GetStructValue3); +static_assert((int (*)(struct foo::inline1::MyStruct const*)) & + ::foo::inline1::GetStructValue3); extern "C" int __rust_thunk___ZN3foo7inline115GetStructValue4EPKNS0_8MyStructE( struct foo::inline1::MyStruct const* s) { return foo::inline1::GetStructValue4(s); } -static_assert((int (*)( - struct foo::inline1::MyStruct const*))&foo::inline1::GetStructValue4); +static_assert((int (*)(struct foo::inline1::MyStruct const*)) & + ::foo::inline1::GetStructValue4); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/struct/destructors/destructors_api_impl.cc b/rs_bindings_from_cc/test/struct/destructors/destructors_api_impl.cc index 54d661610..d6da29c76 100644 --- a/rs_bindings_from_cc/test/struct/destructors/destructors_api_impl.cc +++ b/rs_bindings_from_cc/test/struct/destructors/destructors_api_impl.cc @@ -45,11 +45,12 @@ extern "C" void __rust_thunk___ZN24DestructionOrderRecorderD1Ev( std::destroy_at(__this); } -static_assert((void (*)(int))&DestructionOrderRecorder::RecordDestruction); +static_assert((void (*)(int)) & ::DestructionOrderRecorder::RecordDestruction); -static_assert((int (*)())&DestructionOrderRecorder::GetDestructionRecord); +static_assert((int (*)()) & ::DestructionOrderRecorder::GetDestructionRecord); -static_assert((void (*)())&DestructionOrderRecorder::ClearDestructionRecord); +static_assert((void (*)()) & + ::DestructionOrderRecorder::ClearDestructionRecord); static_assert(CRUBIT_SIZEOF(class FieldDestructionOrderTester) == 12); static_assert(alignof(class FieldDestructionOrderTester) == 4); @@ -82,9 +83,11 @@ __rust_thunk___ZN27FieldDestructionOrderTester6CreateE24DestructionOrderRecorder std::move(*field1), std::move(*field2), std::move(*field3))); } -static_assert((class FieldDestructionOrderTester (*)( - class DestructionOrderRecorder, class DestructionOrderRecorder, - class DestructionOrderRecorder))&FieldDestructionOrderTester::Create); +static_assert( + (class FieldDestructionOrderTester (*)(class DestructionOrderRecorder, + class DestructionOrderRecorder, + class DestructionOrderRecorder)) & + ::FieldDestructionOrderTester::Create); extern "C" void __rust_thunk___ZN27FieldDestructionOrderTester15DestructFromCppEiii( @@ -92,7 +95,7 @@ __rust_thunk___ZN27FieldDestructionOrderTester15DestructFromCppEiii( FieldDestructionOrderTester::DestructFromCpp(field1, field2, field3); } -static_assert((void (*)(int, int, - int))&FieldDestructionOrderTester::DestructFromCpp); +static_assert((void (*)(int, int, int)) & + ::FieldDestructionOrderTester::DestructFromCpp); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/struct/methods_qualifiers/methods_qualifiers_api_impl.cc b/rs_bindings_from_cc/test/struct/methods_qualifiers/methods_qualifiers_api_impl.cc index a5ab37e80..b4dc785fe 100644 --- a/rs_bindings_from_cc/test/struct/methods_qualifiers/methods_qualifiers_api_impl.cc +++ b/rs_bindings_from_cc/test/struct/methods_qualifiers/methods_qualifiers_api_impl.cc @@ -29,31 +29,29 @@ extern "C" void __rust_thunk___ZN34UnpinStructWithRefQualifiedMethodsC1Ev( crubit::construct_at(__this); } -static_assert((void ( - ::UnpinStructWithRefQualifiedMethods::*)())&UnpinStructWithRefQualifiedMethods:: - increment_i); +static_assert((void (UnpinStructWithRefQualifiedMethods::*)()) & + ::UnpinStructWithRefQualifiedMethods::increment_i); -static_assert((int ( - ::UnpinStructWithRefQualifiedMethods::*)())&UnpinStructWithRefQualifiedMethods:: - unqualified_get_i); +static_assert((int (UnpinStructWithRefQualifiedMethods::*)()) & + ::UnpinStructWithRefQualifiedMethods::unqualified_get_i); -static_assert((int (::UnpinStructWithRefQualifiedMethods::*)() const) & - UnpinStructWithRefQualifiedMethods::const_qualified_get_i); +static_assert((int (UnpinStructWithRefQualifiedMethods::*)() const) & + ::UnpinStructWithRefQualifiedMethods::const_qualified_get_i); -static_assert((int ( - ::UnpinStructWithRefQualifiedMethods::*)() &)&UnpinStructWithRefQualifiedMethods:: - lvalue_ref_qualified_get_i); +static_assert( + (int (UnpinStructWithRefQualifiedMethods::*)() &)&:: + UnpinStructWithRefQualifiedMethods::lvalue_ref_qualified_get_i); -static_assert((int (::UnpinStructWithRefQualifiedMethods::*)() - const&)&UnpinStructWithRefQualifiedMethods:: +static_assert((int (UnpinStructWithRefQualifiedMethods::*)() + const&)&::UnpinStructWithRefQualifiedMethods:: const_lvalue_ref_qualified_get_i); -static_assert((int ( - ::UnpinStructWithRefQualifiedMethods::*)() &&)&UnpinStructWithRefQualifiedMethods:: - rvalue_ref_qualified_get_i); +static_assert( + (int (UnpinStructWithRefQualifiedMethods::*)() &&)&:: + UnpinStructWithRefQualifiedMethods::rvalue_ref_qualified_get_i); -static_assert((int (::UnpinStructWithRefQualifiedMethods::*)() - const&&)&UnpinStructWithRefQualifiedMethods:: +static_assert((int (UnpinStructWithRefQualifiedMethods::*)() + const&&)&::UnpinStructWithRefQualifiedMethods:: const_rvalue_ref_qualified_get_i); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/struct/operator_and/operator_and.golden.cc b/rs_bindings_from_cc/test/struct/operator_and/operator_and.golden.cc index 51eb04b3b..fa48cdb14 100644 --- a/rs_bindings_from_cc/test/struct/operator_and/operator_and.golden.cc +++ b/rs_bindings_from_cc/test/struct/operator_and/operator_and.golden.cc @@ -30,13 +30,13 @@ extern "C" class MyBadClass* __rust_thunk___ZN10MyBadClass7ReturnsEv() { return std::addressof(MyBadClass::Returns()); } -static_assert((class MyBadClass & (*)()) & MyBadClass::Returns); +static_assert((class MyBadClass & (*)()) & ::MyBadClass::Returns); extern "C" void __rust_thunk___ZN10MyBadClass7AcceptsERS_( class MyBadClass* __param_0) { MyBadClass::Accepts(*__param_0); } -static_assert((void (*)(class MyBadClass&))&MyBadClass::Accepts); +static_assert((void (*)(class MyBadClass&)) & ::MyBadClass::Accepts); #pragma clang diagnostic pop diff --git a/rs_bindings_from_cc/test/templates/regression_401857961/repro_rs_api.rs b/rs_bindings_from_cc/test/templates/regression_401857961/repro_rs_api.rs index e356d9181..b60cd5aa7 100644 --- a/rs_bindings_from_cc/test/templates/regression_401857961/repro_rs_api.rs +++ b/rs_bindings_from_cc/test/templates/regression_401857961/repro_rs_api.rs @@ -53,9 +53,9 @@ pub mod repro { // Class templates are not supported yet // Generated from: rs_bindings_from_cc/test/templates/regression_401857961/repro.h;l=24 - // Error while generating bindings for function 'crash': - // Can't generate bindings for crash, because of missing required features (crubit.rs-features): - // //rs_bindings_from_cc/test/templates/regression_401857961:repro needs [//features:wrapper] for crash (the type of __param_0 (parameter #0): error: Can't generate bindings for repro::Nullable, because of missing required features (crubit.rs-features): + // Error while generating bindings for function 'repro::crash': + // Can't generate bindings for repro::crash, because of missing required features (crubit.rs-features): + // //rs_bindings_from_cc/test/templates/regression_401857961:repro needs [//features:wrapper] for repro::crash (the type of __param_0 (parameter #0): error: Can't generate bindings for repro::Nullable, because of missing required features (crubit.rs-features): // //rs_bindings_from_cc/test/templates/regression_401857961:repro needs [//features:wrapper] for repro::Nullable (crate::__CcTemplateInstN5repro8NullableINS_8IntervalEEE is a template instantiation) // //rs_bindings_from_cc/test/templates/regression_401857961:repro needs [//features:wrapper] for repro::Nullable (crate::__CcTemplateInstN5repro8NullableINS_8IntervalEEE is a template instantiation)) } diff --git a/rs_bindings_from_cc/test/templates/type_alias/type_alias_api_impl.cc b/rs_bindings_from_cc/test/templates/type_alias/type_alias_api_impl.cc index e1d89a8a3..9947904a5 100644 --- a/rs_bindings_from_cc/test/templates/type_alias/type_alias_api_impl.cc +++ b/rs_bindings_from_cc/test/templates/type_alias/type_alias_api_impl.cc @@ -34,7 +34,7 @@ __rust_thunk___ZN10MyTemplateIiE6CreateEi__2f_2fthird_5fparty_2fcrubit_2frs_5fbi new (__return) auto(MyTemplate::Create(value)); } -static_assert((class MyTemplate (*)(int))&MyTemplate::Create); +static_assert((class MyTemplate (*)(int)) & ::MyTemplate::Create); extern "C" int const* __rust_thunk___ZNK10MyTemplateIiE5valueEv__2f_2fthird_5fparty_2fcrubit_2frs_5fbindings_5ffrom_5fcc_2ftest_2ftemplates_2ftype_5falias_3atype_5falias( @@ -42,7 +42,7 @@ __rust_thunk___ZNK10MyTemplateIiE5valueEv__2f_2fthird_5fparty_2fcrubit_2frs_5fbi return std::addressof(__this->value()); } -static_assert((int const& (::MyTemplate::*)() const) & - MyTemplate::value); +static_assert((int const& (MyTemplate::*)() const) & + ::MyTemplate::value); #pragma clang diagnostic pop