aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-unwrap-segment.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/util/rust-unwrap-segment.h')
-rw-r--r--gcc/rust/util/rust-unwrap-segment.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-unwrap-segment.h b/gcc/rust/util/rust-unwrap-segment.h
index af3a237..ccc1e61 100644
--- a/gcc/rust/util/rust-unwrap-segment.h
+++ b/gcc/rust/util/rust-unwrap-segment.h
@@ -16,6 +16,10 @@
// along with GCC; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+#include "rust-system.h"
+#include "optional.h"
+#include "rust-lang-item.h"
+#include "rust-mapping-common.h"
#include <ast/rust-ast-full-decls.h>
namespace Rust {
@@ -115,4 +119,20 @@ unwrap_segment_get_lang_item (const std::unique_ptr<T> &ptr)
return unwrap_segment_get_lang_item (*ptr);
}
+/**
+ * Used to output a path in error messages
+ */
+
+inline static std::string
+unwrap_segment_error_string (const AST::TypePath &path)
+{
+ return path.make_debug_string ();
+}
+
+inline static std::string
+unwrap_segment_error_string (const AST::PathInExpression &path)
+{
+ return path.as_simple_path ().as_string ();
+}
+
} // namespace Rust