Spelling library/
* advance * aligned * borrowed * calculate * debugable * debuggable * declarations * desugaring * documentation * enclave * ignorable * initialized * iterator * kaboom * monomorphization * nonexistent * optimizer * panicking * process * reentrant * rustonomicon * the * uninitialized Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
parent
c6fb7b9815
commit
9cb9346005
25 changed files with 54 additions and 54 deletions
|
@ -12,7 +12,7 @@ where
|
||||||
default fn spec_from_iter(iterator: I) -> Self {
|
default fn spec_from_iter(iterator: I) -> Self {
|
||||||
// Since converting is O(1) now, just re-use the `Vec` logic for
|
// Since converting is O(1) now, just re-use the `Vec` logic for
|
||||||
// anything where we can't do something extra-special for `VecDeque`,
|
// anything where we can't do something extra-special for `VecDeque`,
|
||||||
// especially as that could save us some monomorphiziation work
|
// especially as that could save us some monomorphization work
|
||||||
// if one uses the same iterators (like slice ones) with both.
|
// if one uses the same iterators (like slice ones) with both.
|
||||||
crate::vec::Vec::from_iter(iterator).into()
|
crate::vec::Vec::from_iter(iterator).into()
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,12 +404,12 @@ impl str {
|
||||||
// See https://www.unicode.org/versions/Unicode7.0.0/ch03.pdf#G33992
|
// See https://www.unicode.org/versions/Unicode7.0.0/ch03.pdf#G33992
|
||||||
// for the definition of `Final_Sigma`.
|
// for the definition of `Final_Sigma`.
|
||||||
debug_assert!('Σ'.len_utf8() == 2);
|
debug_assert!('Σ'.len_utf8() == 2);
|
||||||
let is_word_final = case_ignoreable_then_cased(from[..i].chars().rev())
|
let is_word_final = case_ignorable_then_cased(from[..i].chars().rev())
|
||||||
&& !case_ignoreable_then_cased(from[i + 2..].chars());
|
&& !case_ignorable_then_cased(from[i + 2..].chars());
|
||||||
to.push_str(if is_word_final { "ς" } else { "σ" });
|
to.push_str(if is_word_final { "ς" } else { "σ" });
|
||||||
}
|
}
|
||||||
|
|
||||||
fn case_ignoreable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
|
fn case_ignorable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
|
||||||
use core::unicode::{Case_Ignorable, Cased};
|
use core::unicode::{Case_Ignorable, Cased};
|
||||||
match iter.skip_while(|&c| Case_Ignorable(c)).next() {
|
match iter.skip_while(|&c| Case_Ignorable(c)).next() {
|
||||||
Some(c) => Cased(c),
|
Some(c) => Cased(c),
|
||||||
|
|
|
@ -201,7 +201,7 @@ where
|
||||||
//
|
//
|
||||||
// Note: This access to the source wouldn't be allowed by the TrustedRandomIteratorNoCoerce
|
// Note: This access to the source wouldn't be allowed by the TrustedRandomIteratorNoCoerce
|
||||||
// contract (used by SpecInPlaceCollect below). But see the "O(1) collect" section in the
|
// contract (used by SpecInPlaceCollect below). But see the "O(1) collect" section in the
|
||||||
// module documenttation why this is ok anyway.
|
// module documentation why this is ok anyway.
|
||||||
let dst_guard = InPlaceDstBufDrop { ptr: dst_buf, len, cap };
|
let dst_guard = InPlaceDstBufDrop { ptr: dst_buf, len, cap };
|
||||||
src.forget_allocation_drop_remaining();
|
src.forget_allocation_drop_remaining();
|
||||||
mem::forget(dst_guard);
|
mem::forget(dst_guard);
|
||||||
|
|
|
@ -705,7 +705,7 @@ fn test_move_rev_iterator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_splitator() {
|
fn test_split_iterator() {
|
||||||
let xs = &[1, 2, 3, 4, 5];
|
let xs = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let splits: &[&[_]] = &[&[1], &[3], &[5]];
|
let splits: &[&[_]] = &[&[1], &[3], &[5]];
|
||||||
|
@ -725,7 +725,7 @@ fn test_splitator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_splitator_inclusive() {
|
fn test_split_iterator_inclusive() {
|
||||||
let xs = &[1, 2, 3, 4, 5];
|
let xs = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
|
let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
|
||||||
|
@ -745,7 +745,7 @@ fn test_splitator_inclusive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_splitator_inclusive_reverse() {
|
fn test_split_iterator_inclusive_reverse() {
|
||||||
let xs = &[1, 2, 3, 4, 5];
|
let xs = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
|
let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
|
||||||
|
@ -765,7 +765,7 @@ fn test_splitator_inclusive_reverse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_splitator_mut_inclusive() {
|
fn test_split_iterator_mut_inclusive() {
|
||||||
let xs = &mut [1, 2, 3, 4, 5];
|
let xs = &mut [1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
|
let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
|
||||||
|
@ -785,7 +785,7 @@ fn test_splitator_mut_inclusive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_splitator_mut_inclusive_reverse() {
|
fn test_split_iterator_mut_inclusive_reverse() {
|
||||||
let xs = &mut [1, 2, 3, 4, 5];
|
let xs = &mut [1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
|
let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
|
||||||
|
@ -805,7 +805,7 @@ fn test_splitator_mut_inclusive_reverse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_splitnator() {
|
fn test_splitn_iterator() {
|
||||||
let xs = &[1, 2, 3, 4, 5];
|
let xs = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
|
let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
|
||||||
|
@ -821,7 +821,7 @@ fn test_splitnator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_splitnator_mut() {
|
fn test_splitn_iterator_mut() {
|
||||||
let xs = &mut [1, 2, 3, 4, 5];
|
let xs = &mut [1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let splits: &[&mut [_]] = &[&mut [1, 2, 3, 4, 5]];
|
let splits: &[&mut [_]] = &[&mut [1, 2, 3, 4, 5]];
|
||||||
|
@ -837,7 +837,7 @@ fn test_splitnator_mut() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rsplitator() {
|
fn test_rsplit_iterator() {
|
||||||
let xs = &[1, 2, 3, 4, 5];
|
let xs = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let splits: &[&[_]] = &[&[5], &[3], &[1]];
|
let splits: &[&[_]] = &[&[5], &[3], &[1]];
|
||||||
|
@ -855,7 +855,7 @@ fn test_rsplitator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rsplitnator() {
|
fn test_rsplitn_iterator() {
|
||||||
let xs = &[1, 2, 3, 4, 5];
|
let xs = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
|
let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
|
||||||
|
@ -932,7 +932,7 @@ fn test_split_iterators_size_hint() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_windowsator() {
|
fn test_windows_iterator() {
|
||||||
let v = &[1, 2, 3, 4];
|
let v = &[1, 2, 3, 4];
|
||||||
|
|
||||||
let wins: &[&[_]] = &[&[1, 2], &[2, 3], &[3, 4]];
|
let wins: &[&[_]] = &[&[1, 2], &[2, 3], &[3, 4]];
|
||||||
|
@ -948,13 +948,13 @@ fn test_windowsator() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_windowsator_0() {
|
fn test_windows_iterator_0() {
|
||||||
let v = &[1, 2, 3, 4];
|
let v = &[1, 2, 3, 4];
|
||||||
let _it = v.windows(0);
|
let _it = v.windows(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chunksator() {
|
fn test_chunks_iterator() {
|
||||||
let v = &[1, 2, 3, 4, 5];
|
let v = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
assert_eq!(v.chunks(2).len(), 3);
|
assert_eq!(v.chunks(2).len(), 3);
|
||||||
|
@ -972,13 +972,13 @@ fn test_chunksator() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_chunksator_0() {
|
fn test_chunks_iterator_0() {
|
||||||
let v = &[1, 2, 3, 4];
|
let v = &[1, 2, 3, 4];
|
||||||
let _it = v.chunks(0);
|
let _it = v.chunks(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chunks_exactator() {
|
fn test_chunks_exact_iterator() {
|
||||||
let v = &[1, 2, 3, 4, 5];
|
let v = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
assert_eq!(v.chunks_exact(2).len(), 2);
|
assert_eq!(v.chunks_exact(2).len(), 2);
|
||||||
|
@ -996,13 +996,13 @@ fn test_chunks_exactator() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_chunks_exactator_0() {
|
fn test_chunks_exact_iterator_0() {
|
||||||
let v = &[1, 2, 3, 4];
|
let v = &[1, 2, 3, 4];
|
||||||
let _it = v.chunks_exact(0);
|
let _it = v.chunks_exact(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rchunksator() {
|
fn test_rchunks_iterator() {
|
||||||
let v = &[1, 2, 3, 4, 5];
|
let v = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
assert_eq!(v.rchunks(2).len(), 3);
|
assert_eq!(v.rchunks(2).len(), 3);
|
||||||
|
@ -1020,13 +1020,13 @@ fn test_rchunksator() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_rchunksator_0() {
|
fn test_rchunks_iterator_0() {
|
||||||
let v = &[1, 2, 3, 4];
|
let v = &[1, 2, 3, 4];
|
||||||
let _it = v.rchunks(0);
|
let _it = v.rchunks(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rchunks_exactator() {
|
fn test_rchunks_exact_iterator() {
|
||||||
let v = &[1, 2, 3, 4, 5];
|
let v = &[1, 2, 3, 4, 5];
|
||||||
|
|
||||||
assert_eq!(v.rchunks_exact(2).len(), 2);
|
assert_eq!(v.rchunks_exact(2).len(), 2);
|
||||||
|
@ -1044,7 +1044,7 @@ fn test_rchunks_exactator() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_rchunks_exactator_0() {
|
fn test_rchunks_exact_iterator_0() {
|
||||||
let v = &[1, 2, 3, 4];
|
let v = &[1, 2, 3, 4];
|
||||||
let _it = v.rchunks_exact(0);
|
let _it = v.rchunks_exact(0);
|
||||||
}
|
}
|
||||||
|
@ -1219,7 +1219,7 @@ fn test_ends_with() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mut_splitator() {
|
fn test_mut_split_iterator() {
|
||||||
let mut xs = [0, 1, 0, 2, 3, 0, 0, 4, 5, 0];
|
let mut xs = [0, 1, 0, 2, 3, 0, 0, 4, 5, 0];
|
||||||
assert_eq!(xs.split_mut(|x| *x == 0).count(), 6);
|
assert_eq!(xs.split_mut(|x| *x == 0).count(), 6);
|
||||||
for slice in xs.split_mut(|x| *x == 0) {
|
for slice in xs.split_mut(|x| *x == 0) {
|
||||||
|
@ -1235,7 +1235,7 @@ fn test_mut_splitator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mut_splitator_rev() {
|
fn test_mut_split_iterator_rev() {
|
||||||
let mut xs = [1, 2, 0, 3, 4, 0, 0, 5, 6, 0];
|
let mut xs = [1, 2, 0, 3, 4, 0, 0, 5, 6, 0];
|
||||||
for slice in xs.split_mut(|x| *x == 0).rev().take(4) {
|
for slice in xs.split_mut(|x| *x == 0).rev().take(4) {
|
||||||
slice.reverse();
|
slice.reverse();
|
||||||
|
|
|
@ -2470,7 +2470,7 @@ fn test_vec_dedup_panicking() {
|
||||||
|
|
||||||
// Regression test for issue #82533
|
// Regression test for issue #82533
|
||||||
#[test]
|
#[test]
|
||||||
fn test_extend_from_within_panicing_clone() {
|
fn test_extend_from_within_panicking_clone() {
|
||||||
struct Panic<'dc> {
|
struct Panic<'dc> {
|
||||||
drop_count: &'dc AtomicU32,
|
drop_count: &'dc AtomicU32,
|
||||||
aaaaa: bool,
|
aaaaa: bool,
|
||||||
|
|
|
@ -109,14 +109,14 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
|
||||||
/// .field("bar", &self.bar) // We add `bar` field.
|
/// .field("bar", &self.bar) // We add `bar` field.
|
||||||
/// .field("another", &self.another) // We add `another` field.
|
/// .field("another", &self.another) // We add `another` field.
|
||||||
/// // We even add a field which doesn't exist (because why not?).
|
/// // We even add a field which doesn't exist (because why not?).
|
||||||
/// .field("not_existing_field", &1)
|
/// .field("nonexistent_field", &1)
|
||||||
/// .finish() // We're good to go!
|
/// .finish() // We're good to go!
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// format!("{:?}", Bar { bar: 10, another: "Hello World".to_string() }),
|
/// format!("{:?}", Bar { bar: 10, another: "Hello World".to_string() }),
|
||||||
/// "Bar { bar: 10, another: \"Hello World\", not_existing_field: 1 }",
|
/// "Bar { bar: 10, another: \"Hello World\", nonexistent_field: 1 }",
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "debug_builders", since = "1.2.0")]
|
#[stable(feature = "debug_builders", since = "1.2.0")]
|
||||||
|
|
|
@ -2460,7 +2460,7 @@ extern "rust-intrinsic" {
|
||||||
/// This macro should be called as `assert_unsafe_precondition!([Generics](name: Type) => Expression)`
|
/// This macro should be called as `assert_unsafe_precondition!([Generics](name: Type) => Expression)`
|
||||||
/// where the names specified will be moved into the macro as captured variables, and defines an item
|
/// where the names specified will be moved into the macro as captured variables, and defines an item
|
||||||
/// to call `const_eval_select` on. The tokens inside the square brackets are used to denote generics
|
/// to call `const_eval_select` on. The tokens inside the square brackets are used to denote generics
|
||||||
/// for the function declaractions and can be omitted if there is no generics.
|
/// for the function declarations and can be omitted if there is no generics.
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
|
@ -2717,7 +2717,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
|
||||||
// SAFETY: the safety contract for `copy` must be upheld by the caller.
|
// SAFETY: the safety contract for `copy` must be upheld by the caller.
|
||||||
unsafe {
|
unsafe {
|
||||||
assert_unsafe_precondition!(
|
assert_unsafe_precondition!(
|
||||||
"ptr::copy requires that both pointer arguments are aligned aligned and non-null",
|
"ptr::copy requires that both pointer arguments are aligned and non-null",
|
||||||
[T](src: *const T, dst: *mut T) =>
|
[T](src: *const T, dst: *mut T) =>
|
||||||
is_aligned_and_not_null(src) && is_aligned_and_not_null(dst)
|
is_aligned_and_not_null(src) && is_aligned_and_not_null(dst)
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,7 +42,7 @@ the successful result of some computation, `Ok(T)`, or error types that
|
||||||
represent an anticipated runtime failure mode of that computation, `Err(E)`.
|
represent an anticipated runtime failure mode of that computation, `Err(E)`.
|
||||||
`Result` is used alongside user defined types which represent the various
|
`Result` is used alongside user defined types which represent the various
|
||||||
anticipated runtime failure modes that the associated computation could
|
anticipated runtime failure modes that the associated computation could
|
||||||
encounter. `Result` must be propagated manually, often with the the help of the
|
encounter. `Result` must be propagated manually, often with the help of the
|
||||||
`?` operator and `Try` trait, and they must be reported manually, often with
|
`?` operator and `Try` trait, and they must be reported manually, often with
|
||||||
the help of the `Error` trait.
|
the help of the `Error` trait.
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ impl<T: ?Sized> *const T {
|
||||||
let dest_addr = addr as isize;
|
let dest_addr = addr as isize;
|
||||||
let offset = dest_addr.wrapping_sub(self_addr);
|
let offset = dest_addr.wrapping_sub(self_addr);
|
||||||
|
|
||||||
// This is the canonical desugarring of this operation
|
// This is the canonical desugaring of this operation
|
||||||
self.wrapping_byte_offset(offset)
|
self.wrapping_byte_offset(offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2121,7 +2121,7 @@ mod new_fn_ptr_impl {
|
||||||
/// assert_eq!(unsafe { raw_f2.read_unaligned() }, 2);
|
/// assert_eq!(unsafe { raw_f2.read_unaligned() }, 2);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// See [`addr_of_mut`] for how to create a pointer to unininitialized data.
|
/// See [`addr_of_mut`] for how to create a pointer to uninitialized data.
|
||||||
/// Doing that with `addr_of` would not make much sense since one could only
|
/// Doing that with `addr_of` would not make much sense since one could only
|
||||||
/// read the data, and that would be Undefined Behavior.
|
/// read the data, and that would be Undefined Behavior.
|
||||||
#[stable(feature = "raw_ref_macros", since = "1.51.0")]
|
#[stable(feature = "raw_ref_macros", since = "1.51.0")]
|
||||||
|
|
|
@ -270,7 +270,7 @@ impl<T: ?Sized> *mut T {
|
||||||
let dest_addr = addr as isize;
|
let dest_addr = addr as isize;
|
||||||
let offset = dest_addr.wrapping_sub(self_addr);
|
let offset = dest_addr.wrapping_sub(self_addr);
|
||||||
|
|
||||||
// This is the canonical desugarring of this operation
|
// This is the canonical desugaring of this operation
|
||||||
self.wrapping_byte_offset(offset)
|
self.wrapping_byte_offset(offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4458,7 +4458,7 @@ impl<T, const N: usize> SlicePattern for [T; N] {
|
||||||
/// This will do `binomial(N + 1, 2) = N * (N + 1) / 2 = 0, 1, 3, 6, 10, ..`
|
/// This will do `binomial(N + 1, 2) = N * (N + 1) / 2 = 0, 1, 3, 6, 10, ..`
|
||||||
/// comparison operations.
|
/// comparison operations.
|
||||||
fn get_many_check_valid<const N: usize>(indices: &[usize; N], len: usize) -> bool {
|
fn get_many_check_valid<const N: usize>(indices: &[usize; N], len: usize) -> bool {
|
||||||
// NB: The optimzer should inline the loops into a sequence
|
// NB: The optimizer should inline the loops into a sequence
|
||||||
// of instructions without additional branching.
|
// of instructions without additional branching.
|
||||||
let mut valid = true;
|
let mut valid = true;
|
||||||
for (i, &idx) in indices.iter().enumerate() {
|
for (i, &idx) in indices.iter().enumerate() {
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct NoCopyNoDebug;
|
||||||
struct NoDebug;
|
struct NoDebug;
|
||||||
|
|
||||||
test!(
|
test!(
|
||||||
capture_with_non_copyable_and_non_debugabble_elem_has_correct_params,
|
capture_with_non_copyable_and_non_debuggable_elem_has_correct_params,
|
||||||
NoCopyNoDebug,
|
NoCopyNoDebug,
|
||||||
None,
|
None,
|
||||||
"N/A"
|
"N/A"
|
||||||
|
@ -32,6 +32,6 @@ test!(
|
||||||
|
|
||||||
test!(capture_with_non_copyable_elem_has_correct_params, NoCopy, None, "N/A");
|
test!(capture_with_non_copyable_elem_has_correct_params, NoCopy, None, "N/A");
|
||||||
|
|
||||||
test!(capture_with_non_debugabble_elem_has_correct_params, NoDebug, None, "N/A");
|
test!(capture_with_non_debuggable_elem_has_correct_params, NoDebug, None, "N/A");
|
||||||
|
|
||||||
test!(capture_with_copyable_and_debugabble_elem_has_correct_params, 1i32, Some(1i32), "1");
|
test!(capture_with_copyable_and_debuggable_elem_has_correct_params, 1i32, Some(1i32), "1");
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn once_cell() {
|
||||||
c.get_or_init(|| 92);
|
c.get_or_init(|| 92);
|
||||||
assert_eq!(c.get(), Some(&92));
|
assert_eq!(c.get(), Some(&92));
|
||||||
|
|
||||||
c.get_or_init(|| panic!("Kabom!"));
|
c.get_or_init(|| panic!("Kaboom!"));
|
||||||
assert_eq!(c.get(), Some(&92));
|
assert_eq!(c.get(), Some(&92));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ fn test_can_not_overflow() {
|
||||||
for base in 2..=36 {
|
for base in 2..=36 {
|
||||||
let num = (<$t>::MAX as u128) + 1;
|
let num = (<$t>::MAX as u128) + 1;
|
||||||
|
|
||||||
// Calcutate the string length for the smallest overflowing number:
|
// Calculate the string length for the smallest overflowing number:
|
||||||
let max_len_string = format_radix(num, base as u128);
|
let max_len_string = format_radix(num, base as u128);
|
||||||
// Ensure that string length is deemed to potentially overflow:
|
// Ensure that string length is deemed to potentially overflow:
|
||||||
assert!(can_overflow::<$t>(base, &max_len_string));
|
assert!(can_overflow::<$t>(base, &max_len_string));
|
||||||
|
|
|
@ -36,7 +36,7 @@ fn initialize_unfilled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn addvance_filled() {
|
fn advance_filled() {
|
||||||
let buf: &mut [_] = &mut [0; 16];
|
let buf: &mut [_] = &mut [0; 16];
|
||||||
let mut rbuf: BorrowedBuf<'_> = buf.into();
|
let mut rbuf: BorrowedBuf<'_> = buf.into();
|
||||||
|
|
||||||
|
|
|
@ -1925,7 +1925,7 @@ mod type_keyword {}
|
||||||
/// `unsafe_op_in_unsafe_fn` lint can be enabled to warn against that and require explicit unsafe
|
/// `unsafe_op_in_unsafe_fn` lint can be enabled to warn against that and require explicit unsafe
|
||||||
/// blocks even inside `unsafe fn`.
|
/// blocks even inside `unsafe fn`.
|
||||||
///
|
///
|
||||||
/// See the [Rustnomicon] and the [Reference] for more information.
|
/// See the [Rustonomicon] and the [Reference] for more information.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
@ -2129,7 +2129,7 @@ mod type_keyword {}
|
||||||
/// [`impl`]: keyword.impl.html
|
/// [`impl`]: keyword.impl.html
|
||||||
/// [raw pointers]: ../reference/types/pointer.html
|
/// [raw pointers]: ../reference/types/pointer.html
|
||||||
/// [memory safety]: ../book/ch19-01-unsafe-rust.html
|
/// [memory safety]: ../book/ch19-01-unsafe-rust.html
|
||||||
/// [Rustnomicon]: ../nomicon/index.html
|
/// [Rustonomicon]: ../nomicon/index.html
|
||||||
/// [nomicon-soundness]: ../nomicon/safe-unsafe-meaning.html
|
/// [nomicon-soundness]: ../nomicon/safe-unsafe-meaning.html
|
||||||
/// [soundness]: https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library
|
/// [soundness]: https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library
|
||||||
/// [Reference]: ../reference/unsafety.html
|
/// [Reference]: ../reference/unsafety.html
|
||||||
|
|
|
@ -450,7 +450,7 @@ impl AsHandle for OwnedHandle {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn as_handle(&self) -> BorrowedHandle<'_> {
|
fn as_handle(&self) -> BorrowedHandle<'_> {
|
||||||
// Safety: `OwnedHandle` and `BorrowedHandle` have the same validity
|
// Safety: `OwnedHandle` and `BorrowedHandle` have the same validity
|
||||||
// invariants, and the `BorrowdHandle` is bounded by the lifetime
|
// invariants, and the `BorrowedHandle` is bounded by the lifetime
|
||||||
// of `&self`.
|
// of `&self`.
|
||||||
unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) }
|
unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ impl AsSocket for OwnedSocket {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn as_socket(&self) -> BorrowedSocket<'_> {
|
fn as_socket(&self) -> BorrowedSocket<'_> {
|
||||||
// Safety: `OwnedSocket` and `BorrowedSocket` have the same validity
|
// Safety: `OwnedSocket` and `BorrowedSocket` have the same validity
|
||||||
// invariants, and the `BorrowdSocket` is bounded by the lifetime
|
// invariants, and the `BorrowedSocket` is bounded by the lifetime
|
||||||
// of `&self`.
|
// of `&self`.
|
||||||
unsafe { BorrowedSocket::borrow_raw(self.as_raw_socket()) }
|
unsafe { BorrowedSocket::borrow_raw(self.as_raw_socket()) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ fn sync_once_cell() {
|
||||||
assert_eq!(ONCE_CELL.get(), Some(&92));
|
assert_eq!(ONCE_CELL.get(), Some(&92));
|
||||||
});
|
});
|
||||||
|
|
||||||
ONCE_CELL.get_or_init(|| panic!("Kabom!"));
|
ONCE_CELL.get_or_init(|| panic!("Kaboom!"));
|
||||||
assert_eq!(ONCE_CELL.get(), Some(&92));
|
assert_eq!(ONCE_CELL.get(), Some(&92));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::panic::{RefUnwindSafe, UnwindSafe};
|
||||||
use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed};
|
use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed};
|
||||||
use crate::sys::locks as sys;
|
use crate::sys::locks as sys;
|
||||||
|
|
||||||
/// A re-entrant mutual exclusion
|
/// A reentrant mutual exclusion
|
||||||
///
|
///
|
||||||
/// This mutex will block *other* threads waiting for the lock to become
|
/// This mutex will block *other* threads waiting for the lock to become
|
||||||
/// available. The thread which has already locked the mutex can lock it
|
/// available. The thread which has already locked the mutex can lock it
|
||||||
|
|
|
@ -58,7 +58,7 @@ IMAGE_BASE:
|
||||||
globvar DEBUG 1
|
globvar DEBUG 1
|
||||||
/* The base address (relative to enclave start) of the enclave text section */
|
/* The base address (relative to enclave start) of the enclave text section */
|
||||||
globvar TEXT_BASE 8
|
globvar TEXT_BASE 8
|
||||||
/* The size in bytes of enclacve text section */
|
/* The size in bytes of enclave text section */
|
||||||
globvar TEXT_SIZE 8
|
globvar TEXT_SIZE 8
|
||||||
/* The base address (relative to enclave start) of the enclave .eh_frame_hdr section */
|
/* The base address (relative to enclave start) of the enclave .eh_frame_hdr section */
|
||||||
globvar EH_FRM_HDR_OFFSET 8
|
globvar EH_FRM_HDR_OFFSET 8
|
||||||
|
@ -66,7 +66,7 @@ IMAGE_BASE:
|
||||||
globvar EH_FRM_HDR_LEN 8
|
globvar EH_FRM_HDR_LEN 8
|
||||||
/* The base address (relative to enclave start) of the enclave .eh_frame section */
|
/* The base address (relative to enclave start) of the enclave .eh_frame section */
|
||||||
globvar EH_FRM_OFFSET 8
|
globvar EH_FRM_OFFSET 8
|
||||||
/* The size in bytes of enclacve .eh_frame section */
|
/* The size in bytes of enclave .eh_frame section */
|
||||||
globvar EH_FRM_LEN 8
|
globvar EH_FRM_LEN 8
|
||||||
|
|
||||||
.org .Lxsave_clear+512
|
.org .Lxsave_clear+512
|
||||||
|
|
|
@ -735,7 +735,7 @@ impl ExitStatus {
|
||||||
// true on all actual versions of Unix, is widely assumed, and is specified in SuS
|
// true on all actual versions of Unix, is widely assumed, and is specified in SuS
|
||||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
|
||||||
// true for a platform pretending to be Unix, the tests (our doctests, and also
|
// true for a platform pretending to be Unix, the tests (our doctests, and also
|
||||||
// procsss_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
|
// process_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
|
||||||
match NonZero_c_int::try_from(self.0) {
|
match NonZero_c_int::try_from(self.0) {
|
||||||
/* was nonzero */ Ok(failure) => Err(ExitStatusError(failure)),
|
/* was nonzero */ Ok(failure) => Err(ExitStatusError(failure)),
|
||||||
/* was zero, couldn't convert */ Err(_) => Ok(()),
|
/* was zero, couldn't convert */ Err(_) => Ok(()),
|
||||||
|
|
|
@ -199,7 +199,7 @@ impl ExitStatus {
|
||||||
// true on all actual versions of Unix, is widely assumed, and is specified in SuS
|
// true on all actual versions of Unix, is widely assumed, and is specified in SuS
|
||||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
|
||||||
// true for a platform pretending to be Unix, the tests (our doctests, and also
|
// true for a platform pretending to be Unix, the tests (our doctests, and also
|
||||||
// procsss_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
|
// process_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
|
||||||
match NonZero_c_int::try_from(self.0) {
|
match NonZero_c_int::try_from(self.0) {
|
||||||
Ok(failure) => Err(ExitStatusError(failure)),
|
Ok(failure) => Err(ExitStatusError(failure)),
|
||||||
Err(_) => Ok(()),
|
Err(_) => Ok(()),
|
||||||
|
|
|
@ -494,7 +494,7 @@ impl Builder {
|
||||||
MaybeDangling(mem::MaybeUninit::new(x))
|
MaybeDangling(mem::MaybeUninit::new(x))
|
||||||
}
|
}
|
||||||
fn into_inner(self) -> T {
|
fn into_inner(self) -> T {
|
||||||
// SAFETY: we are always initiailized.
|
// SAFETY: we are always initialized.
|
||||||
let ret = unsafe { self.0.assume_init_read() };
|
let ret = unsafe { self.0.assume_init_read() };
|
||||||
// Make sure we don't drop.
|
// Make sure we don't drop.
|
||||||
mem::forget(self);
|
mem::forget(self);
|
||||||
|
@ -503,7 +503,7 @@ impl Builder {
|
||||||
}
|
}
|
||||||
impl<T> Drop for MaybeDangling<T> {
|
impl<T> Drop for MaybeDangling<T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
// SAFETY: we are always initiailized.
|
// SAFETY: we are always initialized.
|
||||||
unsafe { self.0.assume_init_drop() };
|
unsafe { self.0.assume_init_drop() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue