Skip to content

Commit aa2a5bf

Browse files
committed
move the va_copy, va_arg and va_end to core::intrinsics
1 parent 6268d0a commit aa2a5bf

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

library/core/src/ffi/va_list.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use crate::ffi::c_void;
66
#[allow(unused_imports)]
77
use crate::fmt;
8+
use crate::intrinsics::va_list::{va_arg, va_copy, va_end};
89
use crate::marker::{PhantomData, PhantomInvariantLifetime};
910
use crate::ops::{Deref, DerefMut};
1011

@@ -280,20 +281,3 @@ impl<'f> Drop for VaListImpl<'f> {
280281
// This works for now, since `va_end` is a no-op on all current LLVM targets.
281282
}
282283
}
283-
284-
/// Destroy the arglist `ap` after initialization with `va_start` or
285-
/// `va_copy`.
286-
#[rustc_intrinsic]
287-
#[rustc_nounwind]
288-
unsafe fn va_end(ap: &mut VaListImpl<'_>);
289-
290-
/// Copies the current location of arglist `src` to the arglist `dst`.
291-
#[rustc_intrinsic]
292-
#[rustc_nounwind]
293-
unsafe fn va_copy<'f>(dest: *mut VaListImpl<'f>, src: &VaListImpl<'f>);
294-
295-
/// Loads an argument of type `T` from the `va_list` `ap` and increment the
296-
/// argument `ap` points to.
297-
#[rustc_intrinsic]
298-
#[rustc_nounwind]
299-
unsafe fn va_arg<T: VaArgSafe>(ap: &mut VaListImpl<'_>) -> T;

library/core/src/intrinsics/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ mod bounds;
6161
pub mod fallback;
6262
pub mod mir;
6363
pub mod simd;
64+
pub(crate) mod va_list;
6465

6566
// These imports are used for simplifying intra-doc links
6667
#[allow(unused_imports)]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use crate::ffi::va_list::{VaArgSafe, VaListImpl};
2+
3+
/// Copies the current location of arglist `src` to the arglist `dst`.
4+
#[rustc_intrinsic]
5+
#[rustc_nounwind]
6+
pub(crate) unsafe fn va_copy<'f>(dest: *mut VaListImpl<'f>, src: &VaListImpl<'f>);
7+
8+
/// Loads an argument of type `T` from the `va_list` `ap` and increment the
9+
/// argument `ap` points to.
10+
#[rustc_intrinsic]
11+
#[rustc_nounwind]
12+
pub(crate) unsafe fn va_arg<T: VaArgSafe>(ap: &mut VaListImpl<'_>) -> T;
13+
14+
/// Destroy the arglist `ap` after initialization with `va_start` or `va_copy`.
15+
#[rustc_intrinsic]
16+
#[rustc_nounwind]
17+
pub(crate) unsafe fn va_end(ap: &mut VaListImpl<'_>);

0 commit comments

Comments
 (0)