Skip to content

Commit 7a76fe7

Browse files
committed
Auto merge of #66175 - JohnTitor:rollup-ihqk5vn, r=JohnTitor
Rollup of 12 pull requests Successful merges: - #65794 (gate rustc_on_unimplemented under rustc_attrs) - #65945 (Optimize long-linker-command-line test) - #66044 (Improve uninit/zeroed lint) - #66076 (HIR docs: mention how to resolve method paths) - #66084 (Do not require extra LLVM backends for `x.py test` to pass) - #66111 (improve from_raw_parts docs) - #66114 (Improve std::thread::Result documentation) - #66117 (Fixed PhantomData markers in Arc and Rc) - #66146 (Remove unused parameters in `__thread_local_inner`) - #66147 (Miri: Refactor to_scalar_ptr out of existence) - #66162 (Fix broken link in README) - #66171 (Update link on CONTRIBUTING.md) Failed merges: r? @ghost
2 parents caf0187 + b59d166 commit 7a76fe7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+318
-335
lines changed

Diff for: CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ contributions to the compiler and the standard library. It also lists some
105105
really useful commands to the build system (`./x.py`), which could save you a
106106
lot of time.
107107

108-
[rustcguidebuild]: https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html
108+
[rustcguidebuild]: https://rust-lang.github.io/rustc-guide/building/how-to-build-and-run.html
109109

110110
## Pull Requests
111111
[pull-requests]: #pull-requests

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The Rust build system has a Python script called `x.py` to bootstrap building
2121
the compiler. More information about it may be found by running `./x.py --help`
2222
or reading the [rustc guide][rustcguidebuild].
2323

24-
[rustcguidebuild]: https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html
24+
[rustcguidebuild]: https://rust-lang.github.io/rustc-guide/building/how-to-build-and-run.html
2525

2626
### Building on *nix
2727
1. Make sure you have installed the dependencies:

Diff for: src/doc/unstable-book/src/language-features/on-unimplemented.md

-154
This file was deleted.

