Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit c3bf41d

Browse files
committed
Fix macro problems (the feature is still useless though)
1 parent a6e475e commit c3bf41d

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

src/error_chain.rs

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
/// Prefer to use `error_chain` instead of this macro.
22
#[macro_export]
33
macro_rules! error_chain_processed {
4-
// Default values for `types` and `derive`.
4+
// Default values for `types`.
55
(
6-
// FIXME does not work if either types or derive isn't empty
76
types {}
8-
derive {}
97
$( $rest: tt )*
10-
) =>{
8+
) => {
119
error_chain_processed! {
1210
types {
1311
Error, ErrorKind, ResultExt, Result;
1412
}
15-
derive {
16-
Debug;
17-
}
1813
$( $rest )*
1914
}
2015
};
@@ -26,7 +21,6 @@ macro_rules! error_chain_processed {
2621
}
2722
$( $rest: tt )*
2823
) => {
29-
log_syntax!(rest: $($rest)*);
3024
error_chain_processed! {
3125
types {
3226
$error_name, $error_kind_name,
@@ -46,7 +40,7 @@ macro_rules! error_chain_processed {
4640
}
4741

4842
derive {
49-
$($trait:ident),*;
43+
$($trait:ident),*
5044
}
5145

5246
links {
@@ -413,10 +407,10 @@ macro_rules! error_chain_processing {
413407
( ($a:tt, $b:tt, $c:tt, $d:tt, $e:tt) ) => {
414408
error_chain_processed! {
415409
types $a
416-
derive $e
417-
links $b
418-
foreign_links $c
419-
errors $d
410+
derive $b
411+
links $c
412+
foreign_links $d
413+
errors $e
420414
}
421415
};
422416
}

src/example_generated.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
2222
/// Another code generated by the macro.
2323
pub mod inner {
24-
error_chain!{}
24+
error_chain! {
25+
derive {
26+
Send
27+
}
28+
}
2529
}
2630

2731
error_chain! {
@@ -35,4 +39,12 @@ error_chain! {
3539
#[doc = "A custom error kind."]
3640
Custom
3741
}
42+
derive {
43+
Send
44+
}
45+
}
46+
47+
fn foo<T: Send>() {}
48+
fn bar() {
49+
foo::<Error>();
3850
}

0 commit comments

Comments
 (0)