Skip to content

Commit ca3766e

Browse files
committed
Auto merge of #64456 - Centril:rollup-ytqdwaq, r=Centril
Rollup of 17 pull requests Successful merges: - #63846 (Added table containing the system calls used by Instant and SystemTime.) - #64116 (Fix minor typo in docs.) - #64203 (A few cosmetic improvements to code & comments in liballoc and libcore) - #64302 (Shrink `ObligationCauseCode`) - #64372 (use randSecure and randABytes) - #64374 (Box `DiagnosticBuilder`.) - #64375 (Fast path for vec.clear/truncate ) - #64378 (Fix inconsistent link formatting.) - #64384 (Trim rustc-workspace-hack) - #64393 ( declare EnvKey before use to fix build error) - #64420 (Inline `mark_neighbours_as_waiting_from`.) - #64422 (Remove raw string literal quotes from error index descriptions) - #64423 (Add self to .mailmap) - #64425 (typo fix) - #64431 (fn ptr is structural match) - #64435 (codegen: use "_N" (like for other locals) instead of "argN", for argument names.) - #64439 (fix #64430, confusing `owned_box` error message in no_std build) Failed merges: r? @ghost
2 parents 4576668 + 1c7959b commit ca3766e

Some content is hidden

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

63 files changed

+663
-382
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ Neil Pankey <npankey@gmail.com> <neil@wire.im>
184184
Nick Platt <platt.nicholas@gmail.com>
185185
Nicole Mazzuca <npmazzuca@gmail.com>
186186
Nif Ward <nif.ward@gmail.com>
187+
Oliver Middleton <olliemail27@gmail.com> <ollie27@users.noreply.github.com>
187188
Oliver Scherer <oliver.schneider@kit.edu> <git-spam-no-reply9815368754983@oli-obk.de>
188189
Oliver Scherer <oliver.schneider@kit.edu> <git-spam9815368754983@oli-obk.de>
189190
Oliver Scherer <oliver.schneider@kit.edu> <github333195615777966@oli-obk.de>

Cargo.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3256,13 +3256,9 @@ version = "1.0.0"
32563256
dependencies = [
32573257
"byteorder",
32583258
"crossbeam-utils 0.6.5",
3259-
"parking_lot 0.7.1",
3260-
"rand 0.6.1",
3261-
"scopeguard 0.3.3",
32623259
"serde",
32633260
"serde_json",
32643261
"smallvec",
3265-
"syn 0.15.35",
32663262
"winapi 0.3.6",
32673263
]
32683264

src/liballoc/collections/linked_list/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ fn test_append() {
102102
assert_eq!(m.pop_front(), Some(elt))
103103
}
104104
assert_eq!(n.len(), 0);
105-
// let's make sure it's working properly, since we
106-
// did some direct changes to private members
105+
// Let's make sure it's working properly, since we
106+
// did some direct changes to private members.
107107
n.push_back(3);
108108
assert_eq!(n.len(), 1);
109109
assert_eq!(n.pop_front(), Some(3));

src/liballoc/raw_vec.rs

Lines changed: 74 additions & 76 deletions
Large diffs are not rendered by default.

