1414#![ allow( deprecated) ]
1515#![ deny( warnings) ]
1616
17- // error: function `deprecated_function` could not be bound
18- // [[deprecated]] attribute
17+ #[ deprecated]
18+ #[ inline( always) ]
19+ pub fn deprecated_function ( ) {
20+ unsafe { crate :: detail:: __rust_thunk___Z19deprecated_functionv ( ) }
21+ }
22+
23+ #[ deprecated = "old" ]
24+ #[ inline( always) ]
25+ pub fn deprecated_function_with_message ( ) {
26+ unsafe { crate :: detail:: __rust_thunk___Z32deprecated_function_with_messagev ( ) }
27+ }
28+
29+ #[ derive( Clone , Copy , :: ctor:: MoveAndAssignViaCopy ) ]
30+ #[ deprecated]
31+ #[ repr( C ) ]
32+ ///CRUBIT_ANNOTATE: cpp_type=DeprecatedStruct
33+ pub struct DeprecatedStruct {
34+ __non_field_data : [ :: core:: mem:: MaybeUninit < u8 > ; 1 ] ,
35+ }
36+ impl !Send for DeprecatedStruct { }
37+ impl !Sync for DeprecatedStruct { }
38+ unsafe impl :: cxx:: ExternType for DeprecatedStruct {
39+ type Id = :: cxx:: type_id!( "DeprecatedStruct" ) ;
40+ type Kind = :: cxx:: kind:: Trivial ;
41+ }
1942
20- // error: function `deprecated_function_with_message` could not be bound
21- // [[deprecated]] attribute
43+ impl Default for DeprecatedStruct {
44+ #[ inline( always) ]
45+ fn default ( ) -> Self {
46+ let mut tmp = :: core:: mem:: MaybeUninit :: < Self > :: zeroed ( ) ;
47+ unsafe {
48+ crate :: detail:: __rust_thunk___ZN16DeprecatedStructC1Ev ( & raw mut tmp as * mut _ ) ;
49+ tmp. assume_init ( )
50+ }
51+ }
52+ }
2253
23- // error: struct `DeprecatedStruct` could not be bound
24- // [[deprecated]] attribute
54+ #[ derive( Clone , Copy , :: ctor:: MoveAndAssignViaCopy ) ]
55+ #[ deprecated = "old" ]
56+ #[ repr( C ) ]
57+ ///CRUBIT_ANNOTATE: cpp_type=DeprecatedStructWithMessage
58+ pub struct DeprecatedStructWithMessage {
59+ __non_field_data : [ :: core:: mem:: MaybeUninit < u8 > ; 1 ] ,
60+ }
61+ impl !Send for DeprecatedStructWithMessage { }
62+ impl !Sync for DeprecatedStructWithMessage { }
63+ unsafe impl :: cxx:: ExternType for DeprecatedStructWithMessage {
64+ type Id = :: cxx:: type_id!( "DeprecatedStructWithMessage" ) ;
65+ type Kind = :: cxx:: kind:: Trivial ;
66+ }
2567
26- // error: struct `DeprecatedStructWithMessage` could not be bound
27- // [[deprecated]] attribute
68+ impl Default for DeprecatedStructWithMessage {
69+ #[ inline( always) ]
70+ fn default ( ) -> Self {
71+ let mut tmp = :: core:: mem:: MaybeUninit :: < Self > :: zeroed ( ) ;
72+ unsafe {
73+ crate :: detail:: __rust_thunk___ZN27DeprecatedStructWithMessageC1Ev (
74+ & raw mut tmp as * mut _ ,
75+ ) ;
76+ tmp. assume_init ( )
77+ }
78+ }
79+ }
2880
29- // error: enum `DeprecatedEnum` could not be bound
30- // [[deprecated]] attribute
81+ #[ repr( transparent) ]
82+ #[ derive( Debug , PartialEq , Eq , Copy , Clone , Hash , PartialOrd , Ord ) ]
83+ #[ deprecated]
84+ ///CRUBIT_ANNOTATE: cpp_type=DeprecatedEnum
85+ pub struct DeprecatedEnum ( :: ffi_11:: c_uint ) ;
86+ impl DeprecatedEnum { }
87+ impl From < :: ffi_11:: c_uint > for DeprecatedEnum {
88+ fn from ( value : :: ffi_11:: c_uint ) -> DeprecatedEnum {
89+ DeprecatedEnum ( value)
90+ }
91+ }
92+ impl From < DeprecatedEnum > for :: ffi_11:: c_uint {
93+ fn from ( value : DeprecatedEnum ) -> :: ffi_11:: c_uint {
94+ value. 0
95+ }
96+ }
3197
32- // error: enum `DeprecatedEnumWithMessage` could not be bound
33- // [[deprecated]] attribute
98+ #[ repr( transparent) ]
99+ #[ derive( Debug , PartialEq , Eq , Copy , Clone , Hash , PartialOrd , Ord ) ]
100+ #[ deprecated = "old" ]
101+ ///CRUBIT_ANNOTATE: cpp_type=DeprecatedEnumWithMessage
102+ pub struct DeprecatedEnumWithMessage ( :: ffi_11:: c_uint ) ;
103+ impl DeprecatedEnumWithMessage { }
104+ impl From < :: ffi_11:: c_uint > for DeprecatedEnumWithMessage {
105+ fn from ( value : :: ffi_11:: c_uint ) -> DeprecatedEnumWithMessage {
106+ DeprecatedEnumWithMessage ( value)
107+ }
108+ }
109+ impl From < DeprecatedEnumWithMessage > for :: ffi_11:: c_uint {
110+ fn from ( value : DeprecatedEnumWithMessage ) -> :: ffi_11:: c_uint {
111+ value. 0
112+ }
113+ }
34114
35- // error: namespace `DeprecatedNamespace` could not be bound
36- // [[deprecated]] attribute
115+ #[ deprecated]
116+ pub mod DeprecatedNamespace {
117+ #[ inline( always) ]
118+ pub fn f ( ) {
119+ unsafe { crate :: detail:: __rust_thunk___ZN19DeprecatedNamespace1fEv ( ) }
120+ }
121+ }
37122
38123// namespace DeprecatedNamespace
39124
40- // error: namespace `DeprecatedNamespaceWithMessage` could not be bound
41- // [[deprecated]] attribute
125+ #[ deprecated = "old" ]
126+ pub mod DeprecatedNamespaceWithMessage {
127+ #[ inline( always) ]
128+ pub fn f ( ) {
129+ unsafe { crate :: detail:: __rust_thunk___ZN30DeprecatedNamespaceWithMessage1fEv ( ) }
130+ }
131+ }
42132
43133// namespace DeprecatedNamespaceWithMessage
44134
47137///CRUBIT_ANNOTATE: cpp_type=DeprecatedEnumerators
48138pub struct DeprecatedEnumerators ( :: ffi_11:: c_uint ) ;
49139impl DeprecatedEnumerators {
50- // Omitting bindings for kDeprecatedEnumerator
51- // reason: marked as deprecated; requires experimental
52- // Omitting bindings for kDeprecatedEnumeratorWithMessage
53- // reason: marked as deprecated; requires experimental
140+ #[ deprecated]
141+ pub const kDeprecatedEnumerator: DeprecatedEnumerators =
142+ DeprecatedEnumerators ( :: ffi_11:: new_c_uint ( 0 ) ) ;
143+ #[ deprecated = "old" ]
144+ pub const kDeprecatedEnumeratorWithMessage: DeprecatedEnumerators =
145+ DeprecatedEnumerators ( :: ffi_11:: new_c_uint ( 1 ) ) ;
54146}
55147impl From < :: ffi_11:: c_uint > for DeprecatedEnumerators {
56148 fn from ( value : :: ffi_11:: c_uint ) -> DeprecatedEnumerators {
@@ -63,22 +155,20 @@ impl From<DeprecatedEnumerators> for ::ffi_11::c_uint {
63155 }
64156}
65157
66- // error: type alias `DeprecatedUsing` could not be bound
67- // [[deprecated]] attribute
158+ # [ deprecated ]
159+ pub type DeprecatedUsing = :: ffi_11 :: c_int ;
68160
69- // error: type alias `DeprecatedUsingWithMessage` could not be bound
70- // [[deprecated]] attribute
161+ # [ deprecated = "old" ]
162+ pub type DeprecatedUsingWithMessage = :: ffi_11 :: c_int ;
71163
72164#[ derive( Clone , Copy , :: ctor:: MoveAndAssignViaCopy ) ]
73- #[ repr( C , align ( 4 ) ) ]
165+ #[ repr( C ) ]
74166///CRUBIT_ANNOTATE: cpp_type=DeprecatedFields
75167pub struct DeprecatedFields {
76- /// Reason for representing this field as a blob of bytes:
77- /// field is marked as deprecated; requires experimental features on //rs_bindings_from_cc/test/golden:deprecated_cc
78- pub ( crate ) no_message : [ :: core:: mem:: MaybeUninit < u8 > ; 4 ] ,
79- /// Reason for representing this field as a blob of bytes:
80- /// field is marked as deprecated; requires experimental features on //rs_bindings_from_cc/test/golden:deprecated_cc
81- pub ( crate ) message : [ :: core:: mem:: MaybeUninit < u8 > ; 4 ] ,
168+ #[ deprecated]
169+ pub no_message : :: ffi_11:: c_int ,
170+ #[ deprecated = "old" ]
171+ pub message : :: ffi_11:: c_int ,
82172}
83173impl !Send for DeprecatedFields { }
84174impl !Sync for DeprecatedFields { }
@@ -98,11 +188,15 @@ impl Default for DeprecatedFields {
98188 }
99189}
100190
101- // error: global variable `global_var` could not be bound
102- // [[deprecated]] attribute
191+ unsafe extern "C" {
192+ #[ deprecated]
193+ pub static mut global_var: :: ffi_11:: c_int ;
194+ }
103195
104- // error: global variable `global_var_with_message` could not be bound
105- // [[deprecated]] attribute
196+ unsafe extern "C" {
197+ #[ deprecated = "old" ]
198+ pub static mut global_var_with_message: :: ffi_11:: c_int ;
199+ }
106200
107201// error: class `SomeTotalSpecialization` could not be bound
108202// Class templates are not yet supported
@@ -120,13 +214,33 @@ mod detail {
120214 #[ allow( unused_imports) ]
121215 use super :: * ;
122216 unsafe extern "C" {
217+ pub ( crate ) unsafe fn __rust_thunk___Z19deprecated_functionv ( ) ;
218+ pub ( crate ) unsafe fn __rust_thunk___Z32deprecated_function_with_messagev ( ) ;
219+ pub ( crate ) unsafe fn __rust_thunk___ZN16DeprecatedStructC1Ev (
220+ __this : * mut :: core:: ffi:: c_void ,
221+ ) ;
222+ pub ( crate ) unsafe fn __rust_thunk___ZN27DeprecatedStructWithMessageC1Ev (
223+ __this : * mut :: core:: ffi:: c_void ,
224+ ) ;
225+ pub ( crate ) unsafe fn __rust_thunk___ZN19DeprecatedNamespace1fEv ( ) ;
226+ pub ( crate ) unsafe fn __rust_thunk___ZN30DeprecatedNamespaceWithMessage1fEv ( ) ;
123227 pub ( crate ) unsafe fn __rust_thunk___ZN16DeprecatedFieldsC1Ev (
124228 __this : * mut :: core:: ffi:: c_void ,
125229 ) ;
126230 }
127231}
128232
129233const _: ( ) = {
234+ assert ! ( :: core:: mem:: size_of:: <crate :: DeprecatedStruct >( ) == 1 ) ;
235+ assert ! ( :: core:: mem:: align_of:: <crate :: DeprecatedStruct >( ) == 1 ) ;
236+ static_assertions:: assert_impl_all!( crate :: DeprecatedStruct : Copy , Clone ) ;
237+ static_assertions:: assert_not_impl_any!( crate :: DeprecatedStruct : Drop ) ;
238+
239+ assert ! ( :: core:: mem:: size_of:: <crate :: DeprecatedStructWithMessage >( ) == 1 ) ;
240+ assert ! ( :: core:: mem:: align_of:: <crate :: DeprecatedStructWithMessage >( ) == 1 ) ;
241+ static_assertions:: assert_impl_all!( crate :: DeprecatedStructWithMessage : Copy , Clone ) ;
242+ static_assertions:: assert_not_impl_any!( crate :: DeprecatedStructWithMessage : Drop ) ;
243+
130244 assert ! ( :: core:: mem:: size_of:: <crate :: DeprecatedFields >( ) == 8 ) ;
131245 assert ! ( :: core:: mem:: align_of:: <crate :: DeprecatedFields >( ) == 4 ) ;
132246 static_assertions:: assert_impl_all!( crate :: DeprecatedFields : Copy , Clone ) ;
0 commit comments