This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
library/std/src/sys/pal/windows Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
- #![allow(unsafe_op_in_unsafe_fn)]
2
1
use crate::os::windows::prelude::*;
3
2
4
3
use crate::ffi::OsStr;
@@ -325,6 +324,7 @@ impl AnonPipe {
325
324
/// [`ReadFileEx`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfileex
326
325
/// [`WriteFileEx`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-writefileex
327
326
/// [Asynchronous Procedure Call]: https://docs.microsoft.com/en-us/windows/win32/sync/asynchronous-procedure-calls
327
+ #[allow(unsafe_op_in_unsafe_fn)]
328
328
unsafe fn alertable_io_internal(
329
329
&self,
330
330
io: AlertableIoFn,
@@ -561,12 +561,14 @@ impl<'a> Drop for AsyncPipe<'a> {
561
561
}
562
562
}
563
563
564
+ #[allow(unsafe_op_in_unsafe_fn)]
564
565
unsafe fn slice_to_end(v: &mut Vec<u8>) -> &mut [u8] {
565
566
if v.capacity() == 0 {
566
567
v.reserve(16);
567
568
}
568
569
if v.capacity() == v.len() {
569
570
v.reserve(1);
570
571
}
572
+ // FIXME: Isn't this just spare_capacity_mut but worse?
571
573
slice::from_raw_parts_mut(v.as_mut_ptr().add(v.len()), v.capacity() - v.len())
572
574
}
Original file line number Diff line number Diff line change 1
- #![allow(unsafe_op_in_unsafe_fn)]
2
1
use crate::ffi::CStr;
3
2
use crate::io;
4
3
use crate::num::NonZero;
@@ -23,6 +22,8 @@ pub struct Thread {
23
22
24
23
impl Thread {
25
24
// unsafe: see thread::Builder::spawn_unchecked for safety requirements
25
+ #[allow(unsafe_op_in_unsafe_fn)]
26
+ // FIXME: check the internal safety
26
27
pub unsafe fn new(stack: usize, p: Box<dyn FnOnce()>) -> io::Result<Thread> {
27
28
let p = Box::into_raw(Box::new(p));
28
29
@@ -70,7 +71,7 @@ impl Thread {
70
71
///
71
72
/// `name` must end with a zero value
72
73
pub unsafe fn set_name_wide(name: &[u16]) {
73
- c::SetThreadDescription(c::GetCurrentThread(), name.as_ptr());
74
+ unsafe { c::SetThreadDescription(c::GetCurrentThread(), name.as_ptr()) } ;
74
75
}
75
76
76
77
pub fn join(self) {
You can’t perform that action at this time.
0 commit comments