mirror of
https://github.com/topjohnwu/cxx.git
synced 2024-11-23 03:49:44 +00:00
Delete support for rust versions without c_char in core
This commit is contained in:
parent
1565becf8d
commit
a68d06a614
6
build.rs
6
build.rs
@ -33,7 +33,6 @@ fn main() {
|
||||
println!("cargo:rustc-check-cfg=cfg(compile_error_if_std)");
|
||||
println!("cargo:rustc-check-cfg=cfg(cxx_experimental_no_alloc)");
|
||||
println!("cargo:rustc-check-cfg=cfg(error_in_core)");
|
||||
println!("cargo:rustc-check-cfg=cfg(no_core_ffi_c_char)");
|
||||
println!("cargo:rustc-check-cfg=cfg(skip_ui_tests)");
|
||||
}
|
||||
|
||||
@ -45,11 +44,6 @@ fn main() {
|
||||
);
|
||||
}
|
||||
|
||||
if rustc.minor < 64 {
|
||||
// core::ffi::c_char
|
||||
println!("cargo:rustc-cfg=no_core_ffi_c_char");
|
||||
}
|
||||
|
||||
if rustc.minor >= 81 {
|
||||
// core::error::Error
|
||||
println!("cargo:rustc-cfg=error_in_core");
|
||||
|
@ -1,77 +0,0 @@
|
||||
#![allow(clippy::duplicated_attributes)] // clippy bug: https://github.com/rust-lang/rust-clippy/issues/12538
|
||||
|
||||
#[allow(missing_docs)]
|
||||
pub type c_char = c_char_definition::c_char;
|
||||
|
||||
// Validate that our definition is consistent with libstd's definition, without
|
||||
// introducing a dependency on libstd in ordinary builds.
|
||||
#[cfg(all(test, feature = "std"))]
|
||||
const _: self::c_char = 0 as std::os::raw::c_char;
|
||||
|
||||
#[cfg(not(no_core_ffi_c_char))]
|
||||
mod c_char_definition {
|
||||
pub use core::ffi::c_char;
|
||||
}
|
||||
|
||||
#[cfg(no_core_ffi_c_char)]
|
||||
#[allow(dead_code)]
|
||||
mod c_char_definition {
|
||||
// These are the targets on which c_char is unsigned.
|
||||
#[cfg(any(
|
||||
all(
|
||||
target_os = "linux",
|
||||
any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "arm",
|
||||
target_arch = "hexagon",
|
||||
target_arch = "powerpc",
|
||||
target_arch = "powerpc64",
|
||||
target_arch = "s390x",
|
||||
target_arch = "riscv64",
|
||||
target_arch = "riscv32"
|
||||
)
|
||||
),
|
||||
all(
|
||||
target_os = "android",
|
||||
any(target_arch = "aarch64", target_arch = "arm")
|
||||
),
|
||||
all(target_os = "l4re", target_arch = "x86_64"),
|
||||
all(
|
||||
target_os = "freebsd",
|
||||
any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "arm",
|
||||
target_arch = "powerpc",
|
||||
target_arch = "powerpc64",
|
||||
target_arch = "riscv64"
|
||||
)
|
||||
),
|
||||
all(
|
||||
target_os = "netbsd",
|
||||
any(target_arch = "aarch64", target_arch = "arm", target_arch = "powerpc")
|
||||
),
|
||||
all(target_os = "openbsd", target_arch = "aarch64"),
|
||||
all(
|
||||
target_os = "vxworks",
|
||||
any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "arm",
|
||||
target_arch = "powerpc64",
|
||||
target_arch = "powerpc"
|
||||
)
|
||||
),
|
||||
all(target_os = "fuchsia", target_arch = "aarch64")
|
||||
))]
|
||||
pub use self::unsigned::c_char;
|
||||
|
||||
// On every other target, c_char is signed.
|
||||
pub use self::signed::*;
|
||||
|
||||
mod unsigned {
|
||||
pub type c_char = u8;
|
||||
}
|
||||
|
||||
mod signed {
|
||||
pub type c_char = i8;
|
||||
}
|
||||
}
|
@ -449,7 +449,6 @@ compile_error! {
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
mod c_char;
|
||||
mod cxx_vector;
|
||||
mod exception;
|
||||
mod extern_type;
|
||||
@ -504,7 +503,6 @@ pub type Vector<T> = CxxVector<T>;
|
||||
// Not public API.
|
||||
#[doc(hidden)]
|
||||
pub mod private {
|
||||
pub use crate::c_char::c_char;
|
||||
pub use crate::cxx_vector::VectorElement;
|
||||
pub use crate::extern_type::{verify_extern_kind, verify_extern_type};
|
||||
pub use crate::function::FatFunction;
|
||||
|
@ -1,9 +1,9 @@
|
||||
#![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::ffi::c_char;
|
||||
use core::mem;
|
||||
use core::ptr;
|
||||
|
||||
|
@ -13,7 +13,7 @@ impl ToTokens for Type {
|
||||
Type::Ident(ident) => {
|
||||
if ident.rust == Char {
|
||||
let span = ident.rust.span();
|
||||
tokens.extend(quote_spanned!(span=> ::cxx::private::));
|
||||
tokens.extend(quote_spanned!(span=> ::cxx::core::ffi::));
|
||||
} else if ident.rust == CxxString {
|
||||
let span = ident.rust.span();
|
||||
tokens.extend(quote_spanned!(span=> ::cxx::));
|
||||
|
Loading…
Reference in New Issue
Block a user