Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/alloc/src/collections/btree/map/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl<'a, K: Ord, V, A: Allocator + Clone> VacantEntry<'a, K, V, A> {
// SAFETY: There is no tree yet so no reference to it exists.
let map = unsafe { self.dormant_map.awaken() };
let mut root = NodeRef::new_leaf(self.alloc.clone());
let val_ptr = root.borrow_mut().push(self.key, value) as *mut V;
let val_ptr = root.borrow_mut().push(self.key, value);
map.root = Some(root.forget_type());
map.length = 1;
val_ptr
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ impl CString {
fn strlen(s: *const c_char) -> usize;
}
let len = strlen(ptr) + 1; // Including the NUL byte
let slice = slice::from_raw_parts_mut(ptr, len as usize);
let slice = slice::from_raw_parts_mut(ptr, len);
CString { inner: Box::from_raw(slice as *mut [c_char] as *mut [u8]) }
}
}
Expand Down
8 changes: 4 additions & 4 deletions library/alloc/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,9 @@ impl<T> [T] {
while m > 0 {
// `buf.extend(buf)`:
unsafe {
ptr::copy_nonoverlapping(
ptr::copy_nonoverlapping::<T>(
buf.as_ptr(),
(buf.as_mut_ptr() as *mut T).add(buf.len()),
(buf.as_mut_ptr()).add(buf.len()),
Comment on lines -514 to +516
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turbofish required here, otherwise

error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
   --> library\alloc\src\slice.rs:516:44
    |
516 |                         (buf.as_mut_ptr()).add(buf.len()),
    |                                            ^^^

error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
   --> library\alloc\src\slice.rs:535:75
    |
535 |                 ptr::copy_nonoverlapping(buf.as_ptr(), (buf.as_mut_ptr()).add(buf.len()), rem_len);
    | 

buf.len(),
);
// `buf` has capacity of `self.len() * n`.
Expand All @@ -532,9 +532,9 @@ impl<T> [T] {
// `buf.extend(buf[0 .. rem_len])`:
unsafe {
// This is non-overlapping since `2^expn > rem`.
ptr::copy_nonoverlapping(
ptr::copy_nonoverlapping::<T>(
buf.as_ptr(),
(buf.as_mut_ptr() as *mut T).add(buf.len()),
(buf.as_mut_ptr()).add(buf.len()),
rem_len,
);
// `buf.len() + rem_len` equals to `buf.capacity()` (`= self.len() * n`).
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker {
unsafe fn clone_waker<W: Wake + Send + Sync + 'static>(waker: *const ()) -> RawWaker {
unsafe { Arc::increment_strong_count(waker as *const W) };
RawWaker::new(
waker as *const (),
waker,
&RawWakerVTable::new(clone_waker::<W>, wake::<W>, wake_by_ref::<W>, drop_waker::<W>),
)
}
Expand Down Expand Up @@ -320,7 +320,7 @@ fn local_raw_waker<W: LocalWake + 'static>(waker: Rc<W>) -> RawWaker {
unsafe fn clone_waker<W: LocalWake + 'static>(waker: *const ()) -> RawWaker {
unsafe { Rc::increment_strong_count(waker as *const W) };
RawWaker::new(
waker as *const (),
waker,
&RawWakerVTable::new(clone_waker::<W>, wake::<W>, wake_by_ref::<W>, drop_waker::<W>),
)
}
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys_common/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ where
pub fn sockaddr_to_addr(storage: &c::sockaddr_storage, len: usize) -> io::Result<SocketAddr> {
match storage.ss_family as c_int {
c::AF_INET => {
assert!(len as usize >= mem::size_of::<c::sockaddr_in>());
assert!(len >= mem::size_of::<c::sockaddr_in>());
Ok(SocketAddr::V4(FromInner::from_inner(unsafe {
*(storage as *const _ as *const c::sockaddr_in)
})))
}
c::AF_INET6 => {
assert!(len as usize >= mem::size_of::<c::sockaddr_in6>());
assert!(len >= mem::size_of::<c::sockaddr_in6>());
Ok(SocketAddr::V6(FromInner::from_inner(unsafe {
*(storage as *const _ as *const c::sockaddr_in6)
})))
Expand Down