These lang items are used when deriving Eq and PartialEq, and will be checked when compiling pattern matching.
gcc/rust/ChangeLog:
* util/rust-lang-item.cc: New items.
* util/rust-lang-item.h: Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/structural-eq-peq.rs: New test.
{"from_ok", Kind::TRY_FROM_OK},
{"from", Kind::FROM_FROM},
+
+ {"structural_peq", Kind::STRUCTURAL_PEQ},
+ {"structural_teq", Kind::STRUCTURAL_TEQ},
}};
tl::optional<LangItem::Kind>
// NOTE: This is not a lang item in later versions of Rust
FROM_FROM,
+
+ STRUCTURAL_PEQ,
+ STRUCTURAL_TEQ,
};
static const BiMap<std::string, Kind> lang_items;
--- /dev/null
+#[lang = "structural_peq"]
+pub trait StructuralPartialEq {
+ // Empty.
+}
+
+#[lang = "structural_teq"]
+pub trait StructuralEq {
+ // Empty.
+}