Skip to content

Commit a31a781

Browse files
committed
Auto merge of rust-lang#141050 - matthiaskrgr:rollup-uyzqbmj, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#139749 (docs(library/core/src/pin): fix typo "necessarily" -> "necessary") - rust-lang#140685 (Simplify `Vec::as_non_null` implementation and make it `const`) - rust-lang#140712 (normalization: avoid incompletely constraining GAT args) - rust-lang#140768 (Improve `dangerous_implicit_aurorefs` diagnostic output) - rust-lang#140947 (Flush errors before deep normalize in `dropck_outlives`) - rust-lang#140990 (VxWorks: updates from recent libc versions) - rust-lang#141027 (remove `RustfmtState` to reduce `initial_rustfmt` complexity) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d703306 + a62cba7 commit a31a781

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

alloc/src/raw_vec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl<T, A: Allocator> RawVec<T, A> {
287287
}
288288

289289
#[inline]
290-
pub(crate) fn non_null(&self) -> NonNull<T> {
290+
pub(crate) const fn non_null(&self) -> NonNull<T> {
291291
self.inner.non_null()
292292
}
293293

alloc/src/vec/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,10 +1816,10 @@ impl<T, A: Allocator> Vec<T, A> {
18161816
/// [`as_ptr`]: Vec::as_ptr
18171817
/// [`as_non_null`]: Vec::as_non_null
18181818
#[unstable(feature = "box_vec_non_null", reason = "new API", issue = "130364")]
1819+
#[rustc_const_unstable(feature = "box_vec_non_null", reason = "new API", issue = "130364")]
18191820
#[inline]
1820-
pub fn as_non_null(&mut self) -> NonNull<T> {
1821-
// SAFETY: A `Vec` always has a non-null pointer.
1822-
unsafe { NonNull::new_unchecked(self.as_mut_ptr()) }
1821+
pub const fn as_non_null(&mut self) -> NonNull<T> {
1822+
self.buf.non_null()
18231823
}
18241824

18251825
/// Returns a reference to the underlying allocator.

core/src/pin.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
//! "pinned," in that it has been permanently (until the end of its lifespan) attached to its
1313
//! location in memory, as though pinned to a pinboard. Pinning a value is an incredibly useful
1414
//! building block for [`unsafe`] code to be able to reason about whether a raw pointer to the
15-
//! pinned value is still valid. [As we'll see later][drop-guarantee], this is necessarily from the
16-
//! time the value is first pinned until the end of its lifespan. This concept of "pinning" is
17-
//! necessary to implement safe interfaces on top of things like self-referential types and
18-
//! intrusive data structures which cannot currently be modeled in fully safe Rust using only
19-
//! borrow-checked [references][reference].
15+
//! pinned value is still valid. [As we'll see later][drop-guarantee], once a value is pinned,
16+
//! it is necessarily valid at its memory location until the end of its lifespan. This concept
17+
//! of "pinning" is necessary to implement safe interfaces on top of things like self-referential
18+
//! types and intrusive data structures which cannot currently be modeled in fully safe Rust using
19+
//! only borrow-checked [references][reference].
2020
//!
2121
//! "Pinning" allows us to put a *value* which exists at some location in memory into a state where
2222
//! safe code cannot *move* that value to a different location in memory or otherwise invalidate it

std/src/sys/fs/unix.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,11 +1498,10 @@ impl File {
14981498
None => Ok(libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }),
14991499
};
15001500
cfg_if::cfg_if! {
1501-
if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon", target_os = "vxworks", target_os = "nuttx"))] {
1501+
if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon", target_os = "nuttx"))] {
15021502
// Redox doesn't appear to support `UTIME_OMIT`.
15031503
// ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
15041504
// the same as for Redox.
1505-
// `futimens` and `UTIME_OMIT` are a work in progress for vxworks.
15061505
let _ = times;
15071506
Err(io::const_error!(
15081507
io::ErrorKind::Unsupported,

std/src/sys/pal/unix/thread.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,8 @@ impl Thread {
222222

223223
#[cfg(target_os = "vxworks")]
224224
pub fn set_name(name: &CStr) {
225-
// FIXME(libc): adding real STATUS, ERROR type eventually.
226-
unsafe extern "C" {
227-
fn taskNameSet(task_id: libc::TASK_ID, task_name: *mut libc::c_char) -> libc::c_int;
228-
}
229-
230-
// VX_TASK_NAME_LEN is 31 in VxWorks 7.
231-
const VX_TASK_NAME_LEN: usize = 31;
232-
233-
let mut name = truncate_cstr::<{ VX_TASK_NAME_LEN }>(name);
234-
let res = unsafe { taskNameSet(libc::taskIdSelf(), name.as_mut_ptr()) };
225+
let mut name = truncate_cstr::<{ libc::VX_TASK_RENAME_LENGTH - 1 }>(name);
226+
let res = unsafe { libc::taskNameSet(libc::taskIdSelf(), name.as_mut_ptr()) };
235227
debug_assert_eq!(res, libc::OK);
236228
}
237229

0 commit comments

Comments
 (0)