diff --git a/gcc/rust/expand/rust-macro-builtins.cc b/gcc/rust/expand/rust-macro-builtins.cc index 2af05a5e3777..f103759acdd7 100644 --- a/gcc/rust/expand/rust-macro-builtins.cc +++ b/gcc/rust/expand/rust-macro-builtins.cc @@ -126,8 +126,7 @@ std::unordered_map {"Hash", MacroBuiltin::proc_macro_builtin}, }; -// FIXME: This should return an tl::optional -BuiltinMacro +tl::optional builtin_macro_from_string (const std::string &identifier) { auto macro = MacroBuiltin::builtins.lookup (identifier); diff --git a/gcc/rust/expand/rust-macro-builtins.h b/gcc/rust/expand/rust-macro-builtins.h index f9ab3fc3698e..1d6b30b59332 100644 --- a/gcc/rust/expand/rust-macro-builtins.h +++ b/gcc/rust/expand/rust-macro-builtins.h @@ -75,7 +75,7 @@ enum class BuiltinMacro Hash, }; -BuiltinMacro +tl::optional builtin_macro_from_string (const std::string &identifier); /** diff --git a/gcc/rust/resolve/rust-early-name-resolver.cc b/gcc/rust/resolve/rust-early-name-resolver.cc index 422dd92e4620..d70f9ca9806e 100644 --- a/gcc/rust/resolve/rust-early-name-resolver.cc +++ b/gcc/rust/resolve/rust-early-name-resolver.cc @@ -497,7 +497,7 @@ EarlyNameResolver::visit (AST::MacroInvocation &invoc) { auto builtin_kind = builtin_macro_from_string (rules_def->get_rule_name ().as_string ()); - invoc.map_to_builtin (builtin_kind); + invoc.map_to_builtin (builtin_kind.value ()); } auto attributes = rules_def->get_outer_attrs ();