src/liballoc/raw_vec/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ fn allocator_param() {
55
use crate::alloc::AllocErr;
66

77
// Writing a test of integration between third-party
8-
// allocators and RawVec is a little tricky because the RawVec
8+
// allocators and `RawVec` is a little tricky because the `RawVec`
99
// API does not expose fallible allocation methods, so we
1010
// cannot check what happens when allocator is exhausted
1111
// (beyond detecting a panic).
1212
//
13-
// Instead, this just checks that the RawVec methods do at
13+
// Instead, this just checks that the `RawVec` methods do at
1414
// least go through the Allocator API when it reserves
1515
// storage.
1616

@@ -44,7 +44,7 @@ fn allocator_param() {
4444
fn reserve_does_not_overallocate() {
4545
{
4646
let mut v: RawVec<u32> = RawVec::new();
47-
// First `reserve` allocates like `reserve_exact`
47+
// First, `reserve` allocates like `reserve_exact`.
4848
v.reserve(0, 9);
4949
assert_eq!(9, v.capacity());
5050
}

src/liballoc/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ impl<T: ?Sized> Rc<T> {
567567
/// let x = Rc::from_raw(x_ptr);
568568
/// assert_eq!(&*x, "hello");
569569
///
570-
/// // Further calls to `Rc::from_raw(x_ptr)` would be memory unsafe.
570+
/// // Further calls to `Rc::from_raw(x_ptr)` would be memory-unsafe.
571571
/// }
572572
///
573573
/// // The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!

src/liballoc/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ impl<T: ?Sized> Arc<T> {
547547
/// let x = Arc::from_raw(x_ptr);
548548
/// assert_eq!(&*x, "hello");
549549
///
550-
/// // Further calls to `Arc::from_raw(x_ptr)` would be memory unsafe.
550+
/// // Further calls to `Arc::from_raw(x_ptr)` would be memory-unsafe.
551551
/// }
552552
///
553553
/// // The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!

src/liballoc/vec.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -685,21 +685,25 @@ impl<T> Vec<T> {
685685
/// [`drain`]: #method.drain
686686
#[stable(feature = "rust1", since = "1.0.0")]
687687
pub fn truncate(&mut self, len: usize) {
688-
let current_len = self.len;
689-
unsafe {
690-
let mut ptr = self.as_mut_ptr().add(self.len);
691-
// Set the final length at the end, keeping in mind that
692-
// dropping an element might panic. Works around a missed
693-
// optimization, as seen in the following issue:
694-
// https://github.com/rust-lang/rust/issues/51802
695-
let mut local_len = SetLenOnDrop::new(&mut self.len);
688+
if mem::needs_drop::<T>() {
689+
let current_len = self.len;
690+
unsafe {
691+
let mut ptr = self.as_mut_ptr().add(self.len);
692+
// Set the final length at the end, keeping in mind that
693+
// dropping an element might panic. Works around a missed
694+
// optimization, as seen in the following issue:
695+
// https://github.com/rust-lang/rust/issues/51802
696+
let mut local_len = SetLenOnDrop::new(&mut self.len);
696697

697-
// drop any extra elements
698-
for _ in len..current_len {
699-
local_len.decrement_len(1);
700-
ptr = ptr.offset(-1);
701-
ptr::drop_in_place(ptr);
698+
// drop any extra elements
699+
for _ in len..current_len {
700+
local_len.decrement_len(1);
701+
ptr = ptr.offset(-1);
702+
ptr::drop_in_place(ptr);
703+
}
702704
}
705+
} else if len <= self.len {
706+
self.len = len;
703707
}
704708
}
705709

src/libcore/any.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ impl dyn Any {
153153
#[stable(feature = "rust1", since = "1.0.0")]
154154
#[inline]
155155
pub fn is<T: Any>(&self) -> bool {
156-
// Get TypeId of the type this function is instantiated with
156+
// Get `TypeId` of the type this function is instantiated with.
157157
let t = TypeId::of::<T>();
158158

159-
// Get TypeId of the type in the trait object
159+
// Get `TypeId` of the type in the trait object.
160160
let concrete = self.type_id();
161161

162-
// Compare both TypeIds on equality
162+
// Compare both `TypeId`s on equality.
163163
t == concrete
164164
}
165165

src/libcore/marker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,10 +602,10 @@ unsafe impl<T: ?Sized> Freeze for *mut T {}
602602
unsafe impl<T: ?Sized> Freeze for &T {}
603603
unsafe impl<T: ?Sized> Freeze for &mut T {}
604604

605-
/// Types which can be safely moved after being pinned.
605+
/// Types that can be safely moved after being pinned.
606606
///
607607
/// Since Rust itself has no notion of immovable types, and considers moves
608-
/// (e.g. through assignment or [`mem::replace`]) to always be safe,
608+
/// (e.g., through assignment or [`mem::replace`]) to always be safe,
609609
/// this trait cannot prevent types from moving by itself.
610610
///
611611
/// Instead it is used to prevent moves through the type system,

0 commit comments

Comments
 (0)