From: Arthur Cohen <arthur.cohen@embecosm.com>
To: gcc-patches@gcc.gnu.org
Cc: gcc-rust@gcc.gnu.org, Arthur Cohen <arthur.cohen@embecosm.com>
Subject: [PATCH 023/125] gccrs: lang-items: Make lang items enum stronger, rename class, cleanup ns.
Date: Thu, 1 Aug 2024 16:56:19 +0200 [thread overview]
Message-ID: <20240801145809.366388-25-arthur.cohen@embecosm.com> (raw)
In-Reply-To: <20240801145809.366388-2-arthur.cohen@embecosm.com>
gcc/rust/ChangeLog:
* util/rust-lang-item.h (class RustLangItem): Renamed to...
(class LangItem): ...this. Rename ItemType enum to Kind
* util/rust-lang-item.cc: Rename methods to use new class name.
* backend/rust-compile-expr.cc (CompileExpr::visit): Use new lang-item API.
(CompileExpr::resolve_operator_overload): Likewise.
* backend/rust-compile-expr.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Likewise.
* typecheck/rust-autoderef.cc (Adjuster::try_deref_type): Likewise.
(AutoderefCycle::cycle): Likewise.
* typecheck/rust-autoderef.h: Likewise.
* typecheck/rust-hir-type-bounds.h: Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): Likewise.
(TypeBoundsProbe::assemble_builtin_candidate): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
* util/rust-hir-map.cc (Mappings::get_lang_item): Likewise.
(Mappings::lookup_trait_item_lang_item): Likewise.
* util/rust-hir-map.h: Likewise.
---
gcc/rust/backend/rust-compile-expr.cc | 24 +-
gcc/rust/backend/rust-compile-expr.h | 8 +-
gcc/rust/hir/rust-ast-lower-base.cc | 2 +-
gcc/rust/typecheck/rust-autoderef.cc | 22 +-
gcc/rust/typecheck/rust-autoderef.h | 5 +-
gcc/rust/typecheck/rust-hir-type-bounds.h | 2 +-
.../typecheck/rust-hir-type-check-base.cc | 3 +-
gcc/rust/typecheck/rust-hir-type-check-base.h | 5 +-
.../typecheck/rust-hir-type-check-expr.cc | 72 +++---
gcc/rust/typecheck/rust-hir-type-check-expr.h | 7 +-
.../typecheck/rust-hir-type-check-type.cc | 3 +-
gcc/rust/typecheck/rust-tyty-bounds.cc | 12 +-
gcc/rust/typecheck/rust-tyty.cc | 5 +-
gcc/rust/util/rust-hir-map.cc | 7 +-
gcc/rust/util/rust-hir-map.h | 13 +-
gcc/rust/util/rust-lang-item.cc | 218 +++++++++---------
gcc/rust/util/rust-lang-item.h | 31 ++-
17 files changed, 213 insertions(+), 226 deletions(-)
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index 596b848849e..65de24bf9d8 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -150,7 +150,7 @@ CompileExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
if (is_op_overload)
{
auto lang_item_type
- = Analysis::RustLangItem::OperatorToLangItem (expr.get_expr_type ());
+ = LangItem::OperatorToLangItem (expr.get_expr_type ());
translated = resolve_operator_overload (lang_item_type, expr, lhs, rhs,
expr.get_lhs ().get (),
expr.get_rhs ().get ());
@@ -193,9 +193,8 @@ CompileExpr::visit (HIR::CompoundAssignmentExpr &expr)
expr.get_mappings ().get_hirid (), &fntype);
if (is_op_overload)
{
- auto lang_item_type
- = Analysis::RustLangItem::CompoundAssignmentOperatorToLangItem (
- expr.get_expr_type ());
+ auto lang_item_type = LangItem::CompoundAssignmentOperatorToLangItem (
+ expr.get_expr_type ());
auto compound_assignment
= resolve_operator_overload (lang_item_type, expr, lhs, rhs,
expr.get_lhs ().get (),
@@ -244,8 +243,7 @@ CompileExpr::visit (HIR::NegationExpr &expr)
expr.get_mappings ().get_hirid (), &fntype);
if (is_op_overload)
{
- auto lang_item_type
- = Analysis::RustLangItem::NegationOperatorToLangItem (op);
+ auto lang_item_type = LangItem::NegationOperatorToLangItem (op);
translated
= resolve_operator_overload (lang_item_type, expr, negated_expr,
nullptr, expr.get_expr ().get (), nullptr);
@@ -836,7 +834,7 @@ CompileExpr::visit (HIR::DereferenceExpr &expr)
expr.get_mappings ().get_hirid (), &fntype);
if (is_op_overload)
{
- auto lang_item_type = Analysis::RustLangItem::ItemType::DEREF;
+ auto lang_item_type = LangItem::Kind::DEREF;
tree operator_overload_call
= resolve_operator_overload (lang_item_type, expr, main_expr, nullptr,
expr.get_expr ().get (), nullptr);
@@ -1423,9 +1421,10 @@ CompileExpr::get_receiver_from_dyn (const TyTy::DynamicObjectType *dyn,
}
tree
-CompileExpr::resolve_operator_overload (
- Analysis::RustLangItem::ItemType lang_item_type, HIR::OperatorExprMeta expr,
- tree lhs, tree rhs, HIR::Expr *lhs_expr, HIR::Expr *rhs_expr)
+CompileExpr::resolve_operator_overload (LangItem::Kind lang_item_type,
+ HIR::OperatorExprMeta expr, tree lhs,
+ tree rhs, HIR::Expr *lhs_expr,
+ HIR::Expr *rhs_expr)
{
TyTy::FnType *fntype;
bool is_op_overload = ctx->get_tyctx ()->lookup_operator_overload (
@@ -1446,8 +1445,7 @@ CompileExpr::resolve_operator_overload (
}
// lookup compiled functions since it may have already been compiled
- HIR::PathIdentSegment segment_name (
- Analysis::RustLangItem::ToString (lang_item_type));
+ HIR::PathIdentSegment segment_name (LangItem::ToString (lang_item_type));
tree fn_expr = resolve_method_address (fntype, receiver, expr.get_locus ());
// lookup the autoderef mappings
@@ -2120,7 +2118,7 @@ CompileExpr::visit (HIR::ArrayIndexExpr &expr)
expr.get_mappings ().get_hirid (), &fntype);
if (is_op_overload)
{
- auto lang_item_type = Analysis::RustLangItem::ItemType::INDEX;
+ auto lang_item_type = LangItem::Kind::INDEX;
tree operator_overload_call
= resolve_operator_overload (lang_item_type, expr, array_reference,
index, expr.get_array_expr ().get (),
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index e947825c2a9..af2e1bca1ec 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -97,10 +97,10 @@ protected:
TyTy::BaseType *receiver, TyTy::FnType *fntype,
tree receiver_ref, location_t expr_locus);
- tree
- resolve_operator_overload (Analysis::RustLangItem::ItemType lang_item_type,
- HIR::OperatorExprMeta expr, tree lhs, tree rhs,
- HIR::Expr *lhs_expr, HIR::Expr *rhs_expr);
+ tree resolve_operator_overload (LangItem::Kind lang_item_type,
+ HIR::OperatorExprMeta expr, tree lhs,
+ tree rhs, HIR::Expr *lhs_expr,
+ HIR::Expr *rhs_expr);
tree compile_bool_literal (const HIR::LiteralExpr &expr,
const TyTy::BaseType *tyty);
diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc
index 815b98f9f0a..bcc4797df77 100644
--- a/gcc/rust/hir/rust-ast-lower-base.cc
+++ b/gcc/rust/hir/rust-ast-lower-base.cc
@@ -788,7 +788,7 @@ ASTLoweringBase::handle_lang_item_attribute (const ItemWrapper &item,
{
auto &literal = static_cast<AST::AttrInputLiteral &> (attr.get_attr_input ());
const auto &lang_item_type_str = literal.get_literal ().as_string ();
- auto lang_item_type = Analysis::RustLangItem::Parse (lang_item_type_str);
+ auto lang_item_type = LangItem::Parse (lang_item_type_str);
if (lang_item_type)
mappings->insert_lang_item (*lang_item_type,
diff --git a/gcc/rust/typecheck/rust-autoderef.cc b/gcc/rust/typecheck/rust-autoderef.cc
index 9966c5469c5..232ee6130c9 100644
--- a/gcc/rust/typecheck/rust-autoderef.cc
+++ b/gcc/rust/typecheck/rust-autoderef.cc
@@ -28,8 +28,7 @@ namespace Resolver {
static bool
resolve_operator_overload_fn (
- Analysis::RustLangItem::ItemType lang_item_type, TyTy::BaseType *ty,
- TyTy::FnType **resolved_fn,
+ LangItem::Kind lang_item_type, TyTy::BaseType *ty, TyTy::FnType **resolved_fn,
Adjustment::AdjustmentType *requires_ref_adjustment);
TyTy::BaseType *
@@ -42,8 +41,7 @@ Adjuster::adjust_type (const std::vector<Adjustment> &adjustments)
}
Adjustment
-Adjuster::try_deref_type (TyTy::BaseType *ty,
- Analysis::RustLangItem::ItemType deref_lang_item)
+Adjuster::try_deref_type (TyTy::BaseType *ty, LangItem::Kind deref_lang_item)
{
TyTy::FnType *fn = nullptr;
Adjustment::AdjustmentType requires_ref_adjustment
@@ -68,11 +66,11 @@ Adjuster::try_deref_type (TyTy::BaseType *ty,
= Adjustment::AdjustmentType::ERROR;
switch (deref_lang_item)
{
- case Analysis::RustLangItem::ItemType::DEREF:
+ case LangItem::Kind::DEREF:
adjustment_type = Adjustment::AdjustmentType::DEREF;
break;
- case Analysis::RustLangItem::ItemType::DEREF_MUT:
+ case LangItem::Kind::DEREF_MUT:
adjustment_type = Adjustment::AdjustmentType::DEREF_MUT;
break;
@@ -122,7 +120,7 @@ Adjuster::try_unsize_type (TyTy::BaseType *ty)
static bool
resolve_operator_overload_fn (
- Analysis::RustLangItem::ItemType lang_item_type, TyTy::BaseType *lhs,
+ LangItem::Kind lang_item_type, TyTy::BaseType *lhs,
TyTy::FnType **resolved_fn,
Adjustment::AdjustmentType *requires_ref_adjustment)
{
@@ -130,8 +128,7 @@ resolve_operator_overload_fn (
auto mappings = Analysis::Mappings::get ();
// look up lang item for arithmetic type
- std::string associated_item_name
- = Analysis::RustLangItem::ToString (lang_item_type);
+ std::string associated_item_name = LangItem::ToString (lang_item_type);
DefId respective_lang_item_id = UNKNOWN_DEFID;
bool lang_item_defined
= mappings->lookup_lang_item (lang_item_type, &respective_lang_item_id);
@@ -359,8 +356,7 @@ AutoderefCycle::cycle (TyTy::BaseType *receiver)
return false;
}
- Adjustment deref
- = Adjuster::try_deref_type (r, Analysis::RustLangItem::ItemType::DEREF);
+ Adjustment deref = Adjuster::try_deref_type (r, LangItem::Kind::DEREF);
if (!deref.is_error ())
{
auto deref_r = deref.get_expected ();
@@ -374,8 +370,8 @@ AutoderefCycle::cycle (TyTy::BaseType *receiver)
adjustments.pop_back ();
}
- Adjustment deref_mut = Adjuster::try_deref_type (
- r, Analysis::RustLangItem::ItemType::DEREF_MUT);
+ Adjustment deref_mut
+ = Adjuster::try_deref_type (r, LangItem::Kind::DEREF_MUT);
if (!deref_mut.is_error ())
{
auto deref_r = deref_mut.get_expected ();
diff --git a/gcc/rust/typecheck/rust-autoderef.h b/gcc/rust/typecheck/rust-autoderef.h
index f9c759b6f3c..1937b0c1f4c 100644
--- a/gcc/rust/typecheck/rust-autoderef.h
+++ b/gcc/rust/typecheck/rust-autoderef.h
@@ -132,9 +132,8 @@ public:
TyTy::BaseType *adjust_type (const std::vector<Adjustment> &adjustments);
- static Adjustment
- try_deref_type (TyTy::BaseType *ty,
- Analysis::RustLangItem::ItemType deref_lang_item);
+ static Adjustment try_deref_type (TyTy::BaseType *ty,
+ LangItem::Kind deref_lang_item);
static Adjustment try_raw_deref_type (TyTy::BaseType *ty);
diff --git a/gcc/rust/typecheck/rust-hir-type-bounds.h b/gcc/rust/typecheck/rust-hir-type-bounds.h
index 27fb32c7b43..4e781afd2a7 100644
--- a/gcc/rust/typecheck/rust-hir-type-bounds.h
+++ b/gcc/rust/typecheck/rust-hir-type-bounds.h
@@ -38,7 +38,7 @@ public:
private:
void scan ();
void assemble_sized_builtin ();
- void assemble_builtin_candidate (Analysis::RustLangItem::ItemType item);
+ void assemble_builtin_candidate (LangItem::Kind item);
private:
TypeBoundsProbe (const TyTy::BaseType *receiver);
diff --git a/gcc/rust/typecheck/rust-hir-type-check-base.cc b/gcc/rust/typecheck/rust-hir-type-check-base.cc
index b9b4f91ac9f..f3edfef4e27 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-base.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-base.cc
@@ -411,8 +411,7 @@ TypeCheckBase::resolve_generic_params (
}
TyTy::TypeBoundPredicate
-TypeCheckBase::get_marker_predicate (Analysis::RustLangItem::ItemType item_type,
- location_t locus)
+TypeCheckBase::get_marker_predicate (LangItem::Kind item_type, location_t locus)
{
DefId item_id = mappings->get_lang_item (item_type, locus);
HIR::Item *item = mappings->lookup_defid (item_id);
diff --git a/gcc/rust/typecheck/rust-hir-type-check-base.h b/gcc/rust/typecheck/rust-hir-type-check-base.h
index 0491e0fe175..11a3a686df7 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-base.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-base.h
@@ -58,9 +58,8 @@ protected:
const std::vector<std::unique_ptr<HIR::GenericParam> > &generic_params,
std::vector<TyTy::SubstitutionParamMapping> &substitutions);
- TyTy::TypeBoundPredicate
- get_marker_predicate (Analysis::RustLangItem::ItemType item_type,
- location_t locus);
+ TyTy::TypeBoundPredicate get_marker_predicate (LangItem::Kind item_type,
+ location_t locus);
Analysis::Mappings *mappings;
Resolver *resolver;
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index 9f5042a4ece..224d2fff4b8 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -260,8 +260,7 @@ TypeCheckExpr::visit (HIR::CompoundAssignmentExpr &expr)
expr.get_locus ());
auto lang_item_type
- = Analysis::RustLangItem::CompoundAssignmentOperatorToLangItem (
- expr.get_expr_type ());
+ = LangItem::CompoundAssignmentOperatorToLangItem (expr.get_expr_type ());
bool operator_overloaded
= resolve_operator_overload (lang_item_type, expr, lhs, rhs);
if (operator_overloaded)
@@ -292,8 +291,7 @@ TypeCheckExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ().get ());
auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ().get ());
- auto lang_item_type
- = Analysis::RustLangItem::OperatorToLangItem (expr.get_expr_type ());
+ auto lang_item_type = LangItem::OperatorToLangItem (expr.get_expr_type ());
bool operator_overloaded
= resolve_operator_overload (lang_item_type, expr, lhs, rhs);
if (operator_overloaded)
@@ -384,8 +382,8 @@ TypeCheckExpr::visit (HIR::NegationExpr &expr)
auto negated_expr_ty = TypeCheckExpr::Resolve (expr.get_expr ().get ());
// check for operator overload
- auto lang_item_type = Analysis::RustLangItem::NegationOperatorToLangItem (
- expr.get_expr_type ());
+ auto lang_item_type
+ = LangItem::NegationOperatorToLangItem (expr.get_expr_type ());
bool operator_overloaded
= resolve_operator_overload (lang_item_type, expr, negated_expr_ty,
nullptr);
@@ -628,7 +626,7 @@ TypeCheckExpr::visit (HIR::BlockExpr &expr)
void
TypeCheckExpr::visit (HIR::RangeFromToExpr &expr)
{
- auto lang_item_type = Analysis::RustLangItem::ItemType::RANGE;
+ auto lang_item_type = LangItem::Kind::RANGE;
DefId respective_lang_item_id = UNKNOWN_DEFID;
bool lang_item_defined
@@ -637,9 +635,9 @@ TypeCheckExpr::visit (HIR::RangeFromToExpr &expr)
// we need to have it maybe
if (!lang_item_defined)
{
- rust_internal_error_at (
- expr.get_locus (), "unable to find relevant lang item: %s",
- Analysis::RustLangItem::ToString (lang_item_type).c_str ());
+ rust_internal_error_at (expr.get_locus (),
+ "unable to find relevant lang item: %s",
+ LangItem::ToString (lang_item_type).c_str ());
return;
}
@@ -683,7 +681,7 @@ TypeCheckExpr::visit (HIR::RangeFromToExpr &expr)
void
TypeCheckExpr::visit (HIR::RangeFromExpr &expr)
{
- auto lang_item_type = Analysis::RustLangItem::ItemType::RANGE_FROM;
+ auto lang_item_type = LangItem::Kind::RANGE_FROM;
DefId respective_lang_item_id = UNKNOWN_DEFID;
bool lang_item_defined
@@ -692,9 +690,9 @@ TypeCheckExpr::visit (HIR::RangeFromExpr &expr)
// we need to have it maybe
if (!lang_item_defined)
{
- rust_internal_error_at (
- expr.get_locus (), "unable to find relevant lang item: %s",
- Analysis::RustLangItem::ToString (lang_item_type).c_str ());
+ rust_internal_error_at (expr.get_locus (),
+ "unable to find relevant lang item: %s",
+ LangItem::ToString (lang_item_type).c_str ());
return;
}
@@ -731,7 +729,7 @@ TypeCheckExpr::visit (HIR::RangeFromExpr &expr)
void
TypeCheckExpr::visit (HIR::RangeToExpr &expr)
{
- auto lang_item_type = Analysis::RustLangItem::ItemType::RANGE_TO;
+ auto lang_item_type = LangItem::Kind::RANGE_TO;
DefId respective_lang_item_id = UNKNOWN_DEFID;
bool lang_item_defined
@@ -740,9 +738,9 @@ TypeCheckExpr::visit (HIR::RangeToExpr &expr)
// we need to have it maybe
if (!lang_item_defined)
{
- rust_internal_error_at (
- expr.get_locus (), "unable to find relevant lang item: %s",
- Analysis::RustLangItem::ToString (lang_item_type).c_str ());
+ rust_internal_error_at (expr.get_locus (),
+ "unable to find relevant lang item: %s",
+ LangItem::ToString (lang_item_type).c_str ());
return;
}
@@ -778,7 +776,7 @@ TypeCheckExpr::visit (HIR::RangeToExpr &expr)
void
TypeCheckExpr::visit (HIR::RangeFullExpr &expr)
{
- auto lang_item_type = Analysis::RustLangItem::ItemType::RANGE_FULL;
+ auto lang_item_type = LangItem::Kind::RANGE_FULL;
DefId respective_lang_item_id = UNKNOWN_DEFID;
bool lang_item_defined
@@ -787,9 +785,9 @@ TypeCheckExpr::visit (HIR::RangeFullExpr &expr)
// we need to have it maybe
if (!lang_item_defined)
{
- rust_internal_error_at (
- expr.get_locus (), "unable to find relevant lang item: %s",
- Analysis::RustLangItem::ToString (lang_item_type).c_str ());
+ rust_internal_error_at (expr.get_locus (),
+ "unable to find relevant lang item: %s",
+ LangItem::ToString (lang_item_type).c_str ());
return;
}
@@ -809,7 +807,7 @@ TypeCheckExpr::visit (HIR::RangeFullExpr &expr)
void
TypeCheckExpr::visit (HIR::RangeFromToInclExpr &expr)
{
- auto lang_item_type = Analysis::RustLangItem::ItemType::RANGE_INCLUSIVE;
+ auto lang_item_type = LangItem::Kind::RANGE_INCLUSIVE;
DefId respective_lang_item_id = UNKNOWN_DEFID;
bool lang_item_defined
@@ -818,9 +816,9 @@ TypeCheckExpr::visit (HIR::RangeFromToInclExpr &expr)
// we need to have it maybe
if (!lang_item_defined)
{
- rust_internal_error_at (
- expr.get_locus (), "unable to find relevant lang item: %s",
- Analysis::RustLangItem::ToString (lang_item_type).c_str ());
+ rust_internal_error_at (expr.get_locus (),
+ "unable to find relevant lang item: %s",
+ LangItem::ToString (lang_item_type).c_str ());
return;
}
@@ -903,7 +901,7 @@ TypeCheckExpr::visit (HIR::ArrayIndexExpr &expr)
}
// is this a case of core::ops::index?
- auto lang_item_type = Analysis::RustLangItem::ItemType::INDEX;
+ auto lang_item_type = LangItem::Kind::INDEX;
bool operator_overloaded
= resolve_operator_overload (lang_item_type, expr, array_expr_ty,
index_expr_ty);
@@ -1412,7 +1410,7 @@ TypeCheckExpr::visit (HIR::DereferenceExpr &expr)
= TypeCheckExpr::Resolve (expr.get_expr ().get ());
rust_debug_loc (expr.get_locus (), "attempting deref operator overload");
- auto lang_item_type = Analysis::RustLangItem::ItemType::DEREF;
+ auto lang_item_type = LangItem::Kind::DEREF;
bool operator_overloaded
= resolve_operator_overload (lang_item_type, expr, resolved_base, nullptr);
if (operator_overloaded)
@@ -1586,8 +1584,7 @@ TypeCheckExpr::visit (HIR::ClosureExpr &expr)
// assume FnOnce for now. I think this is based on the return type of the
// closure
- Analysis::RustLangItem::ItemType lang_item_type
- = Analysis::RustLangItem::ItemType::FN_ONCE;
+ LangItem::Kind lang_item_type = LangItem::Kind::FN_ONCE;
DefId respective_lang_item_id = UNKNOWN_DEFID;
bool lang_item_defined
= mappings->lookup_lang_item (lang_item_type, &respective_lang_item_id);
@@ -1596,9 +1593,8 @@ TypeCheckExpr::visit (HIR::ClosureExpr &expr)
// FIXME
// we need to have a unified way or error'ing when we are missing lang
// items that is useful
- rust_fatal_error (
- expr.get_locus (), "unable to find lang item: %<%s%>",
- Analysis::RustLangItem::ToString (lang_item_type).c_str ());
+ rust_fatal_error (expr.get_locus (), "unable to find lang item: %<%s%>",
+ LangItem::ToString (lang_item_type).c_str ());
}
rust_assert (lang_item_defined);
@@ -1637,13 +1633,13 @@ TypeCheckExpr::visit (HIR::ClosureExpr &expr)
}
bool
-TypeCheckExpr::resolve_operator_overload (
- Analysis::RustLangItem::ItemType lang_item_type, HIR::OperatorExprMeta expr,
- TyTy::BaseType *lhs, TyTy::BaseType *rhs)
+TypeCheckExpr::resolve_operator_overload (LangItem::Kind lang_item_type,
+ HIR::OperatorExprMeta expr,
+ TyTy::BaseType *lhs,
+ TyTy::BaseType *rhs)
{
// look up lang item for arithmetic type
- std::string associated_item_name
- = Analysis::RustLangItem::ToString (lang_item_type);
+ std::string associated_item_name = LangItem::ToString (lang_item_type);
DefId respective_lang_item_id = UNKNOWN_DEFID;
bool lang_item_defined
= mappings->lookup_lang_item (lang_item_type, &respective_lang_item_id);
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.h b/gcc/rust/typecheck/rust-hir-type-check-expr.h
index c9df24e2dbe..9ea4dc6e59c 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.h
@@ -96,10 +96,9 @@ public:
}
protected:
- bool
- resolve_operator_overload (Analysis::RustLangItem::ItemType lang_item_type,
- HIR::OperatorExprMeta expr, TyTy::BaseType *lhs,
- TyTy::BaseType *rhs);
+ bool resolve_operator_overload (LangItem::Kind lang_item_type,
+ HIR::OperatorExprMeta expr,
+ TyTy::BaseType *lhs, TyTy::BaseType *rhs);
bool resolve_fn_trait_call (HIR::CallExpr &expr,
TyTy::BaseType *function_tyty,
diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc
index 74a12c4b011..a132b386a96 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc
@@ -794,8 +794,7 @@ TypeResolveGenericParam::visit (HIR::TypeParam ¶m)
if (apply_sized)
{
TyTy::TypeBoundPredicate sized_predicate
- = get_marker_predicate (Analysis::RustLangItem::ItemType::SIZED,
- param.get_locus ());
+ = get_marker_predicate (LangItem::Kind::SIZED, param.get_locus ());
predicates[sized_predicate.get_id ()] = {sized_predicate};
}
diff --git a/gcc/rust/typecheck/rust-tyty-bounds.cc b/gcc/rust/typecheck/rust-tyty-bounds.cc
index f37cf50d53c..6e4c3458118 100644
--- a/gcc/rust/typecheck/rust-tyty-bounds.cc
+++ b/gcc/rust/typecheck/rust-tyty-bounds.cc
@@ -131,7 +131,7 @@ TypeBoundsProbe::assemble_sized_builtin ()
case TyTy::NEVER:
case TyTy::PLACEHOLDER:
case TyTy::PROJECTION:
- assemble_builtin_candidate (Analysis::RustLangItem::SIZED);
+ assemble_builtin_candidate (LangItem::Kind::SIZED);
break;
// FIXME str and slice need to be moved and test cases updated
@@ -140,7 +140,7 @@ TypeBoundsProbe::assemble_sized_builtin ()
case TyTy::ADT:
case TyTy::TUPLE:
// FIXME add extra checks
- assemble_builtin_candidate (Analysis::RustLangItem::SIZED);
+ assemble_builtin_candidate (LangItem::Kind::SIZED);
break;
case TyTy::DYNAMIC:
@@ -150,8 +150,7 @@ TypeBoundsProbe::assemble_sized_builtin ()
}
void
-TypeBoundsProbe::assemble_builtin_candidate (
- Analysis::RustLangItem::ItemType lang_item)
+TypeBoundsProbe::assemble_builtin_candidate (LangItem::Kind lang_item)
{
DefId id;
bool found_lang_item = mappings->lookup_lang_item (lang_item, &id);
@@ -171,7 +170,7 @@ TypeBoundsProbe::assemble_builtin_candidate (
trait_references.push_back ({trait_ref, mappings->lookup_builtin_marker ()});
rust_debug ("Added builtin lang_item: %s for %s",
- Analysis::RustLangItem::ToString (lang_item).c_str (),
+ LangItem::ToString (lang_item).c_str (),
raw->get_name ().c_str ());
}
@@ -246,8 +245,7 @@ TypeCheckBase::get_predicate_from_bound (HIR::TypePath &type_path,
TypeCheckType::Resolve (fn.get_return_type ().get ());
HIR::TraitItem *trait_item = mappings->lookup_trait_item_lang_item (
- Analysis::RustLangItem::ItemType::FN_ONCE_OUTPUT,
- final_seg->get_locus ());
+ LangItem::Kind::FN_ONCE_OUTPUT, final_seg->get_locus ());
std::vector<HIR::GenericArgsBinding> bindings;
location_t output_locus = fn.get_return_type ()->get_locus ();
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index d81311eed6e..51960efa406 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -2215,9 +2215,8 @@ void
ClosureType::setup_fn_once_output () const
{
// lookup the lang items
- auto fn_once_lang_item = Analysis::RustLangItem::ItemType::FN_ONCE;
- auto fn_once_output_lang_item
- = Analysis::RustLangItem::ItemType::FN_ONCE_OUTPUT;
+ auto fn_once_lang_item = LangItem::Kind::FN_ONCE;
+ auto fn_once_output_lang_item = LangItem::Kind::FN_ONCE_OUTPUT;
DefId trait_id = UNKNOWN_DEFID;
bool trait_lang_item_defined
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc
index 91fa2562c39..1f7cb4d2c48 100644
--- a/gcc/rust/util/rust-hir-map.cc
+++ b/gcc/rust/util/rust-hir-map.cc
@@ -1252,20 +1252,19 @@ Mappings::lookup_builtin_marker ()
}
DefId
-Mappings::get_lang_item (RustLangItem::ItemType item_type, location_t locus)
+Mappings::get_lang_item (LangItem::Kind item_type, location_t locus)
{
DefId item = UNKNOWN_DEFID;
bool ok = lookup_lang_item (item_type, &item);
if (!ok)
rust_fatal_error (locus, "failed to find lang item %s",
- RustLangItem::ToString (item_type).c_str ());
+ LangItem::ToString (item_type).c_str ());
return item;
}
HIR::TraitItem *
-Mappings::lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item,
- location_t locus)
+Mappings::lookup_trait_item_lang_item (LangItem::Kind item, location_t locus)
{
DefId trait_item_id = get_lang_item (item, locus);
return lookup_trait_item_defid (trait_item_id);
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h
index a663bfe4a56..927c01251db 100644
--- a/gcc/rust/util/rust-hir-map.h
+++ b/gcc/rust/util/rust-hir-map.h
@@ -255,7 +255,7 @@ public:
return true;
}
- void insert_lang_item (RustLangItem::ItemType item_type, DefId id)
+ void insert_lang_item (LangItem::Kind item_type, DefId id)
{
auto it = lang_item_mappings.find (item_type);
rust_assert (it == lang_item_mappings.end ());
@@ -263,7 +263,7 @@ public:
lang_item_mappings[item_type] = id;
}
- bool lookup_lang_item (RustLangItem::ItemType item_type, DefId *id)
+ bool lookup_lang_item (LangItem::Kind item_type, DefId *id)
{
auto it = lang_item_mappings.find (item_type);
if (it == lang_item_mappings.end ())
@@ -274,7 +274,7 @@ public:
}
// This will fatal_error when this lang item does not exist
- DefId get_lang_item (RustLangItem::ItemType item_type, location_t locus);
+ DefId get_lang_item (LangItem::Kind item_type, location_t locus);
void insert_macro_def (AST::MacroRulesDefinition *macro);
@@ -347,9 +347,8 @@ public:
HIR::ImplBlock *lookup_builtin_marker ();
- HIR::TraitItem *
- lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item,
- location_t locus);
+ HIR::TraitItem *lookup_trait_item_lang_item (LangItem::Kind item,
+ location_t locus);
private:
Mappings ();
@@ -388,7 +387,7 @@ private:
std::map<HirId, HIR::GenericParam *> hirGenericParamMappings;
std::map<HirId, HIR::Trait *> hirTraitItemsToTraitMappings;
std::map<HirId, HIR::Pattern *> hirPatternMappings;
- std::map<RustLangItem::ItemType, DefId> lang_item_mappings;
+ std::map<LangItem::Kind, DefId> lang_item_mappings;
std::map<NodeId, const Resolver::CanonicalPath> paths;
std::map<NodeId, location_t> locations;
std::map<NodeId, HirId> nodeIdToHirMappings;
diff --git a/gcc/rust/util/rust-lang-item.cc b/gcc/rust/util/rust-lang-item.cc
index 9fe212d412d..38df90f29a1 100644
--- a/gcc/rust/util/rust-lang-item.cc
+++ b/gcc/rust/util/rust-lang-item.cc
@@ -20,172 +20,168 @@
#include "rust-system.h"
namespace Rust {
-namespace Analysis {
-
-const BiMap<std::string, RustLangItem::ItemType>
- Rust::Analysis::RustLangItem::lang_items = {{
- {"add", ADD},
- {"sub", SUBTRACT},
- {"mul", MULTIPLY},
- {"div", DIVIDE},
- {"rem", REMAINDER},
- {"bitand", BITAND},
- {"bitor", BITOR},
- {"bitxor", BITXOR},
- {"shl", SHL},
- {"shr", SHR},
- {"neg", NEGATION},
- {"not", NOT},
- {"add_assign", ADD_ASSIGN},
- {"sub_assign", SUB_ASSIGN},
- {"mul_assign", MUL_ASSIGN},
- {"div_assign", DIV_ASSIGN},
- {"rem_assign", REM_ASSIGN},
- {"bitand_assign", BITAND_ASSIGN},
- {"bitor_assign", BITOR_ASSIGN},
- {"bitxor_assign", BITXOR_ASSIGN},
- {"shl_assign", SHL_ASSIGN},
- {"shr_assign", SHR_ASSIGN},
- {"deref", DEREF},
- {"deref_mut", DEREF_MUT},
- {"index", INDEX},
- {"index_mut", INDEX_MUT},
- {"RangeFull", RANGE_FULL},
- {"Range", RANGE},
- {"RangeFrom", RANGE_FROM},
- {"RangeTo", RANGE_TO},
- {"RangeInclusive", RANGE_INCLUSIVE},
- {"RangeToInclusive", RANGE_TO_INCLUSIVE},
- {"phantom_data", PHANTOM_DATA},
- {"fn", FN},
- {"fn_mut", FN_MUT},
- {"fn_once", FN_ONCE},
- {"fn_once_output", FN_ONCE_OUTPUT},
- {"copy", COPY},
- {"clone", CLONE},
- {"sized", SIZED},
- {"slice_alloc", SLICE_ALLOC},
- {"slice_u8_alloc", SLICE_U8_ALLOC},
- {"str_alloc", STR_ALLOC},
- {"array", ARRAY},
- {"bool", BOOL},
- {"char", CHAR},
- {"f32", F32},
- {"f64", F64},
- {"i8", I8},
- {"i16", I16},
- {"i32", I32},
- {"i64", I64},
- {"i128", I128},
- {"isize", ISIZE},
- {"u8", U8},
- {"u16", U16},
- {"u32", U32},
- {"u64", U64},
- {"u128", U128},
- {"usize", USIZE},
- {"const_ptr", CONST_PTR},
- {"const_slice_ptr", CONST_SLICE_PTR},
- {"mut_ptr", MUT_PTR},
- {"mut_slice_ptr", MUT_SLICE_PTR},
- {"slice_u8", SLICE_U8},
- {"slice", SLICE},
- {"str", STR},
- {"f32_runtime", F32_RUNTIME},
- {"f64_runtime", F64_RUNTIME},
- }};
-
-tl::optional<RustLangItem::ItemType>
-RustLangItem::Parse (const std::string &item)
+
+const BiMap<std::string, LangItem::Kind> Rust::LangItem::lang_items = {{
+ {"add", Kind::ADD},
+ {"sub", Kind::SUBTRACT},
+ {"mul", Kind::MULTIPLY},
+ {"div", Kind::DIVIDE},
+ {"rem", Kind::REMAINDER},
+ {"bitand", Kind::BITAND},
+ {"bitor", Kind::BITOR},
+ {"bitxor", Kind::BITXOR},
+ {"shl", Kind::SHL},
+ {"shr", Kind::SHR},
+ {"neg", Kind::NEGATION},
+ {"not", Kind::NOT},
+ {"add_assign", Kind::ADD_ASSIGN},
+ {"sub_assign", Kind::SUB_ASSIGN},
+ {"mul_assign", Kind::MUL_ASSIGN},
+ {"div_assign", Kind::DIV_ASSIGN},
+ {"rem_assign", Kind::REM_ASSIGN},
+ {"bitand_assign", Kind::BITAND_ASSIGN},
+ {"bitor_assign", Kind::BITOR_ASSIGN},
+ {"bitxor_assign", Kind::BITXOR_ASSIGN},
+ {"shl_assign", Kind::SHL_ASSIGN},
+ {"shr_assign", Kind::SHR_ASSIGN},
+ {"deref", Kind::DEREF},
+ {"deref_mut", Kind::DEREF_MUT},
+ {"index", Kind::INDEX},
+ {"index_mut", Kind::INDEX_MUT},
+ {"RangeFull", Kind::RANGE_FULL},
+ {"Range", Kind::RANGE},
+ {"RangeFrom", Kind::RANGE_FROM},
+ {"RangeTo", Kind::RANGE_TO},
+ {"RangeInclusive", Kind::RANGE_INCLUSIVE},
+ {"RangeToInclusive", Kind::RANGE_TO_INCLUSIVE},
+ {"phantom_data", Kind::PHANTOM_DATA},
+ {"fn", Kind::FN},
+ {"fn_mut", Kind::FN_MUT},
+ {"fn_once", Kind::FN_ONCE},
+ {"fn_once_output", Kind::FN_ONCE_OUTPUT},
+ {"copy", Kind::COPY},
+ {"clone", Kind::CLONE},
+ {"sized", Kind::SIZED},
+ {"slice_alloc", Kind::SLICE_ALLOC},
+ {"slice_u8_alloc", Kind::SLICE_U8_ALLOC},
+ {"str_alloc", Kind::STR_ALLOC},
+ {"array", Kind::ARRAY},
+ {"bool", Kind::BOOL},
+ {"char", Kind::CHAR},
+ {"f32", Kind::F32},
+ {"f64", Kind::F64},
+ {"i8", Kind::I8},
+ {"i16", Kind::I16},
+ {"i32", Kind::I32},
+ {"i64", Kind::I64},
+ {"i128", Kind::I128},
+ {"isize", Kind::ISIZE},
+ {"u8", Kind::U8},
+ {"u16", Kind::U16},
+ {"u32", Kind::U32},
+ {"u64", Kind::U64},
+ {"u128", Kind::U128},
+ {"usize", Kind::USIZE},
+ {"const_ptr", Kind::CONST_PTR},
+ {"const_slice_ptr", Kind::CONST_SLICE_PTR},
+ {"mut_ptr", Kind::MUT_PTR},
+ {"mut_slice_ptr", Kind::MUT_SLICE_PTR},
+ {"slice_u8", Kind::SLICE_U8},
+ {"slice", Kind::SLICE},
+ {"str", Kind::STR},
+ {"f32_runtime", Kind::F32_RUNTIME},
+ {"f64_runtime", Kind::F64_RUNTIME},
+}};
+
+tl::optional<LangItem::Kind>
+LangItem::Parse (const std::string &item)
{
- auto lang_item = RustLangItem::lang_items.lookup (item);
- if (!RustLangItem::lang_items.is_iter_ok (lang_item))
+ auto lang_item = LangItem::lang_items.lookup (item);
+ if (!LangItem::lang_items.is_iter_ok (lang_item))
return tl::nullopt;
return lang_item->second;
}
std::string
-RustLangItem::ToString (RustLangItem::ItemType type)
+LangItem::ToString (LangItem::Kind type)
{
- auto str = RustLangItem::lang_items.lookup (type);
+ auto str = LangItem::lang_items.lookup (type);
return str->second;
}
-RustLangItem::ItemType
-RustLangItem::OperatorToLangItem (ArithmeticOrLogicalOperator op)
+LangItem::Kind
+LangItem::OperatorToLangItem (ArithmeticOrLogicalOperator op)
{
switch (op)
{
case ArithmeticOrLogicalOperator::ADD:
- return RustLangItem::ItemType::ADD;
+ return LangItem::Kind::ADD;
case ArithmeticOrLogicalOperator::SUBTRACT:
- return RustLangItem::ItemType::SUBTRACT;
+ return LangItem::Kind::SUBTRACT;
case ArithmeticOrLogicalOperator::MULTIPLY:
- return RustLangItem::ItemType::MULTIPLY;
+ return LangItem::Kind::MULTIPLY;
case ArithmeticOrLogicalOperator::DIVIDE:
- return RustLangItem::ItemType::DIVIDE;
+ return LangItem::Kind::DIVIDE;
case ArithmeticOrLogicalOperator::MODULUS:
- return RustLangItem::ItemType::REMAINDER;
+ return LangItem::Kind::REMAINDER;
case ArithmeticOrLogicalOperator::BITWISE_AND:
- return RustLangItem::ItemType::BITAND;
+ return LangItem::Kind::BITAND;
case ArithmeticOrLogicalOperator::BITWISE_OR:
- return RustLangItem::ItemType::BITOR;
+ return LangItem::Kind::BITOR;
case ArithmeticOrLogicalOperator::BITWISE_XOR:
- return RustLangItem::ItemType::BITXOR;
+ return LangItem::Kind::BITXOR;
case ArithmeticOrLogicalOperator::LEFT_SHIFT:
- return RustLangItem::ItemType::SHL;
+ return LangItem::Kind::SHL;
case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
- return RustLangItem::ItemType::SHR;
+ return LangItem::Kind::SHR;
}
rust_unreachable ();
}
-RustLangItem::ItemType
-RustLangItem::CompoundAssignmentOperatorToLangItem (
- ArithmeticOrLogicalOperator op)
+LangItem::Kind
+LangItem::CompoundAssignmentOperatorToLangItem (ArithmeticOrLogicalOperator op)
{
switch (op)
{
case ArithmeticOrLogicalOperator::ADD:
- return RustLangItem::ItemType::ADD_ASSIGN;
+ return LangItem::Kind::ADD_ASSIGN;
case ArithmeticOrLogicalOperator::SUBTRACT:
- return RustLangItem::ItemType::SUB_ASSIGN;
+ return LangItem::Kind::SUB_ASSIGN;
case ArithmeticOrLogicalOperator::MULTIPLY:
- return RustLangItem::ItemType::MUL_ASSIGN;
+ return LangItem::Kind::MUL_ASSIGN;
case ArithmeticOrLogicalOperator::DIVIDE:
- return RustLangItem::ItemType::DIV_ASSIGN;
+ return LangItem::Kind::DIV_ASSIGN;
case ArithmeticOrLogicalOperator::MODULUS:
- return RustLangItem::ItemType::REM_ASSIGN;
+ return LangItem::Kind::REM_ASSIGN;
case ArithmeticOrLogicalOperator::BITWISE_AND:
- return RustLangItem::ItemType::BITAND_ASSIGN;
+ return LangItem::Kind::BITAND_ASSIGN;
case ArithmeticOrLogicalOperator::BITWISE_OR:
- return RustLangItem::ItemType::BITOR_ASSIGN;
+ return LangItem::Kind::BITOR_ASSIGN;
case ArithmeticOrLogicalOperator::BITWISE_XOR:
- return RustLangItem::ItemType::BITXOR_ASSIGN;
+ return LangItem::Kind::BITXOR_ASSIGN;
case ArithmeticOrLogicalOperator::LEFT_SHIFT:
- return RustLangItem::ItemType::SHL_ASSIGN;
+ return LangItem::Kind::SHL_ASSIGN;
case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
- return RustLangItem::ItemType::SHR_ASSIGN;
+ return LangItem::Kind::SHR_ASSIGN;
}
rust_unreachable ();
}
-RustLangItem::ItemType
-RustLangItem::NegationOperatorToLangItem (NegationOperator op)
+LangItem::Kind
+LangItem::NegationOperatorToLangItem (NegationOperator op)
{
switch (op)
{
case NegationOperator::NEGATE:
- return RustLangItem::ItemType::NEGATION;
+ return LangItem::Kind::NEGATION;
case NegationOperator::NOT:
- return RustLangItem::ItemType::NOT;
+ return LangItem::Kind::NOT;
}
rust_unreachable ();
}
-} // namespace Analysis
} // namespace Rust
diff --git a/gcc/rust/util/rust-lang-item.h b/gcc/rust/util/rust-lang-item.h
index 3447e3680c8..414436f0c96 100644
--- a/gcc/rust/util/rust-lang-item.h
+++ b/gcc/rust/util/rust-lang-item.h
@@ -22,13 +22,12 @@
#include "bi-map.h"
namespace Rust {
-namespace Analysis {
// https://github.com/rust-lang/rust/blob/master/library/core/src/ops/arith.rs
-class RustLangItem
+class LangItem
{
public:
- enum ItemType
+ enum class Kind
{
ADD,
SUBTRACT,
@@ -119,15 +118,27 @@ public:
F64_RUNTIME,
};
- static const BiMap<std::string, ItemType> lang_items;
+ static const BiMap<std::string, Kind> lang_items;
- static tl::optional<ItemType> Parse (const std::string &item);
- static std::string ToString (ItemType type);
- static ItemType OperatorToLangItem (ArithmeticOrLogicalOperator op);
- static ItemType
+ static tl::optional<Kind> Parse (const std::string &item);
+ static std::string ToString (Kind type);
+ static Kind OperatorToLangItem (ArithmeticOrLogicalOperator op);
+ static Kind
CompoundAssignmentOperatorToLangItem (ArithmeticOrLogicalOperator op);
- static ItemType NegationOperatorToLangItem (NegationOperator op);
+ static Kind NegationOperatorToLangItem (NegationOperator op);
};
-} // namespace Analysis
} // namespace Rust
+
+// GCC 4.8 needs us to manually implement hashing for enum classes
+namespace std {
+template <> struct hash<Rust::LangItem::Kind>
+{
+ size_t operator() (const Rust::LangItem::Kind &lang_item) const noexcept
+ {
+ return hash<std::underlying_type<Rust::LangItem::Kind>::type> () (
+ static_cast<std::underlying_type<Rust::LangItem::Kind>::type> (
+ lang_item));
+ }
+};
+} // namespace std
--
2.45.2
next prev parent reply other threads:[~2024-08-01 14:58 UTC|newest]
Thread overview: 130+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 14:55 [PATCH 001/125] Rust: Make 'tree'-level 'MAIN_NAME_P' work Arthur Cohen
2024-08-01 14:55 ` [PATCH 002/125] gccrs: Fix false positive for top-level AltPattern Arthur Cohen
2024-08-01 14:55 ` [PATCH 003/125] gccrs: minor cleanup in langhook.type_for_mode Arthur Cohen
2024-08-01 14:56 ` [PATCH 004/125] gccrs: fmt: Start working on format_args!() parser Arthur Cohen
2024-08-01 14:56 ` [PATCH 005/125] gccrs: libgrust: Add format_parser library Arthur Cohen
2024-08-05 8:18 ` Don't override 'LIBS' if '--enable-languages=rust'; use 'CRAB1_LIBS' (was: [PATCH 005/125] gccrs: libgrust: Add format_parser library) Thomas Schwinge
2024-11-23 20:09 ` Rust: Work around 'error[E0658]: `let...else` statements are unstable' " Thomas Schwinge
2024-11-25 10:24 ` Rust: Work around 'error[E0658]: `let...else` statements are unstable' Arthur Cohen
2024-08-01 14:56 ` [PATCH 006/125] gccrs: Add 'gcc/rust/Make-lang.in:LIBFORMAT_PARSER' Arthur Cohen
2024-08-05 8:45 ` Inline 'gcc/rust/Make-lang.in:RUST_LIBDEPS' (was: [PATCH 006/125] gccrs: Add 'gcc/rust/Make-lang.in:LIBFORMAT_PARSER') Thomas Schwinge
2024-08-01 14:56 ` [PATCH 007/125] gccrs: libgrust: Vendor Rust dependencies Arthur Cohen
2024-08-01 14:56 ` [PATCH 008/125] Rust: Don't cache 'libformat_parser.a' Arthur Cohen
2024-08-01 14:56 ` [PATCH 009/125] Rust: Move 'libformat_parser' build into the GCC build directory Arthur Cohen
2024-08-01 14:56 ` [PATCH 010/125] Rust: Move 'libformat_parser' build into libgrust Arthur Cohen
2024-08-01 14:56 ` [PATCH 011/125] gccrs: libformat_parser: Add FFI safe interface Arthur Cohen
2024-08-01 14:56 ` [PATCH 012/125] gccrs: libformat_parser: Start experimenting with cbindgen Arthur Cohen
2024-08-01 14:56 ` [PATCH 013/125] gccrs: libformat_parser: Update header and remove old interface Arthur Cohen
2024-08-01 14:56 ` [PATCH 014/125] gccrs: libformat_parser: Send boxed values across FFI properly Arthur Cohen
2024-08-01 14:56 ` [PATCH 015/125] gccrs: format_args: Parse format string properly Arthur Cohen
2024-08-01 14:56 ` [PATCH 016/125] gccrs: format_args: Parse entire token invocation Arthur Cohen
2024-08-01 14:56 ` [PATCH 017/125] gccrs: rust-fmt: Store parsed string in Pieces struct Arthur Cohen
2024-08-01 14:56 ` [PATCH 018/125] gccrs: libformat_parser: Fix Rust warnings Arthur Cohen
2024-08-01 14:56 ` [PATCH 019/125] gccrs: format-parser: Add `is_some_and` method for Option<T> Arthur Cohen
2024-08-01 14:56 ` [PATCH 020/125] gccrs: Adjust error checks to match name resolution 2.0 Arthur Cohen
2024-08-01 14:56 ` [PATCH 021/125] gccrs: Fix small FixMe task in rust macro builtins Arthur Cohen
2024-08-01 14:56 ` [PATCH 022/125] gccrs: lang-items: Cleanup parsing and lookups of lang items Arthur Cohen
2024-08-01 14:56 ` Arthur Cohen [this message]
2024-08-01 14:56 ` [PATCH 024/125] gccrs: extern-types: Declare external types in name resolver Arthur Cohen
2024-08-01 14:56 ` [PATCH 025/125] gccrs: hir: Add ExternalTypeItem node Arthur Cohen
2024-08-01 14:56 ` [PATCH 026/125] gccrs: extern-types: Lower to HIR::ExternalTypeItem properly Arthur Cohen
2024-08-01 14:56 ` [PATCH 027/125] gccrs: Make DefaultResolver visit more of the AST Arthur Cohen
2024-08-01 14:56 ` [PATCH 028/125] gccrs: ast: Add base nodes for FormatArgs Arthur Cohen
2024-08-01 14:56 ` [PATCH 029/125] gccrs: macro-builtins: Add newline generic format_args!() handler Arthur Cohen
2024-08-01 14:56 ` [PATCH 030/125] gccrs: parser: Add peek(n) method to parser Arthur Cohen
2024-08-01 14:56 ` [PATCH 031/125] gccrs: format-args: Fix Rust interface and add input parsing Arthur Cohen
2024-08-01 14:56 ` [PATCH 032/125] gccrs: lower: Add base for lowering FormatArgs nodes Arthur Cohen
2024-08-01 14:56 ` [PATCH 033/125] gccrs: format-args: Add documentation for future expansion of function Arthur Cohen
2024-08-01 14:56 ` [PATCH 034/125] gccrs: Add error emitting when we can't resolve id expr Arthur Cohen
2024-08-01 14:56 ` [PATCH 035/125] gccrs: Add curly brackets, formatted clang Arthur Cohen
2024-08-01 14:56 ` [PATCH 036/125] gccrs: Ensure TupleStructPattern and TuplePattern have items Arthur Cohen
2024-08-01 14:56 ` [PATCH 037/125] gccrs: Clean BiMap to use tl::optional for lookups Arthur Cohen
2024-08-01 14:56 ` [PATCH 038/125] gccrs: Add support for external functions Arthur Cohen
2024-08-01 14:56 ` [PATCH 039/125] gccrs: Add get_pattern_kind to Pattern Arthur Cohen
2024-08-01 14:56 ` [PATCH 040/125] gccrs: Unify ASTValidation::visit for ExternalFunctionItem and Function Arthur Cohen
2024-08-01 14:56 ` [PATCH 041/125] gccrs: Update resolver to use `AST::Function` instead of `AST::ExternalFunctionItem` Arthur Cohen
2024-08-01 14:56 ` [PATCH 042/125] gccrs: Remove dead code associated with `AST::ExternalFunctionItem` Arthur Cohen
2024-08-01 14:56 ` [PATCH 043/125] gccrs: Placate clang-format re 'gcc/rust/backend/rust-tree.cc' Arthur Cohen
2024-08-01 14:56 ` [PATCH 044/125] gccrs: Replace reference to unique pointer with reference Arthur Cohen
2024-08-01 14:56 ` [PATCH 045/125] gccrs: Replace unique_ptr references with references Arthur Cohen
2024-08-01 14:56 ` [PATCH 046/125] gccrs: macro: Use MacroInvocation's node_id in ExternalItem constructor Arthur Cohen
2024-08-01 14:56 ` [PATCH 047/125] gccrs: format-args: Add base for expanding FormatArgs nodes Arthur Cohen
2024-08-01 14:56 ` [PATCH 048/125] gccrs: format-args: Start storing string in Rust memory Arthur Cohen
2024-11-23 20:17 ` Rust: Work around 'error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope' (was: [PATCH 048/125] gccrs: format-args: Start storing string in Rust memory) Thomas Schwinge
2024-08-01 14:56 ` [PATCH 049/125] gccrs: format-args: Add basic expansion of unnamed Display::fmt arguments Arthur Cohen
2024-08-01 14:56 ` [PATCH 050/125] gccrs: format-args: Add basic test case Arthur Cohen
2024-08-01 14:56 ` [PATCH 051/125] gccrs: format-args: Only pass the format string to the parser Arthur Cohen
2024-08-01 14:56 ` [PATCH 052/125] gccrs: TyTy: add common SubstitutionRef API Arthur Cohen
2024-08-01 14:56 ` [PATCH 053/125] gccrs: TyTy: Variance analysis module Arthur Cohen
2024-08-01 14:56 ` [PATCH 054/125] gccrs: TyTy: Collect variance info from types Arthur Cohen
2024-08-01 14:56 ` [PATCH 055/125] gccrs: Store visibility properly in ExternalTypeItem Arthur Cohen
2024-08-01 14:56 ` [PATCH 056/125] gccrs: Fix typo Arthur Cohen
2024-08-01 14:56 ` [PATCH 057/125] gccrs: Split up rust-macro-builtins.cc Arthur Cohen
2024-08-01 14:56 ` [PATCH 058/125] gccrs: Placate clang-format re 'gcc/rust/lex/rust-lex.cc' Arthur Cohen
2024-08-01 14:56 ` [PATCH 059/125] gccrs: nr2.0: Add new ImmutableNameResolutionCtx class Arthur Cohen
2024-08-01 14:56 ` [PATCH 060/125] gccrs: sesh: Add late name resolution 2.0 Arthur Cohen
2024-08-01 14:56 ` [PATCH 061/125] gccrs: session-manager: Dump name resolution pass Arthur Cohen
2024-08-01 14:56 ` [PATCH 062/125] gccrs: session manager: Init Immutable name resolver Arthur Cohen
2024-08-01 14:56 ` [PATCH 063/125] gccrs: nr2.0: Add lookup of resolved nodes Arthur Cohen
2024-08-01 14:57 ` [PATCH 064/125] gccrs: typecheck: Start using nr2.0 properly Arthur Cohen
2024-08-01 14:57 ` [PATCH 065/125] gccrs: backend: Use new name resolver where necessary Arthur Cohen
2024-08-01 14:57 ` [PATCH 066/125] gccrs: nr2.0: Start using newtype pattern for Usage and Declaration Arthur Cohen
2024-08-01 14:57 ` [PATCH 067/125] gccrs: late: Setup builtin types properly, change Rib API Arthur Cohen
2024-08-01 14:57 ` [PATCH 068/125] gccrs: Fix duplicate detection Arthur Cohen
2024-08-01 14:57 ` [PATCH 069/125] gccrs: Emit error on identical use declarations Arthur Cohen
2024-08-01 14:57 ` [PATCH 070/125] gccrs: Change error message on unresolved import Arthur Cohen
2024-08-01 14:57 ` [PATCH 071/125] gccrs: Prevent error emission on resolver reentry Arthur Cohen
2024-08-01 14:57 ` [PATCH 072/125] gccrs: late: Add bool builtin type Arthur Cohen
2024-08-01 14:57 ` [PATCH 073/125] gccrs: Add modules to type namespace Arthur Cohen
2024-08-01 14:57 ` [PATCH 074/125] gccrs: Add name resolution for on globbing use decl Arthur Cohen
2024-08-01 14:57 ` [PATCH 075/125] gccrs: Shape up name resolver for normal direct calls Arthur Cohen
2024-08-01 14:57 ` [PATCH 076/125] gccrs: Add call to globbing visitor Arthur Cohen
2024-08-01 14:57 ` [PATCH 077/125] gccrs: Make globbing definition shadowable by default Arthur Cohen
2024-08-01 14:57 ` [PATCH 078/125] gccrs: Add support for ambiguous use declarations Arthur Cohen
2024-08-01 14:57 ` [PATCH 079/125] gccrs: Add tuple struct constructor to value namespace Arthur Cohen
2024-08-01 14:57 ` [PATCH 080/125] gccrs: Change error message to match test Arthur Cohen
2024-08-01 14:57 ` [PATCH 081/125] gccrs: Visit function return type in default resolver Arthur Cohen
2024-08-01 14:57 ` [PATCH 082/125] gccrs: Visit constant item " Arthur Cohen
2024-08-01 14:57 ` [PATCH 083/125] gccrs: Raw pointer type visitor didn't require overload Arthur Cohen
2024-08-01 14:57 ` [PATCH 084/125] gccrs: Values shall be inserted in the value namespace Arthur Cohen
2024-08-01 14:57 ` [PATCH 085/125] gccrs: Unit struct constructor shall be resolved Arthur Cohen
2024-08-01 14:57 ` [PATCH 086/125] gccrs: Add tuple struct to the type namespace Arthur Cohen
2024-08-01 14:57 ` [PATCH 087/125] gccrs: Change enum namespace from value to type Arthur Cohen
2024-08-01 14:57 ` [PATCH 088/125] gccrs: Struct are types, not values Arthur Cohen
2024-08-01 14:57 ` [PATCH 089/125] gccrs: Add constant identifiers to the value namespace Arthur Cohen
2024-08-01 14:57 ` [PATCH 090/125] gccrs: Remove extern block scoping Arthur Cohen
2024-08-01 14:57 ` [PATCH 091/125] gccrs: Remove unsafe block empty visit function Arthur Cohen
2024-08-01 14:57 ` [PATCH 092/125] gccrs: Use new name resolver to compile constant items Arthur Cohen
2024-08-01 14:57 ` [PATCH 093/125] gccrs: Reinject Self parameter in new resolver Arthur Cohen
2024-08-01 14:57 ` [PATCH 094/125] gccrs: Update assignment operator with cratenum Arthur Cohen
2024-08-01 14:57 ` [PATCH 095/125] gccrs: Prevent getting immutable context with classic nr Arthur Cohen
2024-08-01 14:57 ` [PATCH 096/125] gccrs: Fix quoted string format Arthur Cohen
2024-08-01 14:57 ` [PATCH 097/125] gccrs: Add mappings for struct base and struct fields Arthur Cohen
2024-08-01 14:57 ` [PATCH 098/125] gccrs: Fix use rebind name resolution Arthur Cohen
2024-08-01 14:57 ` [PATCH 099/125] gccrs: compile: resolve-path-ref: properly resolve nodeId with nr2.0 Arthur Cohen
2024-08-01 14:57 ` [PATCH 100/125] gccrs: nr2.0: Add new test cases Arthur Cohen
2024-08-01 14:57 ` [PATCH 101/125] gccrs: Add globbing name resolution 2.0 test Arthur Cohen
2024-08-01 14:57 ` [PATCH 102/125] gccrs: Change dfs function return type to support gcc 4.8 Arthur Cohen
2024-08-01 14:57 ` [PATCH 103/125] gccrs: Improve parsing of raw byte string literals Arthur Cohen
2024-08-01 14:57 ` [PATCH 104/125] gccrs: Recognize rustc_deprecated as a builtin attribute Arthur Cohen
2024-08-01 14:57 ` [PATCH 105/125] gccrs: Recognize unstable " Arthur Cohen
2024-08-01 14:57 ` [PATCH 106/125] gccrs: Avoid parsing const unsafe/extern functions as async Arthur Cohen
2024-08-01 14:57 ` [PATCH 107/125] gccrs: Improve parsing of raw string literals Arthur Cohen
2024-08-01 14:57 ` [PATCH 108/125] gccrs: raw-strings: Remove dg-excess-error directive Arthur Cohen
2024-08-01 14:57 ` [PATCH 109/125] gccrs: unify: Always coerce `!` to the target type Arthur Cohen
2024-08-01 14:57 ` [PATCH 110/125] gccrs: borrowck: Use rust-system.h Arthur Cohen
2024-08-01 14:57 ` [PATCH 111/125] gccrs: borrowck: Unify BIR terminilogy (node->statement) Arthur Cohen
2024-08-01 14:57 ` [PATCH 112/125] gccrs: borrowck: BIR: use callable API Arthur Cohen
2024-08-01 14:57 ` [PATCH 113/125] gccrs: borrowck: BIR: Place tree traverse API Arthur Cohen
2024-08-01 14:57 ` [PATCH 114/125] gccrs: borrowck: BIR: scope handling Arthur Cohen
2024-08-01 14:57 ` [PATCH 115/125] gccrs: borrowck: BIR: emit moves Arthur Cohen
2024-08-01 14:57 ` [PATCH 116/125] gccrs: borrowck: BIR: make BIR visitor const Arthur Cohen
2024-08-01 14:57 ` [PATCH 117/125] gccrs: borrowck: Polonius FFI Arthur Cohen
2024-08-01 14:57 ` [PATCH 118/125] gccrs: borrowck: Free region representation Arthur Cohen
2024-08-01 14:57 ` [PATCH 119/125] gccrs: borrowck: extract regions from types using VA Arthur Cohen
2024-08-01 14:57 ` [PATCH 120/125] gccrs: borrowck: Regions in BIR Arthur Cohen
2024-08-01 14:57 ` [PATCH 121/125] gccrs: borrowck: Fact collector Arthur Cohen
2024-08-01 14:57 ` [PATCH 122/125] gccrs: borrowck: Remove block braces to satisfy GNU style Arthur Cohen
2024-08-01 14:57 ` [PATCH 123/125] gccrs: borrowck: Bump copyright notice Arthur Cohen
2024-08-01 14:58 ` [PATCH 124/125] gccrs: Visit type during resolution of inherent impl Arthur Cohen
2024-08-01 14:58 ` [PATCH 125/125] gccrs: Add a test for inherent impl type name resolve Arthur Cohen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240801145809.366388-25-arthur.cohen@embecosm.com \
--to=arthur.cohen@embecosm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc-rust@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).