From: arthur.cohen@embecosm.com
To: gcc-patches@gcc.gnu.org
Cc: gcc-rust@gcc.gnu.org, Arthur Cohen <arthur.cohen@embecosm.com>
Subject: [committed 041/103] gccrs: rust: Replace uses of ASTFragment -> Fragment
Date: Tue, 21 Feb 2023 13:01:31 +0100 [thread overview]
Message-ID: <20230221120230.596966-42-arthur.cohen@embecosm.com> (raw)
In-Reply-To: <20230221120230.596966-1-arthur.cohen@embecosm.com>
From: Arthur Cohen <arthur.cohen@embecosm.com>
gcc/rust/ChangeLog:
* ast/rust-ast.h (class ASTFragment): Remove old ASTFragment class.
* ast/rust-macro.h (class MacroRulesDefinition): Use new Fragment API.
* expand/rust-attribute-visitor.h: Likewise.
* expand/rust-macro-builtins.cc (macro_end_token): Likewise.
(MacroBuiltin::assert): Likewise.
(MacroBuiltin::file): Likewise.
(MacroBuiltin::column): Likewise.
(MacroBuiltin::include_bytes): Likewise.
(MacroBuiltin::include_str): Likewise.
(MacroBuiltin::compile_error): Likewise.
(MacroBuiltin::concat): Likewise.
(MacroBuiltin::env): Likewise.
(MacroBuiltin::cfg): Likewise.
(MacroBuiltin::include): Likewise.
(MacroBuiltin::line): Likewise.
* expand/rust-macro-builtins.h: Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise.
(MacroExpander::expand_invoc): Likewise.
(MacroExpander::match_repetition): Likewise.
(parse_many): Likewise.
(transcribe_many_items): Likewise.
(transcribe_many_ext): Likewise.
(transcribe_many_trait_items): Likewise.
(transcribe_many_impl_items): Likewise.
(transcribe_many_trait_impl_items): Likewise.
(transcribe_expression): Likewise.
(transcribe_type): Likewise.
(transcribe_on_delimiter): Likewise.
(tokens_to_str): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Likewise.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise.
---
gcc/rust/ast/rust-ast.h | 132 -----------------------
gcc/rust/ast/rust-macro.h | 18 ++--
gcc/rust/expand/rust-attribute-visitor.h | 4 +-
gcc/rust/expand/rust-macro-builtins.cc | 72 ++++++-------
gcc/rust/expand/rust-macro-builtins.h | 40 ++++---
gcc/rust/expand/rust-macro-expand.cc | 42 ++++----
gcc/rust/expand/rust-macro-expand.h | 23 ++--
gcc/rust/util/rust-hir-map.cc | 4 +-
8 files changed, 100 insertions(+), 235 deletions(-)
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index ccabccd6aff..3d602b1a379 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -1858,138 +1858,6 @@ public:
}
};
-/* Basically, a "fragment" that can be incorporated into the AST, created as
- * a result of macro expansion. Really annoying to work with due to the fact
- * that macros can really expand to anything. As such, horrible representation
- * at the moment. */
-class ASTFragment
-{
-private:
- /* basic idea: essentially, a vector of tagged unions of different AST node
- * types. Now, this could actually be stored without a tagged union if the
- * different AST node types had a unified parent, but that would create
- * issues with the diamond problem or significant performance penalties. So
- * a tagged union had to be used instead. A vector is used to represent the
- * ability for a macro to expand to two statements, for instance. */
-
- std::vector<SingleASTNode> nodes;
- bool fragment_is_error;
-
- /**
- * We need to make a special case for Expression and Type fragments as only
- * one Node will be extracted from the `nodes` vector
- */
-
- bool is_single_fragment () const { return nodes.size () == 1; }
-
- bool is_single_fragment_of_kind (SingleASTNode::NodeType expected) const
- {
- return is_single_fragment () && nodes[0].get_kind () == expected;
- }
-
- void assert_single_fragment (SingleASTNode::NodeType expected) const
- {
- static const std::map<SingleASTNode::NodeType, const char *> str_map = {
- {SingleASTNode::NodeType::IMPL, "impl"},
- {SingleASTNode::NodeType::ITEM, "item"},
- {SingleASTNode::NodeType::TYPE, "type"},
- {SingleASTNode::NodeType::EXPRESSION, "expr"},
- {SingleASTNode::NodeType::STMT, "stmt"},
- {SingleASTNode::NodeType::EXTERN, "extern"},
- {SingleASTNode::NodeType::TRAIT, "trait"},
- {SingleASTNode::NodeType::TRAIT_IMPL, "trait impl"},
- };
-
- auto actual = nodes[0].get_kind ();
- auto fail = false;
-
- if (!is_single_fragment ())
- {
- rust_error_at (Location (), "fragment is not single");
- fail = true;
- }
-
- if (actual != expected)
- {
- rust_error_at (
- Location (),
- "invalid fragment operation: expected %qs node, got %qs node",
- str_map.find (expected)->second,
- str_map.find (nodes[0].get_kind ())->second);
- fail = true;
- }
-
- rust_assert (!fail);
- }
-
-public:
- ASTFragment (std::vector<SingleASTNode> nodes, bool fragment_is_error = false)
- : nodes (std::move (nodes)), fragment_is_error (fragment_is_error)
- {
- if (fragment_is_error)
- rust_assert (nodes.empty ());
- }
-
- ASTFragment (ASTFragment const &other)
- : fragment_is_error (other.fragment_is_error)
- {
- nodes.clear ();
- nodes.reserve (other.nodes.size ());
- for (auto &n : other.nodes)
- {
- nodes.push_back (n);
- }
- }
-
- ASTFragment &operator= (ASTFragment const &other)
- {
- fragment_is_error = other.fragment_is_error;
- nodes.clear ();
- nodes.reserve (other.nodes.size ());
- for (auto &n : other.nodes)
- {
- nodes.push_back (n);
- }
-
- return *this;
- }
-
- static ASTFragment create_error () { return ASTFragment ({}, true); }
-
- std::vector<SingleASTNode> &get_nodes () { return nodes; }
- bool is_error () const { return fragment_is_error; }
-
- bool should_expand () const { return !is_error (); }
-
- bool is_expression_fragment () const
- {
- return is_single_fragment_of_kind (SingleASTNode::NodeType::EXPRESSION);
- }
-
- bool is_type_fragment () const
- {
- return is_single_fragment_of_kind (SingleASTNode::NodeType::TYPE);
- }
-
- std::unique_ptr<Expr> take_expression_fragment ()
- {
- assert_single_fragment (SingleASTNode::NodeType::EXPRESSION);
- return nodes[0].take_expr ();
- }
-
- std::unique_ptr<Type> take_type_fragment ()
- {
- assert_single_fragment (SingleASTNode::NodeType::TYPE);
- return nodes[0].take_type ();
- }
-
- void accept_vis (ASTVisitor &vis)
- {
- for (auto &node : nodes)
- node.accept_vis (vis);
- }
-};
-
// A crate AST object - holds all the data for a single compilation unit
struct Crate
{
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h
index 798bc974fbb..fc4b5b82fb5 100644
--- a/gcc/rust/ast/rust-macro.h
+++ b/gcc/rust/ast/rust-macro.h
@@ -21,6 +21,7 @@
#include "rust-system.h"
#include "rust-ast.h"
+#include "rust-ast-fragment.h"
#include "rust-location.h"
namespace Rust {
@@ -456,8 +457,7 @@ class MacroRulesDefinition : public MacroItem
std::vector<MacroRule> rules; // inlined form
Location locus;
- std::function<ASTFragment (Location, MacroInvocData &)>
- associated_transcriber;
+ std::function<Fragment (Location, MacroInvocData &)> associated_transcriber;
// Since we can't compare std::functions, we need to use an extra boolean
bool is_builtin_rule;
@@ -468,10 +468,10 @@ class MacroRulesDefinition : public MacroItem
* should make use of the actual rules. If the macro is builtin, then another
* associated transcriber should be used
*/
- static ASTFragment dummy_builtin (Location, MacroInvocData &)
+ static Fragment dummy_builtin (Location, MacroInvocData &)
{
gcc_unreachable ();
- return ASTFragment::create_error ();
+ return Fragment::create_error ();
}
/* NOTE: in rustc, macro definitions are considered (and parsed as) a type
@@ -491,9 +491,9 @@ public:
associated_transcriber (dummy_builtin), is_builtin_rule (false)
{}
- MacroRulesDefinition (Identifier builtin_name, DelimType delim_type,
- std::function<ASTFragment (Location, MacroInvocData &)>
- associated_transcriber)
+ MacroRulesDefinition (
+ Identifier builtin_name, DelimType delim_type,
+ std::function<Fragment (Location, MacroInvocData &)> associated_transcriber)
: outer_attrs (std::vector<Attribute> ()), rule_name (builtin_name),
delim_type (delim_type), rules (std::vector<MacroRule> ()),
locus (Location ()), associated_transcriber (associated_transcriber),
@@ -521,14 +521,14 @@ public:
const std::vector<MacroRule> &get_rules () const { return rules; }
bool is_builtin () const { return is_builtin_rule; }
- const std::function<ASTFragment (Location, MacroInvocData &)> &
+ const std::function<Fragment (Location, MacroInvocData &)> &
get_builtin_transcriber () const
{
rust_assert (is_builtin ());
return associated_transcriber;
}
void set_builtin_transcriber (
- std::function<ASTFragment (Location, MacroInvocData &)> transcriber)
+ std::function<Fragment (Location, MacroInvocData &)> transcriber)
{
associated_transcriber = transcriber;
is_builtin_rule = true;
diff --git a/gcc/rust/expand/rust-attribute-visitor.h b/gcc/rust/expand/rust-attribute-visitor.h
index 80f9d4b4ded..6b562bd49b1 100644
--- a/gcc/rust/expand/rust-attribute-visitor.h
+++ b/gcc/rust/expand/rust-attribute-visitor.h
@@ -56,11 +56,11 @@ public:
* @return Either the expanded fragment or an empty errored-out fragment
* indicating an expansion failure.
*/
- AST::ASTFragment expand_macro_fragment_recursive ()
+ AST::Fragment expand_macro_fragment_recursive ()
{
auto fragment = expander.take_expanded_fragment (*this);
unsigned int original_depth = expander.expansion_depth;
- auto final_fragment = AST::ASTFragment ({}, true);
+ auto final_fragment = AST::Fragment ({}, true);
while (fragment.should_expand ())
{
diff --git a/gcc/rust/expand/rust-macro-builtins.cc b/gcc/rust/expand/rust-macro-builtins.cc
index a230ad9f2d8..2a8a3f752f4 100644
--- a/gcc/rust/expand/rust-macro-builtins.cc
+++ b/gcc/rust/expand/rust-macro-builtins.cc
@@ -66,7 +66,7 @@ macro_end_token (AST::DelimTokenTree &invoc_token_tree,
/* Expand and extract an expression from the macro */
-static inline AST::ASTFragment
+static inline AST::Fragment
try_expand_macro_expression (AST::Expr *expr, MacroExpander *expander)
{
rust_assert (expander);
@@ -264,25 +264,25 @@ load_file_bytes (const char *filename)
}
} // namespace
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::assert (Location invoc_locus, AST::MacroInvocData &invoc)
{
rust_debug ("assert!() called");
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::file (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto current_file
= Session::get_instance ().linemap->location_file (invoc_locus);
auto file_str = AST::SingleASTNode (make_string (invoc_locus, current_file));
- return AST::ASTFragment ({file_str});
+ return AST::Fragment ({file_str});
}
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::column (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto current_column
@@ -292,14 +292,14 @@ MacroBuiltin::column (Location invoc_locus, AST::MacroInvocData &invoc)
new AST::LiteralExpr (std::to_string (current_column), AST::Literal::INT,
PrimitiveCoreType::CORETYPE_U32, {}, invoc_locus)));
- return AST::ASTFragment ({column_no});
+ return AST::Fragment ({column_no});
}
/* Expand builtin macro include_bytes!("filename"), which includes the contents
of the given file as reference to a byte array. Yields an expression of type
&'static [u8; N]. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::include_bytes (Location invoc_locus, AST::MacroInvocData &invoc)
{
/* Get target filename from the macro invocation, which is treated as a path
@@ -308,7 +308,7 @@ MacroBuiltin::include_bytes (Location invoc_locus, AST::MacroInvocData &invoc)
= parse_single_string_literal (invoc.get_delim_tok_tree (), invoc_locus,
invoc.get_expander ());
if (lit_expr == nullptr)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
std::string target_filename
= source_relative_path (lit_expr->as_string (), invoc_locus);
@@ -335,14 +335,14 @@ MacroBuiltin::include_bytes (Location invoc_locus, AST::MacroInvocData &invoc)
new AST::BorrowExpr (std::move (array), false, false, {}, invoc_locus));
auto node = AST::SingleASTNode (std::move (borrow));
- return AST::ASTFragment ({node});
+ return AST::Fragment ({node});
}
/* Expand builtin macro include_str!("filename"), which includes the contents
of the given file as a string. The file must be UTF-8 encoded. Yields an
expression of type &'static str. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::include_str (Location invoc_locus, AST::MacroInvocData &invoc)
{
/* Get target filename from the macro invocation, which is treated as a path
@@ -351,7 +351,7 @@ MacroBuiltin::include_str (Location invoc_locus, AST::MacroInvocData &invoc)
= parse_single_string_literal (invoc.get_delim_tok_tree (), invoc_locus,
invoc.get_expander ());
if (lit_expr == nullptr)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
std::string target_filename
= source_relative_path (lit_expr->as_string (), invoc_locus);
@@ -362,30 +362,30 @@ MacroBuiltin::include_str (Location invoc_locus, AST::MacroInvocData &invoc)
std::string str ((const char *) &bytes[0], bytes.size ());
auto node = AST::SingleASTNode (make_string (invoc_locus, str));
- return AST::ASTFragment ({node});
+ return AST::Fragment ({node});
}
/* Expand builtin macro compile_error!("error"), which forces a compile error
during the compile time. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::compile_error (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto lit_expr
= parse_single_string_literal (invoc.get_delim_tok_tree (), invoc_locus,
invoc.get_expander ());
if (lit_expr == nullptr)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
std::string error_string = lit_expr->as_string ();
rust_error_at (invoc_locus, "%s", error_string.c_str ());
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
/* Expand builtin macro concat!(), which joins all the literal parameters
into a string with no delimiter. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::concat (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto invoc_token_tree = invoc.get_delim_tok_tree ();
@@ -427,16 +427,16 @@ MacroBuiltin::concat (Location invoc_locus, AST::MacroInvocData &invoc)
parser.skip_token (last_token_id);
if (has_error)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
auto node = AST::SingleASTNode (make_string (invoc_locus, str));
- return AST::ASTFragment ({node});
+ return AST::Fragment ({node});
}
/* Expand builtin macro env!(), which inspects an environment variable at
compile time. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::env (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto invoc_token_tree = invoc.get_delim_tok_tree ();
@@ -451,11 +451,11 @@ MacroBuiltin::env (Location invoc_locus, AST::MacroInvocData &invoc)
auto expanded_expr = try_expand_many_expr (parser, invoc_locus, last_token_id,
invoc.get_expander (), has_error);
if (has_error)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
if (expanded_expr.size () < 1 || expanded_expr.size () > 2)
{
rust_error_at (invoc_locus, "env! takes 1 or 2 arguments");
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
if (expanded_expr.size () > 0)
{
@@ -463,7 +463,7 @@ MacroBuiltin::env (Location invoc_locus, AST::MacroInvocData &invoc)
= try_extract_string_literal_from_fragment (invoc_locus,
expanded_expr[0])))
{
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
}
if (expanded_expr.size () > 1)
@@ -472,7 +472,7 @@ MacroBuiltin::env (Location invoc_locus, AST::MacroInvocData &invoc)
= try_extract_string_literal_from_fragment (invoc_locus,
expanded_expr[1])))
{
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
}
@@ -487,14 +487,14 @@ MacroBuiltin::env (Location invoc_locus, AST::MacroInvocData &invoc)
lit_expr->as_string ().c_str ());
else
rust_error_at (invoc_locus, "%s", error_expr->as_string ().c_str ());
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
auto node = AST::SingleASTNode (make_string (invoc_locus, env_value));
- return AST::ASTFragment ({node});
+ return AST::Fragment ({node});
}
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::cfg (Location invoc_locus, AST::MacroInvocData &invoc)
{
// only parse if not already parsed
@@ -519,7 +519,7 @@ MacroBuiltin::cfg (Location invoc_locus, AST::MacroInvocData &invoc)
/* TODO: assuming that cfg! macros can only have one meta item inner, like cfg
* attributes */
if (invoc.get_meta_items ().size () != 1)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
bool result = invoc.get_meta_items ()[0]->check_cfg_predicate (
Session::get_instance ());
@@ -527,13 +527,13 @@ MacroBuiltin::cfg (Location invoc_locus, AST::MacroInvocData &invoc)
new AST::LiteralExpr (result ? "true" : "false", AST::Literal::BOOL,
PrimitiveCoreType::CORETYPE_BOOL, {}, invoc_locus)));
- return AST::ASTFragment ({literal_exp});
+ return AST::Fragment ({literal_exp});
}
/* Expand builtin macro include!(), which includes a source file at the current
scope compile time. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::include (Location invoc_locus, AST::MacroInvocData &invoc)
{
/* Get target filename from the macro invocation, which is treated as a path
@@ -542,7 +542,7 @@ MacroBuiltin::include (Location invoc_locus, AST::MacroInvocData &invoc)
= parse_single_string_literal (invoc.get_delim_tok_tree (), invoc_locus,
invoc.get_expander ());
if (lit_expr == nullptr)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
std::string filename
= source_relative_path (lit_expr->as_string (), invoc_locus);
@@ -556,7 +556,7 @@ MacroBuiltin::include (Location invoc_locus, AST::MacroInvocData &invoc)
{
rust_error_at (lit_expr->get_locus (),
"cannot open included file %qs: %m", target_filename);
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
rust_debug ("Attempting to parse included file %s", target_filename);
@@ -574,7 +574,7 @@ MacroBuiltin::include (Location invoc_locus, AST::MacroInvocData &invoc)
{
// inform the user that the errors above are from a included file
rust_inform (invoc_locus, "included from here");
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
std::vector<AST::SingleASTNode> nodes{};
@@ -584,10 +584,10 @@ MacroBuiltin::include (Location invoc_locus, AST::MacroInvocData &invoc)
nodes.push_back (node);
}
- return AST::ASTFragment (nodes);
+ return AST::Fragment (nodes);
}
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::line (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto current_line
@@ -597,7 +597,7 @@ MacroBuiltin::line (Location invoc_locus, AST::MacroInvocData &invoc)
new AST::LiteralExpr (std::to_string (current_line), AST::Literal::INT,
PrimitiveCoreType::CORETYPE_U32, {}, invoc_locus)));
- return AST::ASTFragment ({line_no});
+ return AST::Fragment ({line_no});
}
} // namespace Rust
diff --git a/gcc/rust/expand/rust-macro-builtins.h b/gcc/rust/expand/rust-macro-builtins.h
index f1ea545ed21..c65bd940189 100644
--- a/gcc/rust/expand/rust-macro-builtins.h
+++ b/gcc/rust/expand/rust-macro-builtins.h
@@ -20,6 +20,7 @@
#define RUST_MACRO_BUILTINS_H
#include "rust-ast.h"
+#include "rust-ast-fragment.h"
#include "rust-location.h"
/**
@@ -61,6 +62,7 @@
/* If assert is defined as a macro this file will not parse, so undefine this
before continuing. */
+// TODO: Rename all functions here `*_handler`
#ifdef assert
#undef assert
#endif
@@ -69,38 +71,34 @@ namespace Rust {
class MacroBuiltin
{
public:
- static AST::ASTFragment assert (Location invoc_locus,
- AST::MacroInvocData &invoc);
-
- static AST::ASTFragment file (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment assert (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment column (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment file (Location invoc_locus, AST::MacroInvocData &invoc);
- static AST::ASTFragment include_bytes (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment column (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment include_str (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment include_bytes (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment compile_error (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment include_str (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment concat (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment compile_error (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment env (Location invoc_locus,
+ static AST::Fragment concat (Location invoc_locus,
AST::MacroInvocData &invoc);
- static AST::ASTFragment cfg (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment env (Location invoc_locus, AST::MacroInvocData &invoc);
- static AST::ASTFragment include (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment cfg (Location invoc_locus, AST::MacroInvocData &invoc);
- static AST::ASTFragment line (Location invoc_locus,
+ static AST::Fragment include (Location invoc_locus,
AST::MacroInvocData &invoc);
+
+ static AST::Fragment line (Location invoc_locus, AST::MacroInvocData &invoc);
};
} // namespace Rust
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc
index d94cd118700..0684a28787f 100644
--- a/gcc/rust/expand/rust-macro-expand.cc
+++ b/gcc/rust/expand/rust-macro-expand.cc
@@ -26,7 +26,7 @@
#include "rust-early-name-resolver.h"
namespace Rust {
-AST::ASTFragment
+AST::Fragment
MacroExpander::expand_decl_macro (Location invoc_locus,
AST::MacroInvocData &invoc,
AST::MacroRulesDefinition &rules_def,
@@ -103,7 +103,7 @@ MacroExpander::expand_decl_macro (Location invoc_locus,
RichLocation r (invoc_locus);
r.add_range (rules_def.get_locus ());
rust_error_at (r, "Failed to match any rule within macro");
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
return transcribe_rule (*matched_rule, invoc_token_tree, matched_fragments,
@@ -139,7 +139,7 @@ MacroExpander::expand_invoc (AST::MacroInvocation &invoc, bool has_semicolon)
// - else is unreachable
// - derive container macro - unreachable
- auto fragment = AST::ASTFragment::create_error ();
+ auto fragment = AST::Fragment::create_error ();
invoc_data.set_expander (this);
// lookup the rules
@@ -707,7 +707,7 @@ MacroExpander::match_repetition (Parser<MacroInvocLexer> &parser,
/**
* Helper function to refactor calling a parsing function 0 or more times
*/
-static AST::ASTFragment
+static AST::Fragment
parse_many (Parser<MacroInvocLexer> &parser, TokenId &delimiter,
std::function<AST::SingleASTNode ()> parse_fn)
{
@@ -723,13 +723,13 @@ parse_many (Parser<MacroInvocLexer> &parser, TokenId &delimiter,
for (auto err : parser.get_errors ())
err.emit_error ();
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
nodes.emplace_back (std::move (node));
}
- return AST::ASTFragment (std::move (nodes));
+ return AST::Fragment (std::move (nodes));
}
/**
@@ -738,7 +738,7 @@ parse_many (Parser<MacroInvocLexer> &parser, TokenId &delimiter,
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_items (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
{
return parse_many (parser, delimiter, [&parser] () {
@@ -753,7 +753,7 @@ transcribe_many_items (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_ext (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
{
return parse_many (parser, delimiter, [&parser] () {
@@ -768,7 +768,7 @@ transcribe_many_ext (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_trait_items (Parser<MacroInvocLexer> &parser,
TokenId &delimiter)
{
@@ -784,7 +784,7 @@ transcribe_many_trait_items (Parser<MacroInvocLexer> &parser,
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_impl_items (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
{
return parse_many (parser, delimiter, [&parser] () {
@@ -799,7 +799,7 @@ transcribe_many_impl_items (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_trait_impl_items (Parser<MacroInvocLexer> &parser,
TokenId &delimiter)
{
@@ -815,7 +815,7 @@ transcribe_many_trait_impl_items (Parser<MacroInvocLexer> &parser,
* @param parser Parser to extract statements from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_stmts (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
{
auto restrictions = ParseRestrictions ();
@@ -835,12 +835,12 @@ transcribe_many_stmts (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
*
* @param parser Parser to extract statements from
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_expression (Parser<MacroInvocLexer> &parser)
{
auto expr = parser.parse_expr ();
- return AST::ASTFragment ({std::move (expr)});
+ return AST::Fragment ({std::move (expr)});
}
/**
@@ -848,17 +848,17 @@ transcribe_expression (Parser<MacroInvocLexer> &parser)
*
* @param parser Parser to extract statements from
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_type (Parser<MacroInvocLexer> &parser)
{
auto type = parser.parse_type (true);
for (auto err : parser.get_errors ())
err.emit_error ();
- return AST::ASTFragment ({std::move (type)});
+ return AST::Fragment ({std::move (type)});
}
-static AST::ASTFragment
+static AST::Fragment
transcribe_on_delimiter (Parser<MacroInvocLexer> &parser, bool semicolon,
AST::DelimType delimiter, TokenId last_token_id)
{
@@ -868,7 +868,7 @@ transcribe_on_delimiter (Parser<MacroInvocLexer> &parser, bool semicolon,
return transcribe_expression (parser);
} // namespace Rust
-static AST::ASTFragment
+static AST::Fragment
transcribe_context (MacroExpander::ContextType ctx,
Parser<MacroInvocLexer> &parser, bool semicolon,
AST::DelimType delimiter, TokenId last_token_id)
@@ -929,7 +929,7 @@ tokens_to_str (std::vector<std::unique_ptr<AST::Token>> &tokens)
return str;
}
-AST::ASTFragment
+AST::Fragment
MacroExpander::transcribe_rule (
AST::MacroRule &match_rule, AST::DelimTokenTree &invoc_token_tree,
std::map<std::string, MatchedFragmentContainer> &matched_fragments,
@@ -951,7 +951,7 @@ MacroExpander::transcribe_rule (
rust_debug ("substituted tokens: %s",
tokens_to_str (substituted_tokens).c_str ());
- // parse it to an ASTFragment
+ // parse it to an Fragment
MacroInvocLexer lex (std::move (substituted_tokens));
Parser<MacroInvocLexer> parser (lex);
@@ -994,7 +994,7 @@ MacroExpander::transcribe_rule (
{
for (auto &err : parser.get_errors ())
rust_error_at (err.locus, "%s", err.message.c_str ());
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
// are all the tokens used?
diff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h
index 187d79f9a28..b0c0c23a0c3 100644
--- a/gcc/rust/expand/rust-macro-expand.h
+++ b/gcc/rust/expand/rust-macro-expand.h
@@ -230,7 +230,7 @@ struct MacroExpander
MacroExpander (AST::Crate &crate, ExpansionCfg cfg, Session &session)
: cfg (cfg), crate (crate), session (session),
sub_stack (SubstitutionScope ()),
- expanded_fragment (AST::ASTFragment::create_error ()),
+ expanded_fragment (AST::Fragment::create_error ()),
resolver (Resolver::Resolver::get ()),
mappings (Analysis::Mappings::get ())
{}
@@ -246,10 +246,9 @@ struct MacroExpander
void expand_invoc (AST::MacroInvocation &invoc, bool has_semicolon);
// Expands a single declarative macro.
- AST::ASTFragment expand_decl_macro (Location locus,
- AST::MacroInvocData &invoc,
- AST::MacroRulesDefinition &rules_def,
- bool semicolon);
+ AST::Fragment expand_decl_macro (Location locus, AST::MacroInvocData &invoc,
+ AST::MacroRulesDefinition &rules_def,
+ bool semicolon);
void expand_cfg_attrs (AST::AttrVec &attrs);
bool fails_cfg (const AST::AttrVec &attr) const;
@@ -260,7 +259,7 @@ struct MacroExpander
bool try_match_rule (AST::MacroRule &match_rule,
AST::DelimTokenTree &invoc_token_tree);
- AST::ASTFragment transcribe_rule (
+ AST::Fragment transcribe_rule (
AST::MacroRule &match_rule, AST::DelimTokenTree &invoc_token_tree,
std::map<std::string, MatchedFragmentContainer> &matched_fragments,
bool semicolon, ContextType ctx);
@@ -314,16 +313,16 @@ struct MacroExpander
ContextType peek_context () { return context.back (); }
- void set_expanded_fragment (AST::ASTFragment &&fragment)
+ void set_expanded_fragment (AST::Fragment &&fragment)
{
expanded_fragment = std::move (fragment);
}
- AST::ASTFragment take_expanded_fragment (AST::ASTVisitor &vis)
+ AST::Fragment take_expanded_fragment (AST::ASTVisitor &vis)
{
- AST::ASTFragment old_fragment = std::move (expanded_fragment);
+ AST::Fragment old_fragment = std::move (expanded_fragment);
auto accumulator = std::vector<AST::SingleASTNode> ();
- expanded_fragment = AST::ASTFragment::create_error ();
+ expanded_fragment = AST::Fragment::create_error ();
auto early_name_resolver = Resolver::EarlyNameResolver ();
for (auto &node : old_fragment.get_nodes ())
@@ -345,7 +344,7 @@ struct MacroExpander
auto new_nodes = expanded_fragment.get_nodes ();
std::move (new_nodes.begin (), new_nodes.end (),
std::back_inserter (accumulator));
- expanded_fragment = AST::ASTFragment (accumulator);
+ expanded_fragment = AST::Fragment (accumulator);
}
expansion_depth--;
}
@@ -358,7 +357,7 @@ private:
Session &session;
SubstitutionScope sub_stack;
std::vector<ContextType> context;
- AST::ASTFragment expanded_fragment;
+ AST::Fragment expanded_fragment;
public:
Resolver::Resolver *resolver;
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc
index 4aeb7f5ae18..bee0682e9b4 100644
--- a/gcc/rust/util/rust-hir-map.cc
+++ b/gcc/rust/util/rust-hir-map.cc
@@ -840,8 +840,8 @@ Mappings::iterate_trait_items (
void
Mappings::insert_macro_def (AST::MacroRulesDefinition *macro)
{
- static std::map<std::string, std::function<AST::ASTFragment (
- Location, AST::MacroInvocData &)>>
+ static std::map<
+ std::string, std::function<AST::Fragment (Location, AST::MacroInvocData &)>>
builtin_macros = {
{"assert", MacroBuiltin::assert},
{"file", MacroBuiltin::file},
--
2.39.1
next prev parent reply other threads:[~2023-02-21 12:03 UTC|newest]
Thread overview: 107+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 12:00 Rust front-end update arthur.cohen
2023-02-21 12:00 ` [committed 001/103] gccrs: Fix missing dead code analysis ICE on local enum definition arthur.cohen
2023-02-21 12:00 ` [committed 002/103] gccrs: visibility: Rename get_public_vis_type -> get_vis_type arthur.cohen
2023-02-21 12:00 ` [committed 003/103] gccrs: dump: Emit visibility when dumping items arthur.cohen
2023-02-21 12:53 ` Update copyright years. (was: [committed 003/103] gccrs: dump: Emit visibility when dumping items) Thomas Schwinge
2023-02-21 12:00 ` [committed 004/103] gccrs: Add catch for recusive type queries arthur.cohen
2023-02-21 12:00 ` [committed 005/103] gccrs: testing: try loop in const function arthur.cohen
2023-02-21 12:00 ` [committed 006/103] gccrs: ast: dump assignment and compound assignment expr arthur.cohen
2023-02-21 12:00 ` [committed 007/103] gccrs: ast: dump If expressions arthur.cohen
2023-02-21 12:00 ` [committed 008/103] gccrs: builtins: Move implementation into source file arthur.cohen
2023-02-21 12:00 ` [committed 009/103] gccrs: Track DefId on ADT variants arthur.cohen
2023-02-21 12:01 ` [committed 010/103] gccrs: Ensure uniqueness on Path probe's arthur.cohen
2023-02-21 12:01 ` [committed 011/103] gccrs: Support looking up super traits for trait items arthur.cohen
2023-02-21 12:01 ` [committed 012/103] gccrs: ast: dump: add emit_generic_params helper arthur.cohen
2023-02-21 12:01 ` [committed 013/103] gccrs: ast: dump: add format_{tuple,struct}_field helpers arthur.cohen
2023-02-21 12:01 ` [committed 014/103] gccrs: ast: dump structs, enums and unions arthur.cohen
2023-02-21 12:01 ` [committed 015/103] gccrs: intrinsics: Add data prefetching intrinsics arthur.cohen
2023-02-21 12:01 ` [committed 016/103] gccrs: fix ICE on missing closing paren arthur.cohen
2023-02-21 12:01 ` [committed 017/103] gccrs: mappings: Add MacroInvocation -> MacroRulesDef mappings arthur.cohen
2023-02-21 12:01 ` [committed 018/103] gccrs: rust-ast-resolve-item: Add note about resolving glob uses arthur.cohen
2023-02-21 12:01 ` [committed 019/103] gccrs: ast: Add accept_vis() method to `GenericArg` arthur.cohen
2023-02-21 12:01 ` [committed 020/103] gccrs: early-name-resolver: Add simple macro name resolution arthur.cohen
2023-02-21 12:01 ` [committed 021/103] gccrs: Support type resolution on super traits on dyn objects arthur.cohen
2023-02-21 12:01 ` [committed 022/103] gccrs: Add mappings for fn_once lang item arthur.cohen
2023-02-21 12:01 ` [committed 023/103] gccrs: Add ABI mappings for rust-call to map to ABI::RUST arthur.cohen
2023-02-21 12:01 ` [committed 024/103] gccrs: Method resolution must support multiple candidates arthur.cohen
2023-02-21 12:01 ` [committed 025/103] gccrs: ast: dump: fix extra newline in block without tail arthur.cohen
2023-02-21 12:01 ` [committed 026/103] gccrs: ast: dump: minor fixups to IfExpr formatting arthur.cohen
2023-02-21 12:01 ` [committed 027/103] gccrs: ast: dump: ComparisonExpr and LazyBooleanExpr arthur.cohen
2023-02-21 12:01 ` [committed 028/103] gccrs: ast: dump: ArrayExpr arthur.cohen
2023-02-21 12:01 ` [committed 029/103] gccrs: ast: dump: various simple Exprs arthur.cohen
2023-02-21 12:01 ` [committed 030/103] gccrs: ast: dump: RangeExprs arthur.cohen
2023-02-21 12:01 ` [committed 031/103] gccrs: Refactor TraitResolver to not require a visitor arthur.cohen
2023-02-21 12:01 ` [committed 032/103] gccrs: ast: dump TypeAlias arthur.cohen
2023-02-21 12:01 ` [committed 033/103] gccrs: Support outer attribute handling on trait items just like normal items arthur.cohen
2023-02-21 12:01 ` [committed 034/103] gccrs: dump: Emit visibility when dumping items arthur.cohen
2023-02-23 1:01 ` Gerald Pfeifer
2023-02-23 10:53 ` Arthur Cohen
2023-02-21 12:01 ` [committed 035/103] gccrs: dump: Dump items within modules arthur.cohen
2023-02-21 12:01 ` [committed 036/103] gccrs: dump: Fix module dumping arthur.cohen
2023-02-21 12:01 ` [committed 037/103] gccrs: ast: Module: unloaded module and inner attributes arthur.cohen
2023-02-21 12:01 ` [committed 038/103] gccrs: dump: Dump macro rules definition arthur.cohen
2023-02-21 12:01 ` [committed 039/103] gccrs: Add check for recursive trait cycles arthur.cohen
2023-02-21 12:01 ` [committed 040/103] gccrs: ast: Refactor ASTFragment -> Fragment class arthur.cohen
2023-02-21 12:01 ` arthur.cohen [this message]
2023-02-21 12:01 ` [committed 042/103] gccrs: ast: Improve Fragment API arthur.cohen
2023-02-21 12:01 ` [committed 043/103] gccrs: Add missing fn_once_output langitem arthur.cohen
2023-02-21 12:01 ` [committed 044/103] gccrs: Refactor expression hir lowering into cc file arthur.cohen
2023-02-21 12:01 ` [committed 045/103] gccrs: Formatting cleanup in HIR lowering pattern arthur.cohen
2023-02-21 12:01 ` [committed 046/103] gccrs: Add name resolution for closures arthur.cohen
2023-02-21 12:01 ` [committed 047/103] gccrs: Refactor method call type checking arthur.cohen
2023-02-21 12:01 ` [committed 048/103] gccrs: Add closures to lints and error checking arthur.cohen
2023-02-21 12:01 ` [committed 049/103] gccrs: Initial Type resolution for closures arthur.cohen
2023-02-21 12:01 ` [committed 050/103] gccrs: Closure support at CallExpr arthur.cohen
2023-02-21 12:01 ` [committed 051/103] gccrs: Add missing name resolution to Function type-path segments arthur.cohen
2023-02-21 12:01 ` [committed 052/103] gccrs: Add missing hir lowering to function " arthur.cohen
2023-02-21 12:01 ` [committed 053/103] gccrs: Add missing type resolution for function type segments arthur.cohen
2023-02-21 12:01 ` [committed 054/103] gccrs: Support Closure calls as generic trait bounds arthur.cohen
2023-02-21 12:01 ` [committed 055/103] gccrs: Implement the inline visitor arthur.cohen
2023-02-21 12:01 ` [committed 056/103] gccrs: rust: Allow gccrs to build on x86_64-apple-darwin with clang/libc++ arthur.cohen
2023-02-21 12:01 ` [committed 057/103] gccrs: builtins: Rename all bang macro handlers arthur.cohen
2023-02-21 12:01 ` [committed 058/103] gccrs: intrinsics: Add `sorry_handler` intrinsic handler arthur.cohen
2023-02-21 12:01 ` [committed 059/103] gccrs: constexpr: Add `rust_sorry_at` in places relying on init values arthur.cohen
2023-02-21 12:01 ` [committed 060/103] gccrs: intrinsics: Add early implementation for atomic_store_{seqcst, relaxed, release} arthur.cohen
2023-02-21 12:01 ` [committed 061/103] gccrs: intrinsics: Add unchecked operation intrinsics arthur.cohen
2023-02-21 12:01 ` [committed 062/103] gccrs: intrinsics: Use lambdas for wrapping_<op> intrinsics arthur.cohen
2023-02-21 12:01 ` [committed 063/103] gccrs: intrinsics: Cleanup error handling around atomic_store_* arthur.cohen
2023-02-21 12:01 ` [committed 064/103] gccrs: intrinsics: Implement atomic_load intrinsics arthur.cohen
2023-02-21 12:01 ` [committed 065/103] gccrs: ast: visitor pattern -> overload syntax compatibility layer arthur.cohen
2023-02-21 12:01 ` [committed 066/103] gccrs: ast: transform helper methods to visits and add methods to simplify repeated patterns arthur.cohen
2023-02-21 12:01 ` [committed 067/103] gccrs: ast: refer correctly to arguments in docs-strings arthur.cohen
2023-02-21 12:01 ` [committed 068/103] gccrs: ast: Dump unit struct arthur.cohen
2023-02-21 12:01 ` [committed 069/103] gccrs: add lang item "phantom_data" arthur.cohen
2023-02-21 12:02 ` [committed 070/103] gccrs: add Location to AST::Visibility arthur.cohen
2023-02-21 12:02 ` [committed 071/103] gccrs: typecheck: Fix overzealous `delete` call arthur.cohen
2023-02-21 12:02 ` [committed 072/103] gccrs: ast: add visit overload for references arthur.cohen
2023-02-21 12:02 ` [committed 073/103] gccrs: ast: Dump where clause and recursively needed nodes arthur.cohen
2023-02-21 12:02 ` [committed 074/103] gccrs: ast: Dump slice type arthur.cohen
2023-02-21 12:02 ` [committed 075/103] gccrs: ast: Dump array type arthur.cohen
2023-02-21 12:02 ` [committed 076/103] gccrs: ast: Dump raw pointer type arthur.cohen
2023-02-21 12:02 ` [committed 077/103] gccrs: ast: Dump never type arthur.cohen
2023-02-21 12:02 ` [committed 078/103] gccrs: ast: Dump tuple type arthur.cohen
2023-02-21 12:02 ` [committed 079/103] gccrs: ast: Dump inferred type arthur.cohen
2023-02-21 12:02 ` [committed 080/103] gccrs: ast: Dump bare function type arthur.cohen
2023-02-21 12:02 ` [committed 081/103] gccrs: ast: Dump impl trait type one bound arthur.cohen
2023-02-21 12:02 ` [committed 082/103] gccrs: ast: Dump impl trait type arthur.cohen
2023-02-21 12:02 ` [committed 083/103] gccrs: ast: Dump trait object type arthur.cohen
2023-02-21 12:02 ` [committed 084/103] gccrs: ast: Dump parenthesised type arthur.cohen
2023-02-21 12:02 ` [committed 085/103] gccrs: ast: Dump trait object type one bound arthur.cohen
2023-02-21 12:02 ` [committed 086/103] gccrs: ast: Dump type param type arthur.cohen
2023-02-21 12:02 ` [committed 087/103] gccrs: ast: Dump generic parameters arthur.cohen
2023-02-21 12:02 ` [committed 088/103] gccrs: ast: Remove unused include in rust-ast-dump.cc arthur.cohen
2023-02-21 12:02 ` [committed 089/103] gccrs: ast: Dump remove /* stmp */ comment to not clutter the dump arthur.cohen
2023-02-21 12:02 ` [committed 090/103] gccrs: ast: Dump no comma after self in fn params if it is the last one arthur.cohen
2023-02-21 12:02 ` [committed 091/103] gccrs: Remove default location. Add visibility location to create_* functions arthur.cohen
2023-02-21 12:02 ` [committed 092/103] gccrs: Improve lexer dump arthur.cohen
2023-02-21 12:02 ` [committed 093/103] gccrs: Get rid of make builtin macro arthur.cohen
2023-02-21 12:02 ` [committed 094/103] gccrs: Refactor name resolver to take a Rib::ItemType arthur.cohen
2023-02-21 12:02 ` [committed 095/103] gccrs: Add closure binding's tracking to name resolution arthur.cohen
2023-02-21 12:02 ` [committed 096/103] gccrs: Add capture tracking to the type info for closures arthur.cohen
2023-02-21 12:02 ` [committed 097/103] gccrs: Add initial support for argument capture of closures arthur.cohen
2023-02-21 12:02 ` [committed 098/103] gccrs: Fix undefined behaviour issues on macos arthur.cohen
2023-02-21 12:02 ` [committed 099/103] gccrs: Skip this debug test case which is failing on the latest mac-os devtools and its only for debug info arthur.cohen
2023-02-21 12:02 ` [committed 100/103] gccrs: Cleanup unused parameters to fix the bootstrap build arthur.cohen
2023-02-21 12:02 ` [committed 101/103] gccrs: Repair 'gcc/rust/lang.opt' comment arthur.cohen
2023-02-21 12:02 ` [committed 102/103] gccrs: const evaluator: Remove get_nth_callarg arthur.cohen
2023-02-21 12:02 ` [committed 103/103] gccrs: add math intrinsics 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=20230221120230.596966-42-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).