diff --git a/prost-derive/src/field/group.rs b/prost-derive/src/field/group.rs index 639612880..076b577d7 100644 --- a/prost-derive/src/field/group.rs +++ b/prost-derive/src/field/group.rs @@ -95,7 +95,7 @@ impl Field { ::prost::encoding::group::merge( tag, wire_type, - #ident.get_or_insert_with(Default::default), + #ident.get_or_insert_with(::core::default::Default::default), buf, ctx, ) diff --git a/prost-derive/src/field/message.rs b/prost-derive/src/field/message.rs index 1ff7c3798..3bcdddfb1 100644 --- a/prost-derive/src/field/message.rs +++ b/prost-derive/src/field/message.rs @@ -96,7 +96,7 @@ impl Field { match self.label { Label::Optional => quote! { ::prost::encoding::message::merge(wire_type, - #ident.get_or_insert_with(Default::default), + #ident.get_or_insert_with(::core::default::Default::default), buf, ctx) }, diff --git a/prost-derive/src/field/scalar.rs b/prost-derive/src/field/scalar.rs index 75a4fe3a8..35f249353 100644 --- a/prost-derive/src/field/scalar.rs +++ b/prost-derive/src/field/scalar.rs @@ -151,7 +151,7 @@ impl Field { }, Kind::Optional(..) => quote! { #merge_fn(wire_type, - #ident.get_or_insert_with(Default::default), + #ident.get_or_insert_with(::core::default::Default::default), buf, ctx) }, @@ -769,7 +769,9 @@ impl DefaultValue { quote!(::prost::alloc::string::String::new()) } DefaultValue::String(ref value) => quote!(#value.into()), - DefaultValue::Bytes(ref value) if value.is_empty() => quote!(Default::default()), + DefaultValue::Bytes(ref value) if value.is_empty() => { + quote!(::core::default::Default::default()) + } DefaultValue::Bytes(ref value) => { let lit = LitByteStr::new(value, Span::call_site()); quote!(#lit.as_ref().into()) diff --git a/prost-derive/src/lib.rs b/prost-derive/src/lib.rs index a517c41e8..3cc23a533 100644 --- a/prost-derive/src/lib.rs +++ b/prost-derive/src/lib.rs @@ -204,7 +204,7 @@ fn try_message(input: TokenStream) -> Result { } } - impl #impl_generics Default for #ident #ty_generics #where_clause { + impl #impl_generics ::core::default::Default for #ident #ty_generics #where_clause { fn default() -> Self { #ident { #(#default)*