Skip to content

Commit 672a79a

Browse files
The Miri Cronjob Botgitbot
authored andcommitted
Merge from rustc
2 parents be9424d + 58f85de commit 672a79a

File tree

190 files changed

+2036
-1438
lines changed

Some content is hidden

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

190 files changed

+2036
-1438
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

alloc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2021"
1010

1111
[dependencies]
1212
core = { path = "../core" }
13-
compiler_builtins = { version = "=0.1.145", features = ['rustc-dep-of-std'] }
13+
compiler_builtins = { version = "=0.1.146", features = ['rustc-dep-of-std'] }
1414

1515
[dev-dependencies]
1616
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }

alloc/src/alloc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use core::hint;
1010
#[cfg(not(test))]
1111
use core::ptr::{self, NonNull};
1212

13-
extern "Rust" {
13+
unsafe extern "Rust" {
1414
// These are the magic symbols to call the global allocator. rustc generates
1515
// them to call `__rg_alloc` etc. if there is a `#[global_allocator]` attribute
1616
// (the code expanding that attribute macro generates those functions), or to call
@@ -355,7 +355,7 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
355355
// # Allocation error handler
356356

357357
#[cfg(not(no_global_oom_handling))]
358-
extern "Rust" {
358+
unsafe extern "Rust" {
359359
// This is the magic symbol to call the global alloc error handler. rustc generates
360360
// it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
361361
// default implementations below (`__rdl_oom`) otherwise.
@@ -426,7 +426,7 @@ pub mod __alloc_error_handler {
426426
// `#[alloc_error_handler]`.
427427
#[rustc_std_internal_symbol]
428428
pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! {
429-
extern "Rust" {
429+
unsafe extern "Rust" {
430430
// This symbol is emitted by rustc next to __rust_alloc_error_handler.
431431
// Its value depends on the -Zoom={panic,abort} compiler option.
432432
static __rust_alloc_error_handler_should_panic: u8;

alloc/src/collections/btree/merge_iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<I: Iterator> MergeIterInner<I> {
7474
b_next = self.b.next();
7575
}
7676
}
77-
if let (Some(ref a1), Some(ref b1)) = (&a_next, &b_next) {
77+
if let (Some(a1), Some(b1)) = (&a_next, &b_next) {
7878
match cmp(a1, b1) {
7979
Ordering::Less => self.peeked = b_next.take().map(Peeked::B),
8080
Ordering::Greater => self.peeked = a_next.take().map(Peeked::A),

alloc/src/collections/btree/set/tests.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,11 @@ fn test_difference() {
132132
check_difference(&[1, 3, 5, 9, 11], &[3, 6, 9], &[1, 5, 11]);
133133
check_difference(&[1, 3, 5, 9, 11], &[0, 1], &[3, 5, 9, 11]);
134134
check_difference(&[1, 3, 5, 9, 11], &[11, 12], &[1, 3, 5, 9]);
135-
check_difference(&[-5, 11, 22, 33, 40, 42], &[-12, -5, 14, 23, 34, 38, 39, 50], &[
136-
11, 22, 33, 40, 42,
137-
]);
135+
check_difference(
136+
&[-5, 11, 22, 33, 40, 42],
137+
&[-12, -5, 14, 23, 34, 38, 39, 50],
138+
&[11, 22, 33, 40, 42],
139+
);
138140

139141
if cfg!(miri) {
140142
// Miri is too slow
@@ -250,9 +252,11 @@ fn test_union() {
250252
check_union(&[], &[], &[]);
251253
check_union(&[1, 2, 3], &[2], &[1, 2, 3]);
252254
check_union(&[2], &[1, 2, 3], &[1, 2, 3]);
253-
check_union(&[1, 3, 5, 9, 11, 16, 19, 24], &[-2, 1, 5, 9, 13, 19], &[
254-
-2, 1, 3, 5, 9, 11, 13, 16, 19, 24,
255-
]);
255+
check_union(
256+
&[1, 3, 5, 9, 11, 16, 19, 24],
257+
&[-2, 1, 5, 9, 13, 19],
258+
&[-2, 1, 3, 5, 9, 11, 13, 16, 19, 24],
259+
);
256260
}
257261

258262
#[test]

alloc/src/collections/linked_list/tests.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,10 @@ fn test_cursor_mut_insert() {
696696
cursor.splice_after(p);
697697
cursor.splice_before(q);
698698
check_links(&m);
699-
assert_eq!(m.iter().cloned().collect::<Vec<_>>(), &[
700-
200, 201, 202, 203, 1, 100, 101, 102, 103, 8, 2, 3, 4, 5, 6
701-
]);
699+
assert_eq!(
700+
m.iter().cloned().collect::<Vec<_>>(),
701+
&[200, 201, 202, 203, 1, 100, 101, 102, 103, 8, 2, 3, 4, 5, 6]
702+
);
702703
let mut cursor = m.cursor_front_mut();
703704
cursor.move_prev();
704705
let tmp = cursor.split_before();
@@ -915,9 +916,10 @@ fn extract_if_complex() {
915916
assert_eq!(removed, vec![2, 4, 6, 18, 20, 22, 24, 26, 34, 36]);
916917

917918
assert_eq!(list.len(), 14);
918-
assert_eq!(list.into_iter().collect::<Vec<_>>(), vec![
919-
1, 7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39
920-
]);
919+
assert_eq!(
920+
list.into_iter().collect::<Vec<_>>(),
921+
vec![1, 7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39]
922+
);
921923
}
922924

923925
{
@@ -932,9 +934,10 @@ fn extract_if_complex() {
932934
assert_eq!(removed, vec![2, 4, 6, 18, 20, 22, 24, 26, 34, 36]);
933935

934936
assert_eq!(list.len(), 13);
935-
assert_eq!(list.into_iter().collect::<Vec<_>>(), vec![
936-
7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39
937-
]);
937+
assert_eq!(
938+
list.into_iter().collect::<Vec<_>>(),
939+
vec![7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39]
940+
);
938941
}
939942

940943
{
@@ -949,9 +952,10 @@ fn extract_if_complex() {
949952
assert_eq!(removed, vec![2, 4, 6, 18, 20, 22, 24, 26, 34, 36]);
950953

951954
assert_eq!(list.len(), 11);
952-
assert_eq!(list.into_iter().collect::<Vec<_>>(), vec![
953-
7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35
954-
]);
955+
assert_eq!(
956+
list.into_iter().collect::<Vec<_>>(),
957+
vec![7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35]
958+
);
955959
}
956960

957961
{

alloc/src/collections/vec_deque/tests.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,10 @@ fn make_contiguous_head_to_end() {
562562
tester.push_front(i as char);
563563
}
564564

565-
assert_eq!(tester, [
566-
'P', 'O', 'N', 'M', 'L', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'
567-
]);
565+
assert_eq!(
566+
tester,
567+
['P', 'O', 'N', 'M', 'L', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K']
568+
);
568569

569570
// ABCDEFGHIJKPONML
570571
let expected_start = 0;

alloc/src/ffi/c_str.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ impl CString {
397397
// information about the size of the allocation is correct on Rust's
398398
// side.
399399
unsafe {
400-
extern "C" {
400+
unsafe extern "C" {
401401
/// Provided by libc or compiler_builtins.
402402
fn strlen(s: *const c_char) -> usize;
403403
}
@@ -965,8 +965,9 @@ impl Default for Rc<CStr> {
965965
/// This may or may not share an allocation with other Rcs on the same thread.
966966
#[inline]
967967
fn default() -> Self {
968-
let c_str: &CStr = Default::default();
969-
Rc::from(c_str)
968+
let rc = Rc::<[u8]>::from(*b"\0");
969+
// `[u8]` has the same layout as `CStr`, and it is `NUL` terminated.
970+
unsafe { Rc::from_raw(Rc::into_raw(rc) as *const CStr) }
970971
}
971972
}
972973

alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156
#![feature(unicode_internals)]
157157
#![feature(unsize)]
158158
#![feature(unwrap_infallible)]
159-
#![feature(vec_pop_if)]
160159
// tidy-alphabetical-end
161160
//
162161
// Language features:

alloc/src/rc.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,18 +1462,18 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
14621462
/// Provides a raw pointer to the data.
14631463
///
14641464
/// The counts are not affected in any way and the `Rc` is not consumed. The pointer is valid
1465-
/// for as long there are strong counts in the `Rc`.
1465+
/// for as long as there are strong counts in the `Rc`.
14661466
///
14671467
/// # Examples
14681468
///
14691469
/// ```
14701470
/// use std::rc::Rc;
14711471
///
1472-
/// let x = Rc::new("hello".to_owned());
1472+
/// let x = Rc::new(0);
14731473
/// let y = Rc::clone(&x);
14741474
/// let x_ptr = Rc::as_ptr(&x);
14751475
/// assert_eq!(x_ptr, Rc::as_ptr(&y));
1476-
/// assert_eq!(unsafe { &*x_ptr }, "hello");
1476+
/// assert_eq!(unsafe { *x_ptr }, 0);
14771477
/// ```
14781478
#[stable(feature = "weak_into_raw", since = "1.45.0")]
14791479
#[rustc_never_returns_null_ptr]
@@ -2350,11 +2350,10 @@ impl<T: Default> Default for Rc<T> {
23502350
fn default() -> Rc<T> {
23512351
unsafe {
23522352
Self::from_inner(
2353-
Box::leak(Box::write(Box::new_uninit(), RcInner {
2354-
strong: Cell::new(1),
2355-
weak: Cell::new(1),
2356-
value: T::default(),
2357-
}))
2353+
Box::leak(Box::write(
2354+
Box::new_uninit(),
2355+
RcInner { strong: Cell::new(1), weak: Cell::new(1), value: T::default() },
2356+
))
23582357
.into(),
23592358
)
23602359
}
@@ -2369,7 +2368,9 @@ impl Default for Rc<str> {
23692368
/// This may or may not share an allocation with other Rcs on the same thread.
23702369
#[inline]
23712370
fn default() -> Self {
2372-
Rc::from("")
2371+
let rc = Rc::<[u8]>::default();
2372+
// `[u8]` has the same layout as `str`.
2373+
unsafe { Rc::from_raw(Rc::into_raw(rc) as *const str) }
23732374
}
23742375
}
23752376

0 commit comments

Comments
 (0)