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

Commit 3c5bfed

Browse files
committed
Fix macro problems (the feature is still useless though)
1 parent de82983 commit 3c5bfed

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

src/error_chain.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@
44
macro_rules! impl_error_chain_processed {
55
// Default values for `types` and `derive`.
66
(
7-
// FIXME does not work if either types or derive isn't empty
87
types {}
9-
derive {}
108
$( $rest: tt )*
119
) => {
1210
impl_error_chain_processed! {
1311
types {
1412
Error, ErrorKind, ResultExt, Result;
1513
}
16-
derive {
17-
Debug;
18-
}
1914
$( $rest )*
2015
}
2116
};
@@ -47,7 +42,7 @@ macro_rules! impl_error_chain_processed {
4742
}
4843

4944
derive {
50-
$($trait:ident),*;
45+
$($trait:ident),*
5146
}
5247

5348
links {
@@ -412,10 +407,10 @@ macro_rules! error_chain_processing {
412407
( ($a:tt, $b:tt, $c:tt, $d:tt, $e:tt) ) => {
413408
impl_error_chain_processed! {
414409
types $a
415-
derive $e
416-
links $b
417-
foreign_links $c
418-
errors $d
410+
derive $b
411+
links $c
412+
foreign_links $d
413+
errors $e
419414
}
420415
};
421416
}

src/example_generated.rs

Lines changed: 13 additions & 1 deletion
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)