mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Auto merge of #155755 - JonathanBrouwer:rollup-oG1Wz3V, r=JonathanBrouwer
Rollup of 3 pull requests Successful merges: - rust-lang/rust#155754 (make the `core::ffi::va_list` module private) - rust-lang/rust#155522 (cmse: test returning `MaybeUninit<T>`) - rust-lang/rust#155741 (std: Refactor BufWriter::flush to use the `?` operator)
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#[stable(feature = "c_str_module", since = "1.88.0")]
|
#[stable(feature = "c_str_module", since = "1.88.0")]
|
||||||
pub mod c_str;
|
pub mod c_str;
|
||||||
|
|
||||||
|
mod va_list;
|
||||||
#[unstable(
|
#[unstable(
|
||||||
feature = "c_variadic",
|
feature = "c_variadic",
|
||||||
issue = "44930",
|
issue = "44930",
|
||||||
@@ -30,13 +31,6 @@
|
|||||||
)]
|
)]
|
||||||
pub use self::va_list::{VaArgSafe, VaList};
|
pub use self::va_list::{VaArgSafe, VaList};
|
||||||
|
|
||||||
#[unstable(
|
|
||||||
feature = "c_variadic",
|
|
||||||
issue = "44930",
|
|
||||||
reason = "the `c_variadic` feature has not been properly tested on all supported platforms"
|
|
||||||
)]
|
|
||||||
pub mod va_list;
|
|
||||||
|
|
||||||
mod primitives;
|
mod primitives;
|
||||||
#[stable(feature = "core_ffi_c", since = "1.64.0")]
|
#[stable(feature = "core_ffi_c", since = "1.64.0")]
|
||||||
pub use self::primitives::{
|
pub use self::primitives::{
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
//!
|
//!
|
||||||
//! Better known as "varargs".
|
//! Better known as "varargs".
|
||||||
|
|
||||||
|
#![unstable(
|
||||||
|
feature = "c_variadic",
|
||||||
|
issue = "44930",
|
||||||
|
reason = "the `c_variadic` feature has not been properly tested on all supported platforms"
|
||||||
|
)]
|
||||||
|
|
||||||
#[cfg(not(target_arch = "xtensa"))]
|
#[cfg(not(target_arch = "xtensa"))]
|
||||||
use crate::ffi::c_void;
|
use crate::ffi::c_void;
|
||||||
use crate::fmt;
|
use crate::fmt;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
issue = "none"
|
issue = "none"
|
||||||
)]
|
)]
|
||||||
|
|
||||||
use crate::ffi::va_list::{VaArgSafe, VaList};
|
use crate::ffi::{VaArgSafe, VaList};
|
||||||
use crate::marker::{ConstParamTy, DiscriminantKind, PointeeSized, Tuple};
|
use crate::marker::{ConstParamTy, DiscriminantKind, PointeeSized, Tuple};
|
||||||
use crate::{mem, ptr};
|
use crate::{mem, ptr};
|
||||||
|
|
||||||
|
|||||||
@@ -641,7 +641,8 @@ fn is_write_vectored(&self) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn flush(&mut self) -> io::Result<()> {
|
fn flush(&mut self) -> io::Result<()> {
|
||||||
self.flush_buf().and_then(|()| self.get_mut().flush())
|
self.flush_buf()?;
|
||||||
|
self.get_mut().flush()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
decl_macro,
|
decl_macro,
|
||||||
f16,
|
f16,
|
||||||
f128,
|
f128,
|
||||||
|
transparent_unions,
|
||||||
asm_experimental_arch,
|
asm_experimental_arch,
|
||||||
unboxed_closures
|
unboxed_closures
|
||||||
)]
|
)]
|
||||||
@@ -127,6 +128,25 @@ pub struct ManuallyDrop<T: PointeeSized> {
|
|||||||
}
|
}
|
||||||
impl<T: Copy + PointeeSized> Copy for ManuallyDrop<T> {}
|
impl<T: Copy + PointeeSized> Copy for ManuallyDrop<T> {}
|
||||||
|
|
||||||
|
#[lang = "maybe_uninit"]
|
||||||
|
#[repr(transparent)]
|
||||||
|
pub union MaybeUninit<T> {
|
||||||
|
uninit: (),
|
||||||
|
value: ManuallyDrop<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Copy + PointeeSized> Copy for MaybeUninit<T> {}
|
||||||
|
|
||||||
|
impl<T> MaybeUninit<T> {
|
||||||
|
pub const fn uninit() -> Self {
|
||||||
|
Self { uninit: () }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn new(value: T) -> Self {
|
||||||
|
Self { value: ManuallyDrop { value } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[rustc_nonnull_optimization_guaranteed]
|
#[rustc_nonnull_optimization_guaranteed]
|
||||||
pub struct NonNull<T: ?Sized> {
|
pub struct NonNull<T: ?Sized> {
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ struct Test {
|
|||||||
i128: extern "cmse-nonsecure-call" fn() -> i128, //~ ERROR [E0798]
|
i128: extern "cmse-nonsecure-call" fn() -> i128, //~ ERROR [E0798]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(Rust)]
|
||||||
pub union ReprCUnionU64 {
|
pub union ReprRustUnionU64 {
|
||||||
_unused: u64,
|
_unused: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(Rust)]
|
#[repr(C)]
|
||||||
pub union ReprRustUnionU64 {
|
pub union ReprCUnionU64 {
|
||||||
_unused: u64,
|
_unused: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,5 +56,11 @@ pub union ReprRustUnionU64 {
|
|||||||
pub fn test_union(
|
pub fn test_union(
|
||||||
f1: extern "cmse-nonsecure-call" fn() -> ReprRustUnionU64, //~ ERROR [E0798]
|
f1: extern "cmse-nonsecure-call" fn() -> ReprRustUnionU64, //~ ERROR [E0798]
|
||||||
f2: extern "cmse-nonsecure-call" fn() -> ReprCUnionU64, //~ ERROR [E0798]
|
f2: extern "cmse-nonsecure-call" fn() -> ReprCUnionU64, //~ ERROR [E0798]
|
||||||
|
|
||||||
|
// MaybeUninit is a transparent union, and hence MaybeUninit<u64> is abi-compatible with u64,
|
||||||
|
// and thus allowed as a return type.
|
||||||
|
f3: extern "cmse-nonsecure-call" fn() -> MaybeUninit<u32>,
|
||||||
|
f4: extern "cmse-nonsecure-call" fn() -> MaybeUninit<u64>,
|
||||||
|
f5: extern "cmse-nonsecure-call" fn() -> MaybeUninit<f64>,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,3 +45,26 @@ pub extern "cmse-nonsecure-entry" fn four(_: Four) {}
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "cmse-nonsecure-entry" fn five(_: Five) {} //~ ERROR [E0798]
|
pub extern "cmse-nonsecure-entry" fn five(_: Five) {} //~ ERROR [E0798]
|
||||||
|
|
||||||
|
#[repr(Rust)]
|
||||||
|
pub union ReprRustUnionU64 {
|
||||||
|
_unused: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub union ReprCUnionU64 {
|
||||||
|
_unused: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
#[allow(improper_ctypes_definitions)]
|
||||||
|
pub extern "cmse-nonsecure-entry" fn union_rust(_: ReprRustUnionU64) {}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "cmse-nonsecure-entry" fn union_c(_: ReprCUnionU64) {}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "cmse-nonsecure-entry" fn maybe_uninit_32bit(_: MaybeUninit<u32>) {}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "cmse-nonsecure-entry" fn maybe_uninit_64bit(_: MaybeUninit<f64>) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user