@@ -37,7 +37,7 @@ fn fallback(input: &DeriveInput, error: syn::Error) -> TokenStream {
37
37
38
38
#[ allow( unused_qualifications) ]
39
39
#[ automatically_derived]
40
- impl #impl_generics :: std :: error :: Error for #ty #ty_generics #where_clause
40
+ impl #impl_generics :: thiserror :: __private :: Error for #ty #ty_generics #where_clause
41
41
where
42
42
// Work around trivial bounds being unstable.
43
43
// https://github.com/rust-lang/rust/issues/48214
@@ -62,17 +62,17 @@ fn impl_struct(input: Struct) -> TokenStream {
62
62
let source_body = if let Some ( transparent_attr) = & input. attrs . transparent {
63
63
let only_field = & input. fields [ 0 ] ;
64
64
if only_field. contains_generic {
65
- error_inferred_bounds. insert ( only_field. ty , quote ! ( :: std :: error :: Error ) ) ;
65
+ error_inferred_bounds. insert ( only_field. ty , quote ! ( :: thiserror :: __private :: Error ) ) ;
66
66
}
67
67
let member = & only_field. member ;
68
68
Some ( quote_spanned ! { transparent_attr. span=>
69
- :: std :: error :: Error :: source( self . #member. as_dyn_error( ) )
69
+ :: thiserror :: __private :: Error :: source( self . #member. as_dyn_error( ) )
70
70
} )
71
71
} else if let Some ( source_field) = input. source_field ( ) {
72
72
let source = & source_field. member ;
73
73
if source_field. contains_generic {
74
74
let ty = unoptional_type ( source_field. ty ) ;
75
- error_inferred_bounds. insert ( ty, quote ! ( :: std :: error :: Error + ' static ) ) ;
75
+ error_inferred_bounds. insert ( ty, quote ! ( :: thiserror :: __private :: Error + ' static ) ) ;
76
76
}
77
77
let asref = if type_is_option ( source_field. ty ) {
78
78
Some ( quote_spanned ! ( source. span( ) => . as_ref( ) ?) )
@@ -90,7 +90,7 @@ fn impl_struct(input: Struct) -> TokenStream {
90
90
} ;
91
91
let source_method = source_body. map ( |body| {
92
92
quote ! {
93
- fn source( & self ) -> :: core:: option:: Option <& ( dyn :: std :: error :: Error + ' static ) > {
93
+ fn source( & self ) -> :: core:: option:: Option <& ( dyn :: thiserror :: __private :: Error + ' static ) > {
94
94
use :: thiserror:: __private:: AsDynError as _;
95
95
#body
96
96
}
@@ -218,7 +218,7 @@ fn impl_struct(input: Struct) -> TokenStream {
218
218
quote ! {
219
219
#[ allow( unused_qualifications) ]
220
220
#[ automatically_derived]
221
- impl #impl_generics :: std :: error :: Error for #ty #ty_generics #error_where_clause {
221
+ impl #impl_generics :: thiserror :: __private :: Error for #ty #ty_generics #error_where_clause {
222
222
#source_method
223
223
#provide_method
224
224
}
@@ -238,11 +238,11 @@ fn impl_enum(input: Enum) -> TokenStream {
238
238
if let Some ( transparent_attr) = & variant. attrs . transparent {
239
239
let only_field = & variant. fields [ 0 ] ;
240
240
if only_field. contains_generic {
241
- error_inferred_bounds. insert ( only_field. ty , quote ! ( :: std :: error :: Error ) ) ;
241
+ error_inferred_bounds. insert ( only_field. ty , quote ! ( :: thiserror :: __private :: Error ) ) ;
242
242
}
243
243
let member = & only_field. member ;
244
244
let source = quote_spanned ! { transparent_attr. span=>
245
- :: std :: error :: Error :: source( transparent. as_dyn_error( ) )
245
+ :: thiserror :: __private :: Error :: source( transparent. as_dyn_error( ) )
246
246
} ;
247
247
quote ! {
248
248
#ty:: #ident { #member: transparent} => #source,
@@ -251,7 +251,7 @@ fn impl_enum(input: Enum) -> TokenStream {
251
251
let source = & source_field. member ;
252
252
if source_field. contains_generic {
253
253
let ty = unoptional_type ( source_field. ty ) ;
254
- error_inferred_bounds. insert ( ty, quote ! ( :: std :: error :: Error + ' static ) ) ;
254
+ error_inferred_bounds. insert ( ty, quote ! ( :: thiserror :: __private :: Error + ' static ) ) ;
255
255
}
256
256
let asref = if type_is_option ( source_field. ty ) {
257
257
Some ( quote_spanned ! ( source. span( ) => . as_ref( ) ?) )
@@ -272,7 +272,7 @@ fn impl_enum(input: Enum) -> TokenStream {
272
272
}
273
273
} ) ;
274
274
Some ( quote ! {
275
- fn source( & self ) -> :: core:: option:: Option <& ( dyn :: std :: error :: Error + ' static ) > {
275
+ fn source( & self ) -> :: core:: option:: Option <& ( dyn :: thiserror :: __private :: Error + ' static ) > {
276
276
use :: thiserror:: __private:: AsDynError as _;
277
277
#[ allow( deprecated) ]
278
278
match self {
@@ -483,7 +483,7 @@ fn impl_enum(input: Enum) -> TokenStream {
483
483
quote ! {
484
484
#[ allow( unused_qualifications) ]
485
485
#[ automatically_derived]
486
- impl #impl_generics :: std :: error :: Error for #ty #ty_generics #error_where_clause {
486
+ impl #impl_generics :: thiserror :: __private :: Error for #ty #ty_generics #error_where_clause {
487
487
#source_method
488
488
#provide_method
489
489
}
0 commit comments