This repository was archived by the owner on Aug 16, 2021. It is now read-only.
File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ fn main() {
10
10
println ! ( "cargo:rustc-cfg=has_error_source" ) ;
11
11
}
12
12
13
+ if is_min_version ( "1.42" ) . unwrap_or ( false ) {
14
+ println ! ( "cargo:rustc-cfg=has_error_description_deprecated" ) ;
15
+ }
16
+
13
17
// So we can get the build profile for has_backtrace_depending_on_env test
14
18
if let Ok ( profile) = env:: var ( "PROFILE" ) {
15
19
println ! ( "cargo:rustc-cfg=build={:?}" , profile) ;
Original file line number Diff line number Diff line change @@ -301,6 +301,7 @@ macro_rules! impl_error_chain_processed {
301
301
}
302
302
303
303
impl :: std:: error:: Error for $error_name {
304
+ #[ cfg( not( has_error_description_deprecated) ) ]
304
305
fn description( & self ) -> & str {
305
306
self . description( )
306
307
}
@@ -354,6 +355,7 @@ macro_rules! impl_error_chain_processed {
354
355
// The ErrorKind type
355
356
// --------------
356
357
358
+ #[ cfg( not( has_error_description_deprecated) ) ]
357
359
impl_error_chain_kind! {
358
360
/// The kind of an error.
359
361
#[ derive( Debug ) ]
@@ -378,6 +380,31 @@ macro_rules! impl_error_chain_processed {
378
380
}
379
381
}
380
382
383
+ #[ cfg( has_error_description_deprecated) ]
384
+ impl_error_chain_kind! {
385
+ /// The kind of an error.
386
+ #[ derive( Debug ) ]
387
+ pub enum $error_kind_name {
388
+ $(
389
+ $( #[ $meta_links] ) *
390
+ $link_variant( e: $link_kind_path) {
391
+ description( e. description( ) )
392
+ display( "{}" , e)
393
+ }
394
+ ) *
395
+
396
+ $(
397
+ $( #[ $meta_foreign_links] ) *
398
+ $foreign_link_variant( err: $foreign_link_error_path) {
399
+ description( "" )
400
+ display( "{}" , err)
401
+ }
402
+ ) *
403
+
404
+ $( $error_chunks) *
405
+ }
406
+ }
407
+
381
408
$(
382
409
$( #[ $meta_links] ) *
383
410
impl From <$link_kind_path> for $error_kind_name {
You can’t perform that action at this time.
0 commit comments