From: Arthur Cohen <[email protected]>

gcc/rust/ChangeLog:

        * util/rust-lang-item.h: Add enum value for VaListImpl.
        * util/rust-lang-item.cc: Register it.

gcc/testsuite/ChangeLog:

        * rust/compile/va_list-lang-item.rs: New test.
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/40b339792f6e9197fea912b3264ecf7b022f6279

The commit has NOT been mentioned in any issue.

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4771

 gcc/rust/util/rust-lang-item.cc               |  2 ++
 gcc/rust/util/rust-lang-item.h                |  2 ++
 .../rust/compile/va_list-lang-item.rs         | 33 +++++++++++++++++++
 3 files changed, 37 insertions(+)
 create mode 100644 gcc/testsuite/rust/compile/va_list-lang-item.rs

diff --git a/gcc/rust/util/rust-lang-item.cc b/gcc/rust/util/rust-lang-item.cc
index a2b919264..b00ce9903 100644
--- a/gcc/rust/util/rust-lang-item.cc
+++ b/gcc/rust/util/rust-lang-item.cc
@@ -142,6 +142,8 @@ const BiMap<std::string, LangItem::Kind> 
Rust::LangItem::lang_items = {{
   {"Pending", Kind::PENDING},
   {"generator", Kind::GENERATOR},
   {"generator_state", Kind::GENERATOR_STATE},
+
+  {"va_list", Kind::VA_LIST},
 }};
 
 tl::optional<LangItem::Kind>
diff --git a/gcc/rust/util/rust-lang-item.h b/gcc/rust/util/rust-lang-item.h
index 317f17a2b..133313826 100644
--- a/gcc/rust/util/rust-lang-item.h
+++ b/gcc/rust/util/rust-lang-item.h
@@ -178,6 +178,8 @@ public:
     PENDING,
     GENERATOR,
     GENERATOR_STATE,
+
+    VA_LIST,
   };
 
   static const BiMap<std::string, Kind> lang_items;
diff --git a/gcc/testsuite/rust/compile/va_list-lang-item.rs 
b/gcc/testsuite/rust/compile/va_list-lang-item.rs
new file mode 100644
index 000000000..dfde1cdd3
--- /dev/null
+++ b/gcc/testsuite/rust/compile/va_list-lang-item.rs
@@ -0,0 +1,33 @@
+#![feature(no_core)]
+#![feature(optin_builtin_traits)]
+#![feature(negative_impls)]
+#![feature(lang_items)]
+#![feature(rustc_attrs)]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized {}
+
+#[lang = "phantom_data"]
+pub struct PhantomData<T>;
+
+type c_void = ();
+
+/// x86_64 ABI implementation of a `va_list`.
+// #[cfg(all(target_arch = "x86_64", not(windows)))]
+#[repr(C)]
+// #[derive(Debug)]
+#[unstable(
+    feature = "c_variadic",
+    reason = "the `c_variadic` feature has not been properly tested on \
+              all supported platforms",
+    issue = "44930"
+)]
+#[lang = "va_list"]
+pub struct VaListImpl<'f> {
+    pub gp_offset: i32,
+    pub fp_offset: i32,
+    pub overflow_arg_area: *mut c_void,
+    pub reg_save_area: *mut c_void,
+    pub _marker: PhantomData<&'f mut &'f c_void>,
+}

base-commit: 4667188af37c2a484dca82435cade18aa7ae59cd
-- 
2.54.0

Reply via email to