Skip to content

Commit 35e5e82

Browse files
committed
Auto merge of rust-lang#138583 - jhpratt:rollup-h699hty, r=jhpratt
Rollup of 5 pull requests Successful merges: - rust-lang#136293 (document capacity for ZST as example) - rust-lang#136359 (doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove) - rust-lang#136816 (refactor `notable_traits_button` to use iterator combinators instead of for loop) - rust-lang#138552 (Misc print request handling cleanups + a centralized test for print request stability gating) - rust-lang#138573 (Make `_Unwind_Action` a type alias, not enum) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e2c1110 + 4ac135d commit 35e5e82

File tree

5 files changed

+35
-25
lines changed

5 files changed

+35
-25
lines changed

alloc/src/vec/mod.rs

+13
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,19 @@ impl<T, A: Allocator> Vec<T, A> {
12521252
/// vec.push(42);
12531253
/// assert!(vec.capacity() >= 10);
12541254
/// ```
1255+
///
1256+
/// A vector with zero-sized elements will always have a capacity of usize::MAX:
1257+
///
1258+
/// ```
1259+
/// #[derive(Clone)]
1260+
/// struct ZeroSized;
1261+
///
1262+
/// fn main() {
1263+
/// assert_eq!(std::mem::size_of::<ZeroSized>(), 0);
1264+
/// let v = vec![ZeroSized; 0];
1265+
/// assert_eq!(v.capacity(), usize::MAX);
1266+
/// }
1267+
/// ```
12551268
#[inline]
12561269
#[stable(feature = "rust1", since = "1.0.0")]
12571270
#[rustc_const_stable(feature = "const_vec_string_slice", since = "CURRENT_RUSTC_VERSION")]

core/src/intrinsics/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -3641,7 +3641,8 @@ pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(ptr: *const
36413641
/// For regions of memory which might overlap, use [`copy`] instead.
36423642
///
36433643
/// `copy_nonoverlapping` is semantically equivalent to C's [`memcpy`], but
3644-
/// with the argument order swapped.
3644+
/// with the source and destination arguments swapped,
3645+
/// and `count` counting the number of `T`s instead of bytes.
36453646
///
36463647
/// The copy is "untyped" in the sense that data may be uninitialized or otherwise violate the
36473648
/// requirements of `T`. The initialization state is preserved exactly.
@@ -3761,8 +3762,10 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
37613762
/// If the source and destination will *never* overlap,
37623763
/// [`copy_nonoverlapping`] can be used instead.
37633764
///
3764-
/// `copy` is semantically equivalent to C's [`memmove`], but with the argument
3765-
/// order swapped. Copying takes place as if the bytes were copied from `src`
3765+
/// `copy` is semantically equivalent to C's [`memmove`], but
3766+
/// with the source and destination arguments swapped,
3767+
/// and `count` counting the number of `T`s instead of bytes.
3768+
/// Copying takes place as if the bytes were copied from `src`
37663769
/// to a temporary array and then copied from the array to `dst`.
37673770
///
37683771
/// The copy is "untyped" in the sense that data may be uninitialized or otherwise violate the

std/src/sys/personality/gcc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ cfg_if::cfg_if! {
220220
Ok(action) => action,
221221
Err(_) => return uw::_URC_FATAL_PHASE1_ERROR,
222222
};
223-
if actions as i32 & uw::_UA_SEARCH_PHASE as i32 != 0 {
223+
if actions & uw::_UA_SEARCH_PHASE != 0 {
224224
match eh_action {
225225
EHAction::None | EHAction::Cleanup(_) => uw::_URC_CONTINUE_UNWIND,
226226
EHAction::Catch(_) | EHAction::Filter(_) => uw::_URC_HANDLER_FOUND,
@@ -230,7 +230,7 @@ cfg_if::cfg_if! {
230230
match eh_action {
231231
EHAction::None => uw::_URC_CONTINUE_UNWIND,
232232
// Forced unwinding hits a terminate action.
233-
EHAction::Filter(_) if actions as i32 & uw::_UA_FORCE_UNWIND as i32 != 0 => uw::_URC_CONTINUE_UNWIND,
233+
EHAction::Filter(_) if actions & uw::_UA_FORCE_UNWIND != 0 => uw::_URC_CONTINUE_UNWIND,
234234
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => {
235235
uw::_Unwind_SetGR(
236236
context,

unwind/src/libunwind.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,13 @@ if #[cfg(any(target_vendor = "apple", target_os = "netbsd", not(target_arch = "a
128128
//
129129
// 32-bit ARM on iOS/tvOS/watchOS use either DWARF/Compact unwinding or
130130
// "setjmp-longjmp" / SjLj unwinding.
131-
#[repr(C)]
132-
#[derive(Copy, Clone, PartialEq)]
133-
pub enum _Unwind_Action {
134-
_UA_SEARCH_PHASE = 1,
135-
_UA_CLEANUP_PHASE = 2,
136-
_UA_HANDLER_FRAME = 4,
137-
_UA_FORCE_UNWIND = 8,
138-
_UA_END_OF_STACK = 16,
139-
}
140-
pub use _Unwind_Action::*;
131+
pub type _Unwind_Action = c_int;
132+
133+
pub const _UA_SEARCH_PHASE: c_int = 1;
134+
pub const _UA_CLEANUP_PHASE: c_int = 2;
135+
pub const _UA_HANDLER_FRAME: c_int = 4;
136+
pub const _UA_FORCE_UNWIND: c_int = 8;
137+
pub const _UA_END_OF_STACK: c_int = 16;
141138

142139
#[cfg_attr(
143140
all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")),

unwind/src/unwinding.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22

33
use core::ffi::{c_int, c_void};
44

5-
#[repr(C)]
6-
#[derive(Copy, Clone, PartialEq)]
7-
pub enum _Unwind_Action {
8-
_UA_SEARCH_PHASE = 1,
9-
_UA_CLEANUP_PHASE = 2,
10-
_UA_HANDLER_FRAME = 4,
11-
_UA_FORCE_UNWIND = 8,
12-
_UA_END_OF_STACK = 16,
13-
}
14-
pub use _Unwind_Action::*;
5+
pub type _Unwind_Action = c_int;
6+
7+
pub const _UA_SEARCH_PHASE: c_int = 1;
8+
pub const _UA_CLEANUP_PHASE: c_int = 2;
9+
pub const _UA_HANDLER_FRAME: c_int = 4;
10+
pub const _UA_FORCE_UNWIND: c_int = 8;
11+
pub const _UA_END_OF_STACK: c_int = 16;
1512

1613
#[repr(C)]
1714
#[derive(Debug, Copy, Clone, PartialEq)]

0 commit comments

Comments
 (0)