diff --git a/impl/src/error.rs b/impl/src/error.rs index a801dc20..5ee3d887 100644 --- a/impl/src/error.rs +++ b/impl/src/error.rs @@ -40,7 +40,7 @@ pub fn expand( // Not using `#[inline]` here on purpose, since this is almost never part // of a hot codepath. quote! { - fn source(&self) -> Option<&(dyn derive_more::core::error::Error + 'static)> { + fn source(&self) -> derive_more::core::option::Option<&(dyn derive_more::core::error::Error + 'static)> { use derive_more::__private::AsDynError as _; #source } @@ -166,7 +166,10 @@ fn render_enum( }) }; - let source = render(&mut source_match_arms, quote! { None }); + let source = render( + &mut source_match_arms, + quote! { derive_more::core::option::Option::None }, + ); let provide = render(&mut provide_match_arms, quote! { () }); Ok((bounds, source, provide)) @@ -287,7 +290,7 @@ fn render_some(mut expr: TokenStream, unpack: bool) -> TokenStream { if unpack { expr = quote! { derive_more::core::option::Option::as_ref(#expr)? } } - quote! { Some(#expr.__derive_more_as_dyn_error()) } + quote! { derive_more::core::option::Option::Some(#expr.__derive_more_as_dyn_error()) } } fn parse_fields<'input, 'state>( diff --git a/impl/src/is_variant.rs b/impl/src/is_variant.rs index 4ca7ebbb..d04a23b2 100644 --- a/impl/src/is_variant.rs +++ b/impl/src/is_variant.rs @@ -41,7 +41,7 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result TokenStr let error = quote! { derive_more::TryUnwrapError::<_>::new( val, - stringify!(#enum_name), - stringify!(#variant_ident), - stringify!(#func_name), + derive_more::core::stringify!(#enum_name), + derive_more::core::stringify!(#variant_ident), + derive_more::core::stringify!(#func_name), ) }; quote! { diff --git a/impl/src/unwrap.rs b/impl/src/unwrap.rs index 2df7732b..294ad96b 100644 --- a/impl/src/unwrap.rs +++ b/impl/src/unwrap.rs @@ -160,7 +160,7 @@ fn failed_block(state: &State, enum_name: &Ident, fn_name: &Ident) -> TokenStrea let panic_msg = format!( "called `{enum_name}::{fn_name}()` on a `{enum_name}::{variant_ident}` value" ); - quote! { #enum_name :: #variant_ident #data_pattern => panic!(#panic_msg) } + quote! { #enum_name :: #variant_ident #data_pattern => derive_more::core::panic!(#panic_msg) } }); quote! { diff --git a/tests/compile_fail/eq/non_eq_field.stderr b/tests/compile_fail/eq/non_eq_field.stderr index ae02e14a..e93c539b 100644 --- a/tests/compile_fail/eq/non_eq_field.stderr +++ b/tests/compile_fail/eq/non_eq_field.stderr @@ -14,5 +14,4 @@ error[E0277]: the trait bound `f32: Eq` is not satisfied u128 u16 and $N others - = help: see issue #48214 = note: this error originates in the derive macro `derive_more::Eq` (in Nightly builds, run with -Z macro-backtrace for more info)