namespace Rust {
namespace AST {
+static TypePath
+get_eq_trait_path (Builder &builder)
+{
+ return builder.type_path ({"core", "cmp", "Eq"}, true);
+}
+
DeriveEq::DeriveEq (location_t loc) : DeriveVisitor (loc) {}
std::vector<std::unique_ptr<AST::Item>>
DeriveEq::assert_param_is_eq ()
{
auto eq_bound = std::unique_ptr<TypeParamBound> (
- new TraitBound (builder.type_path ({"core", "cmp", "Eq"}, true), loc));
+ new TraitBound (get_eq_trait_path (builder), loc));
auto sized_bound = std::unique_ptr<TypeParamBound> (
new TraitBound (builder.type_path (LangItem::Kind::SIZED), loc, false,
const std::vector<std::unique_ptr<GenericParam>> &type_generics)
{
// We create two copies of the type-path to avoid duplicate NodeIds
- auto eq = builder.type_path ({"core", "cmp", "Eq"}, true);
- auto eq_bound
- = builder.trait_bound (builder.type_path ({"core", "cmp", "Eq"}, true));
+ auto eq = get_eq_trait_path (builder);
+ auto eq_bound = builder.trait_bound (get_eq_trait_path (builder));
auto steq = builder.type_path (LangItem::Kind::STRUCTURAL_TEQ);