@@ -36,6 +36,7 @@ pub struct Parser<'a> {
3636 pub cxx_name : Option < & ' a mut Option < ForeignName > > ,
3737 pub rust_name : Option < & ' a mut Option < Ident > > ,
3838 pub variants_from_header : Option < & ' a mut Option < Attribute > > ,
39+ pub is_renamed : Option < & ' a mut bool > ,
3940 pub ignore_unrecognized : bool ,
4041
4142 // Suppress clippy needless_update lint ("struct update has no effect, all
@@ -153,6 +154,19 @@ pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> Othe
153154 * * variants_from_header = Some ( attr) ;
154155 continue ;
155156 }
157+ } else if attr_path. is_ident ( "renamed" ) {
158+ match parse_renamed_attribute ( & attr. meta ) {
159+ Ok ( _) => {
160+ if let Some ( is_renamed) = & mut parser. is_renamed {
161+ * * is_renamed = true ;
162+ continue ;
163+ }
164+ }
165+ Err ( err) => {
166+ cx. push ( err) ;
167+ break ;
168+ }
169+ }
156170 } else if attr_path. is_ident ( "allow" )
157171 || attr_path. is_ident ( "warn" )
158172 || attr_path. is_ident ( "deny" )
@@ -282,6 +296,14 @@ fn parse_rust_name_attribute(meta: &Meta) -> Result<Ident> {
282296 Err ( Error :: new_spanned ( meta, "unsupported rust_name attribute" ) )
283297}
284298
299+ fn parse_renamed_attribute ( meta : & Meta ) -> Result < ( ) > {
300+ if let Meta :: Path ( _) = meta {
301+ Ok ( ( ) )
302+ } else {
303+ Err ( Error :: new_spanned ( meta, "unsupported renamed attribute" ) )
304+ }
305+ }
306+
285307#[ derive( Clone ) ]
286308pub struct OtherAttrs ( Vec < Attribute > ) ;
287309
0 commit comments