https://gcc.gnu.org/g:5ec49042d3e8a3a37c4cde8bc34242d63ba1ba43
commit r17-4094-g5ec49042d3e8a3a37c4cde8bc34242d63ba1ba43 Author: Arthur Cohen <[email protected]> Date: Fri Aug 7 17:29:58 2026 +0200 gccrs: lang-items: Register va_list 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. Diff: --- gcc/rust/util/rust-lang-item.cc | 2 ++ gcc/rust/util/rust-lang-item.h | 2 ++ gcc/testsuite/rust/compile/va_list-lang-item.rs | 33 +++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/gcc/rust/util/rust-lang-item.cc b/gcc/rust/util/rust-lang-item.cc index a2b9192647a8..b00ce99035b8 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 317f17a2b1aa..1333138265ba 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 000000000000..dfde1cdd358a --- /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>, +}
