@@ -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 :: std:: error:: 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 ! ( :: std:: error:: 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
+ :: std:: error:: 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 ! ( :: std:: error:: 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 :: std:: error:: Error + ' static ) > {
94
94
use :: thiserror:: __private:: AsDynError as _;
95
95
#body
96
96
}
@@ -118,12 +118,12 @@ fn impl_struct(input: Struct) -> TokenStream {
118
118
} else if type_is_option ( backtrace_field. ty ) {
119
119
Some ( quote ! {
120
120
if let :: core:: option:: Option :: Some ( backtrace) = & self . #backtrace {
121
- #request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
121
+ #request. provide_ref:: <:: std:: backtrace:: Backtrace >( backtrace) ;
122
122
}
123
123
} )
124
124
} else {
125
125
Some ( quote ! {
126
- #request. provide_ref:: <std:: backtrace:: Backtrace >( & self . #backtrace) ;
126
+ #request. provide_ref:: <:: std:: backtrace:: Backtrace >( & self . #backtrace) ;
127
127
} )
128
128
} ;
129
129
quote ! {
@@ -134,16 +134,16 @@ fn impl_struct(input: Struct) -> TokenStream {
134
134
} else if type_is_option ( backtrace_field. ty ) {
135
135
quote ! {
136
136
if let :: core:: option:: Option :: Some ( backtrace) = & self . #backtrace {
137
- #request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
137
+ #request. provide_ref:: <:: std:: backtrace:: Backtrace >( backtrace) ;
138
138
}
139
139
}
140
140
} else {
141
141
quote ! {
142
- #request. provide_ref:: <std:: backtrace:: Backtrace >( & self . #backtrace) ;
142
+ #request. provide_ref:: <:: std:: backtrace:: Backtrace >( & self . #backtrace) ;
143
143
}
144
144
} ;
145
145
quote ! {
146
- fn provide<' _request>( & ' _request self , #request: & mut std:: error:: Request <' _request>) {
146
+ fn provide<' _request>( & ' _request self , #request: & mut :: std:: error:: Request <' _request>) {
147
147
#body
148
148
}
149
149
}
@@ -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 :: std:: error:: 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 ! ( :: std:: error:: 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
+ :: std:: error:: 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 ! ( :: std:: error:: 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 :: std:: error:: Error + ' static ) > {
276
276
use :: thiserror:: __private:: AsDynError as _;
277
277
#[ allow( deprecated) ]
278
278
match self {
@@ -309,12 +309,12 @@ fn impl_enum(input: Enum) -> TokenStream {
309
309
let self_provide = if type_is_option ( backtrace_field. ty ) {
310
310
quote ! {
311
311
if let :: core:: option:: Option :: Some ( backtrace) = backtrace {
312
- #request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
312
+ #request. provide_ref:: <:: std:: backtrace:: Backtrace >( backtrace) ;
313
313
}
314
314
}
315
315
} else {
316
316
quote ! {
317
- #request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
317
+ #request. provide_ref:: <:: std:: backtrace:: Backtrace >( backtrace) ;
318
318
}
319
319
} ;
320
320
quote ! {
@@ -357,12 +357,12 @@ fn impl_enum(input: Enum) -> TokenStream {
357
357
let body = if type_is_option ( backtrace_field. ty ) {
358
358
quote ! {
359
359
if let :: core:: option:: Option :: Some ( backtrace) = backtrace {
360
- #request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
360
+ #request. provide_ref:: <:: std:: backtrace:: Backtrace >( backtrace) ;
361
361
}
362
362
}
363
363
} else {
364
364
quote ! {
365
- #request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
365
+ #request. provide_ref:: <:: std:: backtrace:: Backtrace >( backtrace) ;
366
366
}
367
367
} ;
368
368
quote ! {
@@ -377,7 +377,7 @@ fn impl_enum(input: Enum) -> TokenStream {
377
377
}
378
378
} ) ;
379
379
Some ( quote ! {
380
- fn provide<' _request>( & ' _request self , #request: & mut std:: error:: Request <' _request>) {
380
+ fn provide<' _request>( & ' _request self , #request: & mut :: std:: error:: Request <' _request>) {
381
381
#[ allow( deprecated) ]
382
382
match self {
383
383
#( #arms) *
@@ -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 :: std:: error:: Error for #ty #ty_generics #error_where_clause {
487
487
#source_method
488
488
#provide_method
489
489
}
@@ -532,11 +532,11 @@ fn from_initializer(
532
532
let backtrace_member = & backtrace_field. member ;
533
533
if type_is_option ( backtrace_field. ty ) {
534
534
quote ! {
535
- #backtrace_member: :: core:: option:: Option :: Some ( std:: backtrace:: Backtrace :: capture( ) ) ,
535
+ #backtrace_member: :: core:: option:: Option :: Some ( :: std:: backtrace:: Backtrace :: capture( ) ) ,
536
536
}
537
537
} else {
538
538
quote ! {
539
- #backtrace_member: :: core:: convert:: From :: from( std:: backtrace:: Backtrace :: capture( ) ) ,
539
+ #backtrace_member: :: core:: convert:: From :: from( :: std:: backtrace:: Backtrace :: capture( ) ) ,
540
540
}
541
541
}
542
542
} ) ;
0 commit comments