Skip to content

Commit aaf8449

Browse files
committed
Use ThiserrorProvide to disambiguate 'provide' method calls
1 parent 460396e commit aaf8449

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

impl/src/expand.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ fn impl_struct(input: Struct) -> TokenStream {
6767
let source_provide = if type_is_option(source_field.ty) {
6868
quote_spanned! {source.span()=>
6969
if let std::option::Option::Some(source) = &self.#source {
70-
source.as_dyn_error().provide(#demand);
70+
source.thiserror_provide(#demand);
7171
}
7272
}
7373
} else {
7474
quote_spanned! {source.span()=>
75-
self.#source.as_dyn_error().provide(#demand);
75+
self.#source.thiserror_provide(#demand);
7676
}
7777
};
7878
let self_provide = if source == backtrace {
@@ -89,7 +89,7 @@ fn impl_struct(input: Struct) -> TokenStream {
8989
})
9090
};
9191
quote! {
92-
use thiserror::__private::AsDynError;
92+
use thiserror::__private::ThiserrorProvide;
9393
#source_provide
9494
#self_provide
9595
}
@@ -259,12 +259,12 @@ fn impl_enum(input: Enum) -> TokenStream {
259259
let source_provide = if type_is_option(source_field.ty) {
260260
quote_spanned! {source.span()=>
261261
if let std::option::Option::Some(source) = #varsource {
262-
source.as_dyn_error().provide(#demand);
262+
source.thiserror_provide(#demand);
263263
}
264264
}
265265
} else {
266266
quote_spanned! {source.span()=>
267-
#varsource.as_dyn_error().provide(#demand);
267+
#varsource.thiserror_provide(#demand);
268268
}
269269
};
270270
let self_provide = if type_is_option(backtrace_field.ty) {
@@ -284,7 +284,7 @@ fn impl_enum(input: Enum) -> TokenStream {
284284
#source: #varsource,
285285
..
286286
} => {
287-
use thiserror::__private::AsDynError;
287+
use thiserror::__private::ThiserrorProvide;
288288
#source_provide
289289
#self_provide
290290
}
@@ -298,17 +298,17 @@ fn impl_enum(input: Enum) -> TokenStream {
298298
let source_provide = if type_is_option(source_field.ty) {
299299
quote_spanned! {backtrace.span()=>
300300
if let std::option::Option::Some(source) = #varsource {
301-
source.as_dyn_error().provide(#demand);
301+
source.thiserror_provide(#demand);
302302
}
303303
}
304304
} else {
305305
quote_spanned! {backtrace.span()=>
306-
#varsource.as_dyn_error().provide(#demand);
306+
#varsource.thiserror_provide(#demand);
307307
}
308308
};
309309
quote! {
310310
#ty::#ident {#backtrace: #varsource, ..} => {
311-
use thiserror::__private::AsDynError;
311+
use thiserror::__private::ThiserrorProvide;
312312
#source_provide
313313
}
314314
}

0 commit comments

Comments
 (0)