Remove artificial restriction on lifetime parameters on enums
This commit is contained in:
committed by
Emilio Cobos Álvarez
parent
d09fe6b753
commit
9f00f6fdc5
@@ -906,14 +906,6 @@ impl Parse {
|
||||
mod_cfg: Option<&Cfg>,
|
||||
item: &syn::ItemEnum,
|
||||
) {
|
||||
if item.generics.lifetimes().count() > 0 {
|
||||
info!(
|
||||
"Skip {}::{} - (has generics or lifetimes or where bounds).",
|
||||
crate_name, &item.ident
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
match Enum::load(item, mod_cfg, config) {
|
||||
Ok(en) => {
|
||||
info!("Take {}::{}.", crate_name, &item.ident);
|
||||
|
||||
@@ -7,4 +7,20 @@ typedef struct A {
|
||||
const int32_t *data;
|
||||
} A;
|
||||
|
||||
void root(A _a);
|
||||
typedef enum E_Tag {
|
||||
V,
|
||||
U,
|
||||
} E_Tag;
|
||||
|
||||
typedef struct U_Body {
|
||||
const uint8_t *_0;
|
||||
} U_Body;
|
||||
|
||||
typedef struct E {
|
||||
E_Tag tag;
|
||||
union {
|
||||
U_Body u;
|
||||
};
|
||||
} E;
|
||||
|
||||
void root(A _a, E _e);
|
||||
|
||||
@@ -7,11 +7,27 @@ typedef struct A {
|
||||
const int32_t *data;
|
||||
} A;
|
||||
|
||||
typedef enum E_Tag {
|
||||
V,
|
||||
U,
|
||||
} E_Tag;
|
||||
|
||||
typedef struct U_Body {
|
||||
const uint8_t *_0;
|
||||
} U_Body;
|
||||
|
||||
typedef struct E {
|
||||
E_Tag tag;
|
||||
union {
|
||||
U_Body u;
|
||||
};
|
||||
} E;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(A _a);
|
||||
void root(A _a, E _e);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -7,4 +7,20 @@ typedef struct {
|
||||
const int32_t *data;
|
||||
} A;
|
||||
|
||||
void root(A _a);
|
||||
typedef enum {
|
||||
V,
|
||||
U,
|
||||
} E_Tag;
|
||||
|
||||
typedef struct {
|
||||
const uint8_t *_0;
|
||||
} U_Body;
|
||||
|
||||
typedef struct {
|
||||
E_Tag tag;
|
||||
union {
|
||||
U_Body u;
|
||||
};
|
||||
} E;
|
||||
|
||||
void root(A _a, E _e);
|
||||
|
||||
@@ -7,11 +7,27 @@ typedef struct {
|
||||
const int32_t *data;
|
||||
} A;
|
||||
|
||||
typedef enum {
|
||||
V,
|
||||
U,
|
||||
} E_Tag;
|
||||
|
||||
typedef struct {
|
||||
const uint8_t *_0;
|
||||
} U_Body;
|
||||
|
||||
typedef struct {
|
||||
E_Tag tag;
|
||||
union {
|
||||
U_Body u;
|
||||
};
|
||||
} E;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(A _a);
|
||||
void root(A _a, E _e);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -8,8 +8,24 @@ struct A {
|
||||
const int32_t *data;
|
||||
};
|
||||
|
||||
struct E {
|
||||
enum class Tag {
|
||||
V,
|
||||
U,
|
||||
};
|
||||
|
||||
struct U_Body {
|
||||
const uint8_t *_0;
|
||||
};
|
||||
|
||||
Tag tag;
|
||||
union {
|
||||
U_Body u;
|
||||
};
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
void root(A _a);
|
||||
void root(A _a, E _e);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -7,4 +7,20 @@ struct A {
|
||||
const int32_t *data;
|
||||
};
|
||||
|
||||
void root(struct A _a);
|
||||
enum E_Tag {
|
||||
V,
|
||||
U,
|
||||
};
|
||||
|
||||
struct U_Body {
|
||||
const uint8_t *_0;
|
||||
};
|
||||
|
||||
struct E {
|
||||
enum E_Tag tag;
|
||||
union {
|
||||
struct U_Body u;
|
||||
};
|
||||
};
|
||||
|
||||
void root(struct A _a, struct E _e);
|
||||
|
||||
@@ -7,11 +7,27 @@ struct A {
|
||||
const int32_t *data;
|
||||
};
|
||||
|
||||
enum E_Tag {
|
||||
V,
|
||||
U,
|
||||
};
|
||||
|
||||
struct U_Body {
|
||||
const uint8_t *_0;
|
||||
};
|
||||
|
||||
struct E {
|
||||
enum E_Tag tag;
|
||||
union {
|
||||
struct U_Body u;
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(struct A _a);
|
||||
void root(struct A _a, struct E _e);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -3,6 +3,12 @@ struct A<'a> {
|
||||
data: &'a i32
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
enum E<'a> {
|
||||
V,
|
||||
U(&'a u8),
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn root<'a>(_a: A<'a>)
|
||||
pub extern "C" fn root<'a>(_a: A<'a>, _e: E<'a>)
|
||||
{ }
|
||||
|
||||
Reference in New Issue
Block a user