Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/bevy_reflect/derive/src/from_reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ fn impl_struct_internal(
// The constructed "Self" ident
let __this = Ident::new("__this", Span::call_site());

// Workaround for rustfmt issue: https://github.com/rust-lang/rustfmt/issues/6779
// `quote!(Self(#__this))` causes rustfmt to panic in Rust 1.93.0+
let self_ty = quote!(Self);
Comment thread
alice-i-cecile marked this conversation as resolved.

// The reflected type: either `Self` or a remote type
let (reflect_ty, constructor, retval) = if let Some(remote_ty) = remote_ty {
let constructor = match remote_ty.as_expr_path() {
Expand All @@ -157,10 +161,10 @@ fn impl_struct_internal(
(
quote!(#remote_ty),
quote!(#constructor),
quote!(Self(#__this)),
quote!(#self_ty(#__this)),
)
} else {
(quote!(Self), quote!(Self), quote!(#__this))
(quote!(#self_ty), quote!(#self_ty), quote!(#__this))
};

let constructor = if is_defaultable {
Expand Down