Future proof libsyntax_ext for union.

This commit is contained in:
Jeffrey Seyfried 2016-08-29 11:14:25 +00:00
parent cdde06ea97
commit 02f081c0b5
14 changed files with 16 additions and 0 deletions

View File

@ -40,6 +40,7 @@ pub fn expand_deriving_copy(cx: &mut ExtCtxt,
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: true,
methods: Vec::new(),
associated_types: Vec::new(),
};

View File

@ -80,6 +80,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt,
additional_bounds: bounds,
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec![MethodDef {
name: "clone",
generics: LifetimeBounds::empty(),

View File

@ -50,6 +50,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec![MethodDef {
name: "assert_receiver_is_total_eq",
generics: LifetimeBounds::empty(),

View File

@ -32,6 +32,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec![MethodDef {
name: "cmp",
generics: LifetimeBounds::empty(),

View File

@ -97,6 +97,7 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: methods,
associated_types: Vec::new(),
};

View File

@ -88,6 +88,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
additional_bounds: vec![],
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: methods,
associated_types: Vec::new(),
};

View File

@ -35,6 +35,7 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt,
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec![MethodDef {
name: "fmt",
generics: LifetimeBounds::empty(),

View File

@ -62,6 +62,7 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec![MethodDef {
name: "decode",
generics: LifetimeBounds {

View File

@ -32,6 +32,7 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt,
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec![MethodDef {
name: "default",
generics: LifetimeBounds::empty(),

View File

@ -138,6 +138,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec!(
MethodDef {
name: "encode",

View File

@ -228,6 +228,9 @@ pub struct TraitDef<'a> {
/// Is it an `unsafe` trait?
pub is_unsafe: bool,
/// Can this trait be derived for unions?
pub supports_unions: bool,
pub methods: Vec<MethodDef<'a>>,
pub associated_types: Vec<(ast::Ident, Ty<'a>)>,

View File

@ -36,6 +36,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
additional_bounds: Vec::new(),
generics: LifetimeBounds::empty(),
is_unsafe: false,
supports_unions: false,
methods: vec![MethodDef {
name: "hash",
generics: LifetimeBounds {

View File

@ -49,6 +49,7 @@ fn expand(cx: &mut ExtCtxt,
generics: LifetimeBounds::empty(),
associated_types: vec![],
is_unsafe: false,
supports_unions: false,
methods: vec![
MethodDef {
name: "total_sum",

View File

@ -51,6 +51,7 @@ fn expand(cx: &mut ExtCtxt,
generics: LifetimeBounds::empty(),
associated_types: vec![],
is_unsafe: false,
supports_unions: false,
methods: vec![
MethodDef {
name: "total_sum",