summaryrefslogtreecommitdiffstats
path: root/vendor/cxx/src/symbols
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/cxx/src/symbols
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/cxx/src/symbols')
-rw-r--r--vendor/cxx/src/symbols/exception.rs18
-rw-r--r--vendor/cxx/src/symbols/mod.rs5
-rw-r--r--vendor/cxx/src/symbols/rust_slice.rs20
-rw-r--r--vendor/cxx/src/symbols/rust_str.rs43
-rw-r--r--vendor/cxx/src/symbols/rust_string.rs114
-rw-r--r--vendor/cxx/src/symbols/rust_vec.rs91
6 files changed, 0 insertions, 291 deletions
diff --git a/vendor/cxx/src/symbols/exception.rs b/vendor/cxx/src/symbols/exception.rs
deleted file mode 100644
index b8fe1b5da..000000000
--- a/vendor/cxx/src/symbols/exception.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#![cfg(feature = "alloc")]
-
-use crate::result::PtrLen;
-use alloc::boxed::Box;
-use alloc::string::String;
-use core::ptr::NonNull;
-use core::slice;
-
-#[export_name = "cxxbridge1$exception"]
-unsafe extern "C" fn exception(ptr: *const u8, len: usize) -> PtrLen {
- let slice = unsafe { slice::from_raw_parts(ptr, len) };
- let string = String::from_utf8_lossy(slice);
- let len = string.len();
- let raw_str = Box::into_raw(string.into_owned().into_boxed_str());
- let raw_u8 = raw_str.cast::<u8>();
- let nonnull = unsafe { NonNull::new_unchecked(raw_u8) };
- PtrLen { ptr: nonnull, len }
-}
diff --git a/vendor/cxx/src/symbols/mod.rs b/vendor/cxx/src/symbols/mod.rs
deleted file mode 100644
index e00bb550e..000000000
--- a/vendor/cxx/src/symbols/mod.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-mod exception;
-mod rust_slice;
-mod rust_str;
-mod rust_string;
-mod rust_vec;
diff --git a/vendor/cxx/src/symbols/rust_slice.rs b/vendor/cxx/src/symbols/rust_slice.rs
deleted file mode 100644
index df215acf5..000000000
--- a/vendor/cxx/src/symbols/rust_slice.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-use crate::rust_slice::RustSlice;
-use core::mem::MaybeUninit;
-use core::ptr::{self, NonNull};
-
-#[export_name = "cxxbridge1$slice$new"]
-unsafe extern "C" fn slice_new(this: &mut MaybeUninit<RustSlice>, ptr: NonNull<()>, len: usize) {
- let this = this.as_mut_ptr();
- let rust_slice = RustSlice::from_raw_parts(ptr, len);
- unsafe { ptr::write(this, rust_slice) }
-}
-
-#[export_name = "cxxbridge1$slice$ptr"]
-unsafe extern "C" fn slice_ptr(this: &RustSlice) -> NonNull<()> {
- this.as_non_null_ptr()
-}
-
-#[export_name = "cxxbridge1$slice$len"]
-unsafe extern "C" fn slice_len(this: &RustSlice) -> usize {
- this.len()
-}
diff --git a/vendor/cxx/src/symbols/rust_str.rs b/vendor/cxx/src/symbols/rust_str.rs
deleted file mode 100644
index 3b33bc4a5..000000000
--- a/vendor/cxx/src/symbols/rust_str.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-#[cfg(feature = "alloc")]
-use alloc::string::String;
-use core::mem::MaybeUninit;
-use core::ptr;
-use core::slice;
-use core::str;
-
-#[export_name = "cxxbridge1$str$new"]
-unsafe extern "C" fn str_new(this: &mut MaybeUninit<&str>) {
- let this = this.as_mut_ptr();
- unsafe { ptr::write(this, "") }
-}
-
-#[cfg(feature = "alloc")]
-#[export_name = "cxxbridge1$str$ref"]
-unsafe extern "C" fn str_ref<'a>(this: &mut MaybeUninit<&'a str>, string: &'a String) {
- let this = this.as_mut_ptr();
- let s = string.as_str();
- unsafe { ptr::write(this, s) }
-}
-
-#[export_name = "cxxbridge1$str$from"]
-unsafe extern "C" fn str_from(this: &mut MaybeUninit<&str>, ptr: *const u8, len: usize) -> bool {
- let slice = unsafe { slice::from_raw_parts(ptr, len) };
- match str::from_utf8(slice) {
- Ok(s) => {
- let this = this.as_mut_ptr();
- unsafe { ptr::write(this, s) }
- true
- }
- Err(_) => false,
- }
-}
-
-#[export_name = "cxxbridge1$str$ptr"]
-unsafe extern "C" fn str_ptr(this: &&str) -> *const u8 {
- this.as_ptr()
-}
-
-#[export_name = "cxxbridge1$str$len"]
-unsafe extern "C" fn str_len(this: &&str) -> usize {
- this.len()
-}
diff --git a/vendor/cxx/src/symbols/rust_string.rs b/vendor/cxx/src/symbols/rust_string.rs
deleted file mode 100644
index 8b7c8c481..000000000
--- a/vendor/cxx/src/symbols/rust_string.rs
+++ /dev/null
@@ -1,114 +0,0 @@
-#![cfg(feature = "alloc")]
-
-use alloc::borrow::ToOwned;
-use alloc::string::String;
-use core::mem::{ManuallyDrop, MaybeUninit};
-use core::ptr;
-use core::slice;
-use core::str;
-
-#[export_name = "cxxbridge1$string$new"]
-unsafe extern "C" fn string_new(this: &mut MaybeUninit<String>) {
- let this = this.as_mut_ptr();
- let new = String::new();
- unsafe { ptr::write(this, new) }
-}
-
-#[export_name = "cxxbridge1$string$clone"]
-unsafe extern "C" fn string_clone(this: &mut MaybeUninit<String>, other: &String) {
- let this = this.as_mut_ptr();
- let clone = other.clone();
- unsafe { ptr::write(this, clone) }
-}
-
-#[export_name = "cxxbridge1$string$from_utf8"]
-unsafe extern "C" fn string_from_utf8(
- this: &mut MaybeUninit<String>,
- ptr: *const u8,
- len: usize,
-) -> bool {
- let slice = unsafe { slice::from_raw_parts(ptr, len) };
- match str::from_utf8(slice) {
- Ok(s) => {
- let this = this.as_mut_ptr();
- let owned = s.to_owned();
- unsafe { ptr::write(this, owned) }
- true
- }
- Err(_) => false,
- }
-}
-
-#[export_name = "cxxbridge1$string$from_utf8_lossy"]
-unsafe extern "C" fn string_from_utf8_lossy(
- this: &mut MaybeUninit<String>,
- ptr: *const u8,
- len: usize,
-) {
- let slice = unsafe { slice::from_raw_parts(ptr, len) };
- let owned = String::from_utf8_lossy(slice).into_owned();
- let this = this.as_mut_ptr();
- unsafe { ptr::write(this, owned) }
-}
-
-#[export_name = "cxxbridge1$string$from_utf16"]
-unsafe extern "C" fn string_from_utf16(
- this: &mut MaybeUninit<String>,
- ptr: *const u16,
- len: usize,
-) -> bool {
- let slice = unsafe { slice::from_raw_parts(ptr, len) };
- match String::from_utf16(slice) {
- Ok(s) => {
- let this = this.as_mut_ptr();
- unsafe { ptr::write(this, s) }
- true
- }
- Err(_) => false,
- }
-}
-
-#[export_name = "cxxbridge1$string$from_utf16_lossy"]
-unsafe extern "C" fn string_from_utf16_lossy(
- this: &mut MaybeUninit<String>,
- ptr: *const u16,
- len: usize,
-) {
- let slice = unsafe { slice::from_raw_parts(ptr, len) };
- let owned = String::from_utf16_lossy(slice);
- let this = this.as_mut_ptr();
- unsafe { ptr::write(this, owned) }
-}
-
-#[export_name = "cxxbridge1$string$drop"]
-unsafe extern "C" fn string_drop(this: &mut ManuallyDrop<String>) {
- unsafe { ManuallyDrop::drop(this) }
-}
-
-#[export_name = "cxxbridge1$string$ptr"]
-unsafe extern "C" fn string_ptr(this: &String) -> *const u8 {
- this.as_ptr()
-}
-
-#[export_name = "cxxbridge1$string$len"]
-unsafe extern "C" fn string_len(this: &String) -> usize {
- this.len()
-}
-
-#[export_name = "cxxbridge1$string$capacity"]
-unsafe extern "C" fn string_capacity(this: &String) -> usize {
- this.capacity()
-}
-
-#[export_name = "cxxbridge1$string$reserve_additional"]
-unsafe extern "C" fn string_reserve_additional(this: &mut String, additional: usize) {
- this.reserve(additional);
-}
-
-#[export_name = "cxxbridge1$string$reserve_total"]
-unsafe extern "C" fn string_reserve_total(this: &mut String, new_cap: usize) {
- if new_cap > this.capacity() {
- let additional = new_cap - this.len();
- this.reserve(additional);
- }
-}
diff --git a/vendor/cxx/src/symbols/rust_vec.rs b/vendor/cxx/src/symbols/rust_vec.rs
deleted file mode 100644
index 89c7da44e..000000000
--- a/vendor/cxx/src/symbols/rust_vec.rs
+++ /dev/null
@@ -1,91 +0,0 @@
-#![cfg(feature = "alloc")]
-
-use crate::c_char::c_char;
-use crate::rust_string::RustString;
-use crate::rust_vec::RustVec;
-use alloc::vec::Vec;
-use core::mem;
-use core::ptr;
-
-macro_rules! rust_vec_shims {
- ($segment:expr, $ty:ty) => {
- const_assert_eq!(mem::size_of::<[usize; 3]>(), mem::size_of::<RustVec<$ty>>());
- const_assert_eq!(mem::size_of::<Vec<$ty>>(), mem::size_of::<RustVec<$ty>>());
- const_assert_eq!(mem::align_of::<Vec<$ty>>(), mem::align_of::<RustVec<$ty>>());
-
- const _: () = {
- attr! {
- #[export_name = concat!("cxxbridge1$rust_vec$", $segment, "$new")]
- unsafe extern "C" fn __new(this: *mut RustVec<$ty>) {
- unsafe { ptr::write(this, RustVec::new()) }
- }
- }
- attr! {
- #[export_name = concat!("cxxbridge1$rust_vec$", $segment, "$drop")]
- unsafe extern "C" fn __drop(this: *mut RustVec<$ty>) {
- unsafe { ptr::drop_in_place(this) }
- }
- }
- attr! {
- #[export_name = concat!("cxxbridge1$rust_vec$", $segment, "$len")]
- unsafe extern "C" fn __len(this: *const RustVec<$ty>) -> usize {
- unsafe { &*this }.len()
- }
- }
- attr! {
- #[export_name = concat!("cxxbridge1$rust_vec$", $segment, "$capacity")]
- unsafe extern "C" fn __capacity(this: *const RustVec<$ty>) -> usize {
- unsafe { &*this }.capacity()
- }
- }
- attr! {
- #[export_name = concat!("cxxbridge1$rust_vec$", $segment, "$data")]
- unsafe extern "C" fn __data(this: *const RustVec<$ty>) -> *const $ty {
- unsafe { &*this }.as_ptr()
- }
- }
- attr! {
- #[export_name = concat!("cxxbridge1$rust_vec$", $segment, "$reserve_total")]
- unsafe extern "C" fn __reserve_total(this: *mut RustVec<$ty>, new_cap: usize) {
- unsafe { &mut *this }.reserve_total(new_cap);
- }
- }
- attr! {
- #[export_name = concat!("cxxbridge1$rust_vec$", $segment, "$set_len")]
- unsafe extern "C" fn __set_len(this: *mut RustVec<$ty>, len: usize) {
- unsafe { (*this).set_len(len) }
- }
- }
- attr! {
- #[export_name = concat!("cxxbridge1$rust_vec$", $segment, "$truncate")]
- unsafe extern "C" fn __truncate(this: *mut RustVec<$ty>, len: usize) {
- unsafe { (*this).truncate(len) }
- }
- }
- };
- };
-}
-
-macro_rules! rust_vec_shims_for_primitive {
- ($ty:ident) => {
- rust_vec_shims!(stringify!($ty), $ty);
- };
-}
-
-rust_vec_shims_for_primitive!(bool);
-rust_vec_shims_for_primitive!(u8);
-rust_vec_shims_for_primitive!(u16);
-rust_vec_shims_for_primitive!(u32);
-rust_vec_shims_for_primitive!(u64);
-rust_vec_shims_for_primitive!(usize);
-rust_vec_shims_for_primitive!(i8);
-rust_vec_shims_for_primitive!(i16);
-rust_vec_shims_for_primitive!(i32);
-rust_vec_shims_for_primitive!(i64);
-rust_vec_shims_for_primitive!(isize);
-rust_vec_shims_for_primitive!(f32);
-rust_vec_shims_for_primitive!(f64);
-
-rust_vec_shims!("char", c_char);
-rust_vec_shims!("string", RustString);
-rust_vec_shims!("str", &str);