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 049/125] gccrs: format-args: Add basic expansion of unnamed Display::fmt arguments.
Date: Thu, 1 Aug 2024 16:56:45 +0200 [thread overview]
Message-ID: <20240801145809.366388-51-arthur.cohen@embecosm.com> (raw)
In-Reply-To: <20240801145809.366388-2-arthur.cohen@embecosm.com>
gcc/rust/ChangeLog:
* ast/rust-ast-builder.h: Rename AST::AstBuilder -> AST::Builder
* ast/rust-ast-builder.cc: Likewise.
* expand/rust-derive.cc: Use new AST::Builder name.
* expand/rust-derive.h: Likewise.
* ast/rust-builtin-ast-nodes.h: Add required getters.
* expand/rust-expand-format-args.cc (format_arg): New.
(get_trait_name): New.
(expand_format_args): Properly expand basic format_args!() invocations.
* expand/rust-expand-format-args.h (expand_format_args): Fix signature.
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler):
Call into expand_format_args().
---
gcc/rust/ast/rust-ast-builder.cc | 66 ++++++++-----
gcc/rust/ast/rust-ast-builder.h | 51 ++++++----
gcc/rust/ast/rust-builtin-ast-nodes.h | 5 +
gcc/rust/expand/rust-derive.cc | 2 +-
gcc/rust/expand/rust-derive.h | 2 +-
gcc/rust/expand/rust-expand-format-args.cc | 107 +++++++++++++++++++--
gcc/rust/expand/rust-expand-format-args.h | 5 +-
gcc/rust/expand/rust-macro-builtins.cc | 23 +++--
8 files changed, 205 insertions(+), 56 deletions(-)
diff --git a/gcc/rust/ast/rust-ast-builder.cc b/gcc/rust/ast/rust-ast-builder.cc
index 0d5218c6381..1138d3dc2b2 100644
--- a/gcc/rust/ast/rust-ast-builder.cc
+++ b/gcc/rust/ast/rust-ast-builder.cc
@@ -17,53 +17,73 @@
// <http://www.gnu.org/licenses/>.
#include "rust-ast-builder.h"
+#include "rust-ast-full-decls.h"
#include "rust-ast-full.h"
+#include "rust-expr.h"
+#include "rust-token.h"
+#include "rust-make-unique.h"
namespace Rust {
namespace AST {
std::unique_ptr<Expr>
-AstBuilder::call (std::unique_ptr<Expr> &&path,
- std::vector<std::unique_ptr<Expr>> &&args)
+Builder::literal_string (std::string &&content) const
+{
+ return std::unique_ptr<Expr> (
+ new AST::LiteralExpr (std::move (content), Literal::LitType::STRING,
+ PrimitiveCoreType::CORETYPE_STR, {}, loc));
+}
+
+std::unique_ptr<Expr>
+Builder::call (std::unique_ptr<Expr> &&path,
+ std::vector<std::unique_ptr<Expr>> &&args) const
{
return std::unique_ptr<Expr> (
new CallExpr (std::move (path), std::move (args), {}, loc));
}
std::unique_ptr<Expr>
-AstBuilder::identifier (std::string name)
+Builder::array (std::vector<std::unique_ptr<Expr>> &&members) const
+{
+ auto elts = Rust::make_unique<ArrayElemsValues> (std::move (members), loc);
+
+ return std::unique_ptr<Expr> (new ArrayExpr (std::move (elts), {}, {}, loc));
+}
+
+std::unique_ptr<Expr>
+Builder::identifier (std::string name) const
{
return std::unique_ptr<Expr> (new IdentifierExpr (name, {}, loc));
}
std::unique_ptr<Expr>
-AstBuilder::tuple_idx (std::string receiver, int idx)
+Builder::tuple_idx (std::string receiver, int idx) const
{
return std::unique_ptr<Expr> (
new TupleIndexExpr (identifier (receiver), idx, {}, loc));
}
FunctionQualifiers
-AstBuilder::fn_qualifiers ()
+Builder::fn_qualifiers () const
{
return FunctionQualifiers (loc, Async::No, Const::No, Unsafety::Normal);
}
PathExprSegment
-AstBuilder::path_segment (std::string seg)
+Builder::path_segment (std::string seg) const
{
return PathExprSegment (PathIdentSegment (seg, loc), loc);
}
std::unique_ptr<TypePathSegment>
-AstBuilder::type_path_segment (std::string seg)
+Builder::type_path_segment (std::string seg) const
{
return std::unique_ptr<TypePathSegment> (
new TypePathSegment (seg, false, loc));
}
std::unique_ptr<Type>
-AstBuilder::single_type_path (std::string type)
+Builder::single_type_path (std::string type) const
{
auto segments = std::vector<std::unique_ptr<TypePathSegment>> ();
segments.emplace_back (type_path_segment (type));
@@ -72,7 +92,7 @@ AstBuilder::single_type_path (std::string type)
}
PathInExpression
-AstBuilder::path_in_expression (std::vector<std::string> &&segments)
+Builder::path_in_expression (std::vector<std::string> &&segments) const
{
auto path_segments = std::vector<PathExprSegment> ();
for (auto &seg : segments)
@@ -82,8 +102,8 @@ AstBuilder::path_in_expression (std::vector<std::string> &&segments)
}
std::unique_ptr<Expr>
-AstBuilder::block (std::vector<std::unique_ptr<Stmt>> &&stmts,
- std::unique_ptr<Expr> &&tail_expr)
+Builder::block (std::vector<std::unique_ptr<Stmt>> &&stmts,
+ std::unique_ptr<Expr> &&tail_expr) const
{
return std::unique_ptr<Expr> (new BlockExpr (std::move (stmts),
std::move (tail_expr), {}, {},
@@ -91,8 +111,8 @@ AstBuilder::block (std::vector<std::unique_ptr<Stmt>> &&stmts,
}
std::unique_ptr<Stmt>
-AstBuilder::let (std::unique_ptr<Pattern> pattern, std::unique_ptr<Type> type,
- std::unique_ptr<Expr> init)
+Builder::let (std::unique_ptr<Pattern> pattern, std::unique_ptr<Type> type,
+ std::unique_ptr<Expr> init) const
{
return std::unique_ptr<Stmt> (new LetStmt (std::move (pattern),
std::move (init), std::move (type),
@@ -100,28 +120,29 @@ AstBuilder::let (std::unique_ptr<Pattern> pattern, std::unique_ptr<Type> type,
}
std::unique_ptr<Expr>
-AstBuilder::ref (std::unique_ptr<Expr> &&of, bool mut)
+Builder::ref (std::unique_ptr<Expr> &&of, bool mut) const
{
return std::unique_ptr<Expr> (
new BorrowExpr (std::move (of), mut, /* is double */ false, {}, loc));
}
std::unique_ptr<Expr>
-AstBuilder::deref (std::unique_ptr<Expr> &&of)
+Builder::deref (std::unique_ptr<Expr> &&of) const
{
return std::unique_ptr<Expr> (new DereferenceExpr (std::move (of), {}, loc));
}
std::unique_ptr<Expr>
-AstBuilder::struct_expr_struct (std::string struct_name)
+Builder::struct_expr_struct (std::string struct_name) const
{
return std::unique_ptr<Expr> (
new StructExprStruct (path_in_expression ({struct_name}), {}, {}, loc));
}
std::unique_ptr<Expr>
-AstBuilder::struct_expr (std::string struct_name,
- std::vector<std::unique_ptr<StructExprField>> &&fields)
+Builder::struct_expr (
+ std::string struct_name,
+ std::vector<std::unique_ptr<StructExprField>> &&fields) const
{
return std::unique_ptr<Expr> (
new StructExprStructFields (path_in_expression ({struct_name}),
@@ -129,22 +150,23 @@ AstBuilder::struct_expr (std::string struct_name,
}
std::unique_ptr<StructExprField>
-AstBuilder::struct_expr_field (std::string field_name,
- std::unique_ptr<Expr> &&value)
+Builder::struct_expr_field (std::string field_name,
+ std::unique_ptr<Expr> &&value) const
{
return std::unique_ptr<StructExprField> (
new StructExprFieldIdentifierValue (field_name, std::move (value), loc));
}
std::unique_ptr<Expr>
-AstBuilder::field_access (std::unique_ptr<Expr> &&instance, std::string field)
+Builder::field_access (std::unique_ptr<Expr> &&instance,
+ std::string field) const
{
return std::unique_ptr<Expr> (
new FieldAccessExpr (std::move (instance), field, {}, loc));
}
std::unique_ptr<Pattern>
-AstBuilder::wildcard ()
+Builder::wildcard () const
{
return std::unique_ptr<Pattern> (new WildcardPattern (loc));
}
diff --git a/gcc/rust/ast/rust-ast-builder.h b/gcc/rust/ast/rust-ast-builder.h
index c0b4fa7b2cb..5c33954131f 100644
--- a/gcc/rust/ast/rust-ast-builder.h
+++ b/gcc/rust/ast/rust-ast-builder.h
@@ -28,80 +28,93 @@ namespace AST {
/* Builder class with helper methods to create AST nodes. This builder is
* tailored towards generating multiple AST nodes from a single location, and
* may not be suitable to other purposes */
-class AstBuilder
+class Builder
{
public:
- AstBuilder (location_t loc) : loc (loc) {}
+ Builder (location_t loc) : loc (loc) {}
+
+ /* Create a string literal expression ("content") */
+ std::unique_ptr<Expr> literal_string (std::string &&content) const;
/* Create an identifier expression (`variable`) */
- std::unique_ptr<Expr> identifier (std::string name);
+ std::unique_ptr<Expr> identifier (std::string name) const;
/* Create a tuple index expression (`receiver.0`) */
- std::unique_ptr<Expr> tuple_idx (std::string receiver, int idx);
+ std::unique_ptr<Expr> tuple_idx (std::string receiver, int idx) const;
/* Create a reference to an expression (`&of`) */
- std::unique_ptr<Expr> ref (std::unique_ptr<Expr> &&of, bool mut = false);
+ std::unique_ptr<Expr> ref (std::unique_ptr<Expr> &&of,
+ bool mut = false) const;
/* Create a dereference of an expression (`*of`) */
- std::unique_ptr<Expr> deref (std::unique_ptr<Expr> &&of);
+ std::unique_ptr<Expr> deref (std::unique_ptr<Expr> &&of) const;
/* Create a block with an optional tail expression */
std::unique_ptr<Expr> block (std::vector<std::unique_ptr<Stmt>> &&stmts,
- std::unique_ptr<Expr> &&tail_expr = nullptr);
+ std::unique_ptr<Expr> &&tail_expr
+ = nullptr) const;
/* Create a let binding with an optional type and initializer (`let <name> :
* <type> = <init>`) */
std::unique_ptr<Stmt> let (std::unique_ptr<Pattern> pattern,
std::unique_ptr<Type> type = nullptr,
- std::unique_ptr<Expr> init = nullptr);
+ std::unique_ptr<Expr> init = nullptr) const;
/**
* Create a call expression to a function, struct or enum variant, given its
* arguments (`path(arg0, arg1, arg2)`)
*/
std::unique_ptr<Expr> call (std::unique_ptr<Expr> &&path,
- std::vector<std::unique_ptr<Expr>> &&args);
+ std::vector<std::unique_ptr<Expr>> &&args) const;
+
+ /**
+ * Create an array expression (`[member0, member1, member2]`)
+ */
+ std::unique_ptr<Expr>
+ array (std::vector<std::unique_ptr<Expr>> &&members) const;
/* Empty function qualifiers, with no specific qualifiers */
- FunctionQualifiers fn_qualifiers ();
+ FunctionQualifiers fn_qualifiers () const;
/* Create a single path segment from one string */
- PathExprSegment path_segment (std::string seg);
+ PathExprSegment path_segment (std::string seg) const;
/* And similarly for type path segments */
- std::unique_ptr<TypePathSegment> type_path_segment (std::string seg);
+ std::unique_ptr<TypePathSegment> type_path_segment (std::string seg) const;
/* Create a Type from a single string - the most basic kind of type in our AST
*/
- std::unique_ptr<Type> single_type_path (std::string type);
+ std::unique_ptr<Type> single_type_path (std::string type) const;
/**
* Create a path in expression from multiple segments (`Clone::clone`). You
* do not need to separate the segments using `::`, you can simply provide a
* vector of strings to the functions which will get turned into path segments
*/
- PathInExpression path_in_expression (std::vector<std::string> &&segments);
+ PathInExpression
+ path_in_expression (std::vector<std::string> &&segments) const;
/* Create a struct expression for unit structs (`S`) */
- std::unique_ptr<Expr> struct_expr_struct (std::string struct_name);
+ std::unique_ptr<Expr> struct_expr_struct (std::string struct_name) const;
/**
* Create an expression for struct instantiation with fields (`S { a, b: c }`)
*/
std::unique_ptr<Expr>
struct_expr (std::string struct_name,
- std::vector<std::unique_ptr<StructExprField>> &&fields);
+ std::vector<std::unique_ptr<StructExprField>> &&fields) const;
/* Create a field expression for struct instantiation (`field_name: value`) */
std::unique_ptr<StructExprField>
- struct_expr_field (std::string field_name, std::unique_ptr<Expr> &&value);
+ struct_expr_field (std::string field_name,
+ std::unique_ptr<Expr> &&value) const;
/* Create a field access expression (`instance.field`) */
std::unique_ptr<Expr> field_access (std::unique_ptr<Expr> &&instance,
- std::string field);
+ std::string field) const;
/* Create a wildcard pattern (`_`) */
- std::unique_ptr<Pattern> wildcard ();
+ std::unique_ptr<Pattern> wildcard () const;
private:
/**
diff --git a/gcc/rust/ast/rust-builtin-ast-nodes.h b/gcc/rust/ast/rust-builtin-ast-nodes.h
index 780d1a9d4e9..3e21d7e718d 100644
--- a/gcc/rust/ast/rust-builtin-ast-nodes.h
+++ b/gcc/rust/ast/rust-builtin-ast-nodes.h
@@ -132,6 +132,9 @@ public:
return *this;
}
+ FormatArgumentKind get_kind () const { return kind; }
+ const Expr &get_expr () const { return *expr; }
+
private:
FormatArgument (FormatArgumentKind::Kind kind, tl::optional<Identifier> ident,
std::unique_ptr<Expr> expr)
@@ -159,6 +162,7 @@ public:
FormatArguments &operator= (const FormatArguments &other) = default;
void push (FormatArgument &&elt) { args.emplace_back (std::move (elt)); }
+ const FormatArgument at (size_t idx) const { return args.at (idx); }
private:
std::vector<FormatArgument> args;
@@ -195,6 +199,7 @@ public:
void accept_vis (AST::ASTVisitor &vis) override;
const Fmt::Pieces &get_template () const { return template_pieces; }
+ const FormatArguments &get_arguments () const { return arguments; }
virtual location_t get_locus () const override;
private:
diff --git a/gcc/rust/expand/rust-derive.cc b/gcc/rust/expand/rust-derive.cc
index e9927df1559..4177004eccf 100644
--- a/gcc/rust/expand/rust-derive.cc
+++ b/gcc/rust/expand/rust-derive.cc
@@ -24,7 +24,7 @@ namespace Rust {
namespace AST {
DeriveVisitor::DeriveVisitor (location_t loc)
- : loc (loc), builder (AstBuilder (loc))
+ : loc (loc), builder (Builder (loc))
{}
std::unique_ptr<Item>
diff --git a/gcc/rust/expand/rust-derive.h b/gcc/rust/expand/rust-derive.h
index cbe5bbbcbea..48f6594a636 100644
--- a/gcc/rust/expand/rust-derive.h
+++ b/gcc/rust/expand/rust-derive.h
@@ -41,7 +41,7 @@ protected:
DeriveVisitor (location_t loc);
location_t loc;
- AstBuilder builder;
+ Builder builder;
private:
// the 4 "allowed" visitors, which a derive-visitor can specify and override
diff --git a/gcc/rust/expand/rust-expand-format-args.cc b/gcc/rust/expand/rust-expand-format-args.cc
index 276ffd58c50..3f76344ea5b 100644
--- a/gcc/rust/expand/rust-expand-format-args.cc
+++ b/gcc/rust/expand/rust-expand-format-args.cc
@@ -17,27 +17,122 @@
// <http://www.gnu.org/licenses/>.
#include "rust-expand-format-args.h"
+#include "rust-ast-fragment.h"
+#include "rust-ast.h"
#include "rust-builtin-ast-nodes.h"
+#include "rust-ast-builder.h"
+#include "rust-diagnostics.h"
+#include "rust-expr.h"
+#include "rust-fmt.h"
+#include "rust-path.h"
+#include "rust-system.h"
+#include "rust-token.h"
namespace Rust {
+namespace Fmt {
+
+static std::unique_ptr<AST::Expr>
+format_arg (const AST::Builder &builder, std::unique_ptr<AST::Expr> &&to_format,
+ const std::string &trait)
+{
+ auto formatter_fn = std::unique_ptr<AST::Expr> (new AST::PathInExpression (
+ builder.path_in_expression ({"core", "fmt", trait, "fmt"})));
+
+ auto path = std::unique_ptr<AST::Expr> (new AST::PathInExpression (
+ builder.path_in_expression ({"core", "fmt", "ArgumentV1", "new"})));
+
+ auto args = std::vector<std::unique_ptr<AST::Expr>> ();
+ args.emplace_back (std::move (to_format));
+ args.emplace_back (std::move (formatter_fn));
+
+ return builder.call (std::move (path), std::move (args));
+}
+
+const std::string &
+get_trait_name (ffi::FormatSpec format_specifier)
+{
+ static const std::unordered_map<std::string, std::string> spec_map = {
+ {"", "Display"}, {"?", "Debug"}, {"e", "LowerExp"},
+ {"E", "UpperExp"}, {"o", "Octal"}, {"p", "Pointer"},
+ {"b", "Binary"}, {"x", "LowerHex"}, {"X", "UpperHex"},
+ };
+
+ auto it = spec_map.find (format_specifier.ty.to_string ());
+
+ if (it == spec_map.end ())
+ rust_unreachable ();
+
+ return it->second;
+}
tl::optional<AST::Fragment>
-expand_format_args (AST::FormatArgs &fmt)
+expand_format_args (AST::FormatArgs &fmt,
+ std::vector<std::unique_ptr<AST::Token>> &&tokens)
{
+ auto loc = fmt.get_locus ();
+ auto builder = AST::Builder (loc);
+ auto &arguments = fmt.get_arguments ();
+
+ auto static_pieces = std::vector<std::unique_ptr<AST::Expr>> ();
+ auto args
+ = std::vector<std::pair<std::unique_ptr<AST::Expr>, ffi::FormatSpec>> ();
+
for (const auto &node : fmt.get_template ().get_pieces ())
{
switch (node.tag)
{
- case Fmt::ffi::Piece::Tag::String:
- // rust_debug ("[ARTHUR]: %s", node.string._0.c_str ());
+ case ffi::Piece::Tag::String:
+ static_pieces.emplace_back (
+ builder.literal_string (node.string._0.to_string ()));
+ break;
+ case ffi::Piece::Tag::NextArgument: {
+ auto next_argument = node.next_argument._0;
+ switch (node.next_argument._0.position.tag)
+ {
+ case ffi::Position::Tag::ArgumentImplicitlyIs: {
+ auto idx = next_argument.position.argument_implicitly_is._0;
+ auto trait = next_argument.format;
+ auto arg = arguments.at (idx);
+
+ // FIXME(Arthur): This API sucks
+ rust_assert (arg.get_kind ().kind
+ == AST::FormatArgumentKind::Kind::Normal);
- case Fmt::ffi::Piece::Tag::NextArgument:
- rust_debug ("[ARTHUR]: NextArgument");
+ args.push_back ({arg.get_expr ().clone_expr (), trait});
+ }
+ break;
+ case ffi::Position::Tag::ArgumentIs:
+ case ffi::Position::Tag::ArgumentNamed:
+ rust_sorry_at (loc, "unhandled argument position specifier");
+ break;
+ }
+ }
break;
}
}
- return tl::nullopt;
+ auto args_array = std::vector<std::unique_ptr<AST::Expr>> ();
+ for (auto &&arg : args)
+ args_array.emplace_back (format_arg (builder,
+ builder.ref (std::move (arg.first)),
+ get_trait_name (arg.second)));
+
+ auto pieces = builder.ref (builder.array (std::move (static_pieces)));
+ auto args_slice = builder.ref (builder.array (std::move (args_array)));
+
+ auto final_path = make_unique<AST::PathInExpression> (
+ builder.path_in_expression ({"core", "fmt", "Arguments", "new_v1"}));
+ auto final_args = std::vector<std::unique_ptr<AST::Expr>> ();
+ final_args.emplace_back (std::move (pieces));
+ final_args.emplace_back (std::move (args_slice));
+
+ auto final_call
+ = builder.call (std::move (final_path), std::move (final_args));
+
+ auto node = AST::SingleASTNode (std::move (final_call));
+
+ return AST::Fragment ({node}, std::move (tokens));
}
+} // namespace Fmt
} // namespace Rust
diff --git a/gcc/rust/expand/rust-expand-format-args.h b/gcc/rust/expand/rust-expand-format-args.h
index 1481f3605ed..0a17de53597 100644
--- a/gcc/rust/expand/rust-expand-format-args.h
+++ b/gcc/rust/expand/rust-expand-format-args.h
@@ -23,10 +23,13 @@
#include "rust-ast-fragment.h"
namespace Rust {
+namespace Fmt {
tl::optional<AST::Fragment>
-expand_format_args (AST::FormatArgs &fmt);
+expand_format_args (AST::FormatArgs &fmt,
+ std::vector<std::unique_ptr<AST::Token>> &&tokens);
+} // namespace Fmt
} // namespace Rust
#endif //! RUST_EXPAND_FORMAT_ARGS_H
diff --git a/gcc/rust/expand/rust-macro-builtins.cc b/gcc/rust/expand/rust-macro-builtins.cc
index 8cf32051c7a..112713a4f97 100644
--- a/gcc/rust/expand/rust-macro-builtins.cc
+++ b/gcc/rust/expand/rust-macro-builtins.cc
@@ -20,6 +20,7 @@
#include "libproc_macro_internal/tokenstream.h"
#include "rust-ast-full-decls.h"
#include "rust-builtin-ast-nodes.h"
+#include "rust-expand-format-args.h"
#include "rust-token-converter.h"
#include "rust-system.h"
#include "rust-macro-builtins.h"
@@ -1102,13 +1103,23 @@ MacroBuiltin::format_args_handler (location_t invoc_locus,
// TODO: we now need to take care of creating `unfinished_literal`? this is
// for creating the `template`
- auto fmt_args_node = new AST::FormatArgs (invoc_locus, std::move (pieces),
- std::move (input->args));
- auto node = std::unique_ptr<AST::Expr> (fmt_args_node);
- auto single_node = AST::SingleASTNode (std::move (node));
+ auto fmt_args_node = AST::FormatArgs (invoc_locus, std::move (pieces),
+ std::move (input->args));
- return AST::Fragment ({std::move (single_node)},
- invoc.get_delim_tok_tree ().to_token_stream ());
+ auto expanded
+ = Fmt::expand_format_args (fmt_args_node,
+ invoc.get_delim_tok_tree ().to_token_stream ());
+
+ if (!expanded.has_value ())
+ return AST::Fragment::create_error ();
+
+ return *expanded;
+
+ // auto node = std::unique_ptr<AST::Expr> (fmt_args_node);
+ // auto single_node = AST::SingleASTNode (std::move (node));
+
+ // return AST::Fragment ({std::move (single_node)},
+ // invoc.get_delim_tok_tree ().to_token_stream ());
}
tl::optional<AST::Fragment>
--
2.45.2
next prev parent reply other threads:[~2024-08-01 14:59 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 ` [PATCH 023/125] gccrs: lang-items: Make lang items enum stronger, rename class, cleanup ns Arthur Cohen
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 ` Arthur Cohen [this message]
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-51-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).