Skip to content

Commit d2780f1

Browse files
committed
Explicitly use an empty vector for structural eq
Previous code was technically valid since the moved from vector was empty but explicitly setting it empty with it's own name will help. gcc/rust/ChangeLog: * expand/rust-derive-eq.cc: Use empty vector explicitly. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
1 parent fa88250 commit d2780f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gcc/rust/expand/rust-derive-eq.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,13 @@ DeriveEq::eq_impls (
128128
auto eq_impl = builder.trait_impl (eq, std::move (eq_generics.self_type),
129129
std::move (trait_items),
130130
std::move (eq_generics.impl));
131+
132+
// StructuralEq is a marker trait
133+
decltype (trait_items) steq_trait_items = {};
134+
131135
auto steq_impl
132136
= builder.trait_impl (steq, std::move (steq_generics.self_type),
133-
std::move (trait_items),
137+
std::move (steq_trait_items),
134138
std::move (steq_generics.impl));
135139

136140
return vec (std::move (eq_impl), std::move (steq_impl));

0 commit comments

Comments
 (0)