diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-01-21 16:13:11 +0100 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2025-01-21 17:53:36 +0000 |
commit | b87fd67fa807665d741968b7aca4b9399f2071db (patch) | |
tree | f09d693d132625d1b34ab5adf2927dbba806c21b /gcc/rust/util/rust-lang-item.h | |
parent | 289bf52597fbe4cd85c0dca2bcb0404a960ad588 (diff) | |
download | gcc-b87fd67fa807665d741968b7aca4b9399f2071db.zip gcc-b87fd67fa807665d741968b7aca4b9399f2071db.tar.gz gcc-b87fd67fa807665d741968b7aca4b9399f2071db.tar.bz2 |
lang-items: Add Result and Try lang items
gcc/rust/ChangeLog:
* util/rust-lang-item.h: Add handling for Result::Ok, Result::Err, Try, Try::into_result,
Try::from_ok, Try::from_err.
* util/rust-lang-item.cc: Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/try-trait.rs: New test.
Diffstat (limited to 'gcc/rust/util/rust-lang-item.h')
-rw-r--r-- | gcc/rust/util/rust-lang-item.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-lang-item.h b/gcc/rust/util/rust-lang-item.h index 3b3d86e..4836536 100644 --- a/gcc/rust/util/rust-lang-item.h +++ b/gcc/rust/util/rust-lang-item.h @@ -127,8 +127,20 @@ public: OPTION_SOME, OPTION_NONE, + RESULT_OK, + RESULT_ERR, + INTOITER_INTOITER, ITERATOR_NEXT, + + // NOTE: These lang items are *not* necessarily present in later versions of + // Rust (I am unsure at which point they have been removed as the `Try` + // trait is unstable). They will need to be changed when updating the + // targeted Rust version of gccrs + TRY, + TRY_INTO_RESULT, + TRY_FROM_ERROR, + TRY_FROM_OK, }; static const BiMap<std::string, Kind> lang_items; |