Skip to content

Commit 02f081c

Browse files
committed
Future proof libsyntax_ext for union.
1 parent cdde06e commit 02f081c

File tree

14 files changed

+16
-0
lines changed

14 files changed

+16
-0
lines changed

src/libsyntax_ext/deriving/bounds.rs

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub fn expand_deriving_copy(cx: &mut ExtCtxt,
4040
additional_bounds: Vec::new(),
4141
generics: LifetimeBounds::empty(),
4242
is_unsafe: false,
43+
supports_unions: true,
4344
methods: Vec::new(),
4445
associated_types: Vec::new(),
4546
};

src/libsyntax_ext/deriving/clone.rs

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt,
8080
additional_bounds: bounds,
8181
generics: LifetimeBounds::empty(),
8282
is_unsafe: false,
83+
supports_unions: false,
8384
methods: vec![MethodDef {
8485
name: "clone",
8586
generics: LifetimeBounds::empty(),

src/libsyntax_ext/deriving/cmp/eq.rs

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
5050
additional_bounds: Vec::new(),
5151
generics: LifetimeBounds::empty(),
5252
is_unsafe: false,
53+
supports_unions: false,
5354
methods: vec![MethodDef {
5455
name: "assert_receiver_is_total_eq",
5556
generics: LifetimeBounds::empty(),

src/libsyntax_ext/deriving/cmp/ord.rs

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
3232
additional_bounds: Vec::new(),
3333
generics: LifetimeBounds::empty(),
3434
is_unsafe: false,
35+
supports_unions: false,
3536
methods: vec![MethodDef {
3637
name: "cmp",
3738
generics: LifetimeBounds::empty(),

src/libsyntax_ext/deriving/cmp/partial_eq.rs

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
9797
additional_bounds: Vec::new(),
9898
generics: LifetimeBounds::empty(),
9999
is_unsafe: false,
100+
supports_unions: false,
100101
methods: methods,
101102
associated_types: Vec::new(),
102103
};

src/libsyntax_ext/deriving/cmp/partial_ord.rs

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
8888
additional_bounds: vec![],
8989
generics: LifetimeBounds::empty(),
9090
is_unsafe: false,
91+
supports_unions: false,
9192
methods: methods,
9293
associated_types: Vec::new(),
9394
};

src/libsyntax_ext/deriving/debug.rs

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt,
3535
additional_bounds: Vec::new(),
3636
generics: LifetimeBounds::empty(),
3737
is_unsafe: false,
38+
supports_unions: false,
3839
methods: vec![MethodDef {
3940
name: "fmt",
4041
generics: LifetimeBounds::empty(),

src/libsyntax_ext/deriving/decodable.rs

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
6262
additional_bounds: Vec::new(),
6363
generics: LifetimeBounds::empty(),
6464
is_unsafe: false,
65+
supports_unions: false,
6566
methods: vec![MethodDef {
6667
name: "decode",
6768
generics: LifetimeBounds {

src/libsyntax_ext/deriving/default.rs

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt,
3232
additional_bounds: Vec::new(),
3333
generics: LifetimeBounds::empty(),
3434
is_unsafe: false,
35+
supports_unions: false,
3536
methods: vec![MethodDef {
3637
name: "default",
3738
generics: LifetimeBounds::empty(),

src/libsyntax_ext/deriving/encodable.rs

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
138138
additional_bounds: Vec::new(),
139139
generics: LifetimeBounds::empty(),
140140
is_unsafe: false,
141+
supports_unions: false,
141142
methods: vec!(
142143
MethodDef {
143144
name: "encode",

src/libsyntax_ext/deriving/generic/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ pub struct TraitDef<'a> {
228228
/// Is it an `unsafe` trait?
229229
pub is_unsafe: bool,
230230

231+
/// Can this trait be derived for unions?
232+
pub supports_unions: bool,
233+
231234
pub methods: Vec<MethodDef<'a>>,
232235

233236
pub associated_types: Vec<(ast::Ident, Ty<'a>)>,

src/libsyntax_ext/deriving/hash.rs

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
3636
additional_bounds: Vec::new(),
3737
generics: LifetimeBounds::empty(),
3838
is_unsafe: false,
39+
supports_unions: false,
3940
methods: vec![MethodDef {
4041
name: "hash",
4142
generics: LifetimeBounds {

src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ fn expand(cx: &mut ExtCtxt,
4949
generics: LifetimeBounds::empty(),
5050
associated_types: vec![],
5151
is_unsafe: false,
52+
supports_unions: false,
5253
methods: vec![
5354
MethodDef {
5455
name: "total_sum",

src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ fn expand(cx: &mut ExtCtxt,
5151
generics: LifetimeBounds::empty(),
5252
associated_types: vec![],
5353
is_unsafe: false,
54+
supports_unions: false,
5455
methods: vec![
5556
MethodDef {
5657
name: "total_sum",

0 commit comments

Comments
 (0)