@@ -36,7 +36,7 @@ fn fallback(input: &DeriveInput, error: syn::Error) -> TokenStream {
3636 #error
3737
3838 #[ allow( unused_qualifications) ]
39- impl #impl_generics :: thiserror :: __private :: error:: Error for #ty #ty_generics #where_clause
39+ impl #impl_generics :: core :: error:: Error for #ty #ty_generics #where_clause
4040 where
4141 // Work around trivial bounds being unstable.
4242 // https://github.com/rust-lang/rust/issues/48214
@@ -60,19 +60,17 @@ fn impl_struct(input: Struct) -> TokenStream {
6060 let source_body = if let Some ( transparent_attr) = & input. attrs . transparent {
6161 let only_field = & input. fields [ 0 ] ;
6262 if only_field. contains_generic {
63- error_inferred_bounds
64- . insert ( only_field. ty , quote ! ( :: thiserror:: __private:: error:: Error ) ) ;
63+ error_inferred_bounds. insert ( only_field. ty , quote ! ( :: core:: error:: Error ) ) ;
6564 }
6665 let member = & only_field. member ;
6766 Some ( quote_spanned ! { transparent_attr. span=>
68- :: thiserror :: __private :: error:: Error :: source( self . #member. as_dyn_error( ) )
67+ :: core :: error:: Error :: source( self . #member. as_dyn_error( ) )
6968 } )
7069 } else if let Some ( source_field) = input. source_field ( ) {
7170 let source = & source_field. member ;
7271 if source_field. contains_generic {
7372 let ty = unoptional_type ( source_field. ty ) ;
74- error_inferred_bounds
75- . insert ( ty, quote ! ( :: thiserror:: __private:: error:: Error + ' static ) ) ;
73+ error_inferred_bounds. insert ( ty, quote ! ( :: core:: error:: Error + ' static ) ) ;
7674 }
7775 let asref = if type_is_option ( source_field. ty ) {
7876 Some ( quote_spanned ! ( source. member_span( ) => . as_ref( ) ?) )
@@ -90,7 +88,7 @@ fn impl_struct(input: Struct) -> TokenStream {
9088 } ;
9189 let source_method = source_body. map ( |body| {
9290 quote ! {
93- fn source( & self ) -> :: core:: option:: Option <& ( dyn :: thiserror :: __private :: error:: Error + ' static ) > {
91+ fn source( & self ) -> :: core:: option:: Option <& ( dyn :: core :: error:: Error + ' static ) > {
9492 use thiserror:: __private:: AsDynError as _;
9593 #body
9694 }
@@ -143,7 +141,7 @@ fn impl_struct(input: Struct) -> TokenStream {
143141 }
144142 } ;
145143 quote ! {
146- fn provide<' _request>( & ' _request self , #request: & mut std :: error:: Request <' _request>) {
144+ fn provide<' _request>( & ' _request self , #request: & mut :: core :: error:: Request <' _request>) {
147145 #body
148146 }
149147 }
@@ -213,7 +211,7 @@ fn impl_struct(input: Struct) -> TokenStream {
213211
214212 quote ! {
215213 #[ allow( unused_qualifications) ]
216- impl #impl_generics :: thiserror :: __private :: error:: Error for #ty #ty_generics #error_where_clause {
214+ impl #impl_generics :: core :: error:: Error for #ty #ty_generics #error_where_clause {
217215 #source_method
218216 #provide_method
219217 }
@@ -233,11 +231,11 @@ fn impl_enum(input: Enum) -> TokenStream {
233231 if let Some ( transparent_attr) = & variant. attrs . transparent {
234232 let only_field = & variant. fields [ 0 ] ;
235233 if only_field. contains_generic {
236- error_inferred_bounds. insert ( only_field. ty , quote ! ( :: thiserror :: __private :: error:: Error ) ) ;
234+ error_inferred_bounds. insert ( only_field. ty , quote ! ( :: core :: error:: Error ) ) ;
237235 }
238236 let member = & only_field. member ;
239237 let source = quote_spanned ! { transparent_attr. span=>
240- :: thiserror :: __private :: error:: Error :: source( transparent. as_dyn_error( ) )
238+ :: core :: error:: Error :: source( transparent. as_dyn_error( ) )
241239 } ;
242240 quote ! {
243241 #ty:: #ident { #member: transparent} => #source,
@@ -246,7 +244,7 @@ fn impl_enum(input: Enum) -> TokenStream {
246244 let source = & source_field. member ;
247245 if source_field. contains_generic {
248246 let ty = unoptional_type ( source_field. ty ) ;
249- error_inferred_bounds. insert ( ty, quote ! ( :: thiserror :: __private :: error:: Error + ' static ) ) ;
247+ error_inferred_bounds. insert ( ty, quote ! ( :: core :: error:: Error + ' static ) ) ;
250248 }
251249 let asref = if type_is_option ( source_field. ty ) {
252250 Some ( quote_spanned ! ( source. member_span( ) => . as_ref( ) ?) )
@@ -267,7 +265,7 @@ fn impl_enum(input: Enum) -> TokenStream {
267265 }
268266 } ) ;
269267 Some ( quote ! {
270- fn source( & self ) -> :: core:: option:: Option <& ( dyn std :: error:: Error + ' static ) > {
268+ fn source( & self ) -> :: core:: option:: Option <& ( dyn :: core :: error:: Error + ' static ) > {
271269 use thiserror:: __private:: AsDynError as _;
272270 #[ allow( deprecated) ]
273271 match self {
@@ -372,7 +370,7 @@ fn impl_enum(input: Enum) -> TokenStream {
372370 }
373371 } ) ;
374372 Some ( quote ! {
375- fn provide<' _request>( & ' _request self , #request: & mut std :: error:: Request <' _request>) {
373+ fn provide<' _request>( & ' _request self , #request: & mut :: core :: error:: Request <' _request>) {
376374 #[ allow( deprecated) ]
377375 match self {
378376 #( #arms) *
@@ -469,7 +467,7 @@ fn impl_enum(input: Enum) -> TokenStream {
469467
470468 quote ! {
471469 #[ allow( unused_qualifications) ]
472- impl #impl_generics :: thiserror :: __private :: error:: Error for #ty #ty_generics #error_where_clause {
470+ impl #impl_generics :: core :: error:: Error for #ty #ty_generics #error_where_clause {
473471 #source_method
474472 #provide_method
475473 }
0 commit comments