Diff for: src/liballoc/collections/linked_list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<T> Clone for Iter<'_, T> {
9090
#[stable(feature = "rust1", since = "1.0.0")]
9191
pub struct IterMut<'a, T: 'a> {
9292
// We do *not* exclusively own the entire list here, references to node's `element`
93-
// have been handed out by the iterator! So be careful when using this; the methods
93+
// have been handed out by the iterator! So be careful when using this; the methods
9494
// called must be aware that there can be aliasing pointers to `element`.
9595
list: &'a mut LinkedList<T>,
9696
head: Option<NonNull<Node<T>>>,

Diff for: src/liballoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
#![feature(unsize)]
117117
#![feature(unsized_locals)]
118118
#![feature(allocator_internals)]
119-
#![feature(on_unimplemented)]
119+
#![cfg_attr(bootstrap, feature(on_unimplemented))]
120120
#![feature(rustc_const_unstable)]
121121
#![feature(slice_partition_dedup)]
122122
#![feature(maybe_uninit_extra, maybe_uninit_slice)]

Diff for: src/liballoc/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ struct RcBox<T: ?Sized> {
280280
#[stable(feature = "rust1", since = "1.0.0")]
281281
pub struct Rc<T: ?Sized> {
282282
ptr: NonNull<RcBox<T>>,
283-
phantom: PhantomData<T>,
283+
phantom: PhantomData<RcBox<T>>,
284284
}
285285

286286
#[stable(feature = "rust1", since = "1.0.0")]

Diff for: src/liballoc/string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ impl String {
687687
/// checked:
688688
///
689689
/// * The memory at `ptr` needs to have been previously allocated by the
690-
/// same allocator the standard library uses.
690+
/// same allocator the standard library uses, with a required alignment of exactly 1.
691691
/// * `length` needs to be less than or equal to `capacity`.
692692
/// * `capacity` needs to be the correct value.
693693
///

Diff for: src/liballoc/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
195195
#[stable(feature = "rust1", since = "1.0.0")]
196196
pub struct Arc<T: ?Sized> {
197197
ptr: NonNull<ArcInner<T>>,
198-
phantom: PhantomData<T>,
198+
phantom: PhantomData<ArcInner<T>>,
199199
}
200200

201201
#[stable(feature = "rust1", since = "1.0.0")]

Diff for: src/libcore/cell.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@
137137
//! use std::cell::Cell;
138138
//! use std::ptr::NonNull;
139139
//! use std::intrinsics::abort;
140+
//! use std::marker::PhantomData;
140141
//!
141142
//! struct Rc<T: ?Sized> {
142-
//! ptr: NonNull<RcBox<T>>
143+
//! ptr: NonNull<RcBox<T>>,
144+
//! phantom: PhantomData<RcBox<T>>,
143145
//! }
144146
//!
145147
//! struct RcBox<T: ?Sized> {
@@ -151,7 +153,10 @@
151153
//! impl<T: ?Sized> Clone for Rc<T> {
152154
//! fn clone(&self) -> Rc<T> {
153155
//! self.inc_strong();
154-
//! Rc { ptr: self.ptr }
156+
//! Rc {
157+
//! ptr: self.ptr,
158+
//! phantom: PhantomData,
159+
//! }
155160
//! }
156161
//! }
157162
//!

Diff for: src/libcore/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
#![feature(nll)]
9090
#![feature(exhaustive_patterns)]
9191
#![feature(no_core)]
92-
#![feature(on_unimplemented)]
92+
#![cfg_attr(bootstrap, feature(on_unimplemented))]
9393
#![feature(optin_builtin_traits)]
9494
#![feature(prelude_import)]
9595
#![feature(repr_simd, platform_intrinsics)]

Diff for: src/libcore/mem/maybe_uninit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ impl<T> MaybeUninit<T> {
440440
/// ```
441441
#[stable(feature = "maybe_uninit", since = "1.36.0")]
442442
#[inline(always)]
443+
#[cfg_attr(all(not(bootstrap)), rustc_diagnostic_item = "assume_init")]
443444
pub unsafe fn assume_init(self) -> T {
444445
intrinsics::panic_if_uninhabited::<T>();
445446
ManuallyDrop::into_inner(self.value)

Diff for: src/libcore/ptr/mod.rs

+18-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
//! * A [null] pointer is *never* valid, not even for accesses of [size zero][zst].
1919
//! * All pointers (except for the null pointer) are valid for all operations of
2020
//! [size zero][zst].
21+
//! * For a pointer to be valid, it is necessary, but not always sufficient, that the pointer
22+
//! be *dereferencable*: the memory range of the given size starting at the pointer must all be
23+
//! within the bounds of a single allocated object. Note that in Rust,
24+
//! every (stack-allocated) variable is considered a separate allocated object.
2125
//! * All accesses performed by functions in this module are *non-atomic* in the sense
2226
//! of [atomic operations] used to synchronize between threads. This means it is
2327
//! undefined behavior to perform two concurrent accesses to the same location from different
@@ -221,10 +225,15 @@ pub(crate) struct FatPtr<T> {
221225
pub(crate) len: usize,
222226
}
223227

224-
/// Forms a slice from a pointer and a length.
228+
/// Forms a raw slice from a pointer and a length.
225229
///
226230
/// The `len` argument is the number of **elements**, not the number of bytes.
227231
///
232+
/// This function is safe, but actually using the return value is unsafe.
233+
/// See the documentation of [`from_raw_parts`] for slice safety requirements.
234+
///
235+
/// [`from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html
236+
///
228237
/// # Examples
229238
///
230239
/// ```rust
@@ -243,12 +252,16 @@ pub fn slice_from_raw_parts<T>(data: *const T, len: usize) -> *const [T] {
243252
unsafe { Repr { raw: FatPtr { data, len } }.rust }
244253
}
245254

246-
/// Performs the same functionality as [`from_raw_parts`], except that a
247-
/// mutable slice is returned.
255+
/// Performs the same functionality as [`slice_from_raw_parts`], except that a
256+
/// raw mutable slice is returned, as opposed to a raw immutable slice.
248257
///
249-
/// See the documentation of [`from_raw_parts`] for more details.
258+
/// See the documentation of [`slice_from_raw_parts`] for more details.
250259
///
251-
/// [`from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html
260+
/// This function is safe, but actually using the return value is unsafe.
261+
/// See the documentation of [`from_raw_parts_mut`] for slice safety requirements.
262+
///
263+
/// [`slice_from_raw_parts`]: fn.slice_from_raw_parts.html
264+
/// [`from_raw_parts_mut`]: ../../std/slice/fn.from_raw_parts_mut.html
252265
#[inline]
253266
#[unstable(feature = "slice_from_raw_parts", reason = "recently added", issue = "36925")]
254267
pub fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T] {

0 commit comments

Comments
 (0)