Skip to content

Commit 3890690

Browse files
The rustc-dev-guide Cronjob Botgitbot
The rustc-dev-guide Cronjob Bot
authored and
gitbot
committed
Merge from rustc
2 parents d57627f + 8b1cc57 commit 3890690

File tree

178 files changed

+2424
-2539
lines changed

Some content is hidden

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

178 files changed

+2424
-2539
lines changed

Diff for: Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: alloc/Cargo.toml

+1-1
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.143", features = ['rustc-dep-of-std'] }
13+
compiler_builtins = { version = "=0.1.145", features = ['rustc-dep-of-std'] }
1414

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

Diff for: alloc/src/collections/btree/set/tests.rs

+10-6
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]

Diff for: alloc/src/collections/linked_list/tests.rs

+16-12
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
{

Diff for: alloc/src/collections/vec_deque/tests.rs

+4-3
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;

Diff for: alloc/src/ffi/c_str.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -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

Diff for: alloc/src/rc.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -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

Diff for: alloc/src/sync.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -3466,11 +3466,14 @@ impl<T: Default> Default for Arc<T> {
34663466
fn default() -> Arc<T> {
34673467
unsafe {
34683468
Self::from_inner(
3469-
Box::leak(Box::write(Box::new_uninit(), ArcInner {
3470-
strong: atomic::AtomicUsize::new(1),
3471-
weak: atomic::AtomicUsize::new(1),
3472-
data: T::default(),
3473-
}))
3469+
Box::leak(Box::write(
3470+
Box::new_uninit(),
3471+
ArcInner {
3472+
strong: atomic::AtomicUsize::new(1),
3473+
weak: atomic::AtomicUsize::new(1),
3474+
data: T::default(),
3475+
},
3476+
))
34743477
.into(),
34753478
)
34763479
}

Diff for: alloc/tests/str.rs

+99-88
Original file line numberDiff line numberDiff line change
@@ -1524,18 +1524,14 @@ fn test_lines() {
15241524
t("bare\r", &["bare\r"]);
15251525
t("bare\rcr", &["bare\rcr"]);
15261526
t("Text\n\r", &["Text", "\r"]);
1527-
t("\nMäry häd ä little lämb\n\r\nLittle lämb\n", &[
1528-
"",
1529-
"Märy häd ä little lämb",
1530-
"",
1531-
"Little lämb",
1532-
]);
1533-
t("\r\nMäry häd ä little lämb\n\nLittle lämb", &[
1534-
"",
1535-
"Märy häd ä little lämb",
1536-
"",
1537-
"Little lämb",
1538-
]);
1527+
t(
1528+
"\nMäry häd ä little lämb\n\r\nLittle lämb\n",
1529+
&["", "Märy häd ä little lämb", "", "Little lämb"],
1530+
);
1531+
t(
1532+
"\r\nMäry häd ä little lämb\n\nLittle lämb",
1533+
&["", "Märy häd ä little lämb", "", "Little lämb"],
1534+
);
15391535
}
15401536

15411537
#[test]
@@ -1978,73 +1974,88 @@ mod pattern {
19781974
assert_eq!(v, right);
19791975
}
19801976

1981-
make_test!(str_searcher_ascii_haystack, "bb", "abbcbbd", [
1982-
Reject(0, 1),
1983-
Match(1, 3),
1984-
Reject(3, 4),
1985-
Match(4, 6),
1986-
Reject(6, 7),
1987-
]);
1988-
make_test!(str_searcher_ascii_haystack_seq, "bb", "abbcbbbbd", [
1989-
Reject(0, 1),
1990-
Match(1, 3),
1991-
Reject(3, 4),
1992-
Match(4, 6),
1993-
Match(6, 8),
1994-
Reject(8, 9),
1995-
]);
1996-
make_test!(str_searcher_empty_needle_ascii_haystack, "", "abbcbbd", [
1997-
Match(0, 0),
1998-
Reject(0, 1),
1999-
Match(1, 1),
2000-
Reject(1, 2),
2001-
Match(2, 2),
2002-
Reject(2, 3),
2003-
Match(3, 3),
2004-
Reject(3, 4),
2005-
Match(4, 4),
2006-
Reject(4, 5),
2007-
Match(5, 5),
2008-
Reject(5, 6),
2009-
Match(6, 6),
2010-
Reject(6, 7),
2011-
Match(7, 7),
2012-
]);
2013-
make_test!(str_searcher_multibyte_haystack, " ", "├──", [
2014-
Reject(0, 3),
2015-
Reject(3, 6),
2016-
Reject(6, 9),
2017-
]);
2018-
make_test!(str_searcher_empty_needle_multibyte_haystack, "", "├──", [
2019-
Match(0, 0),
2020-
Reject(0, 3),
2021-
Match(3, 3),
2022-
Reject(3, 6),
2023-
Match(6, 6),
2024-
Reject(6, 9),
2025-
Match(9, 9),
2026-
]);
1977+
make_test!(
1978+
str_searcher_ascii_haystack,
1979+
"bb",
1980+
"abbcbbd",
1981+
[Reject(0, 1), Match(1, 3), Reject(3, 4), Match(4, 6), Reject(6, 7),]
1982+
);
1983+
make_test!(
1984+
str_searcher_ascii_haystack_seq,
1985+
"bb",
1986+
"abbcbbbbd",
1987+
[Reject(0, 1), Match(1, 3), Reject(3, 4), Match(4, 6), Match(6, 8), Reject(8, 9),]
1988+
);
1989+
make_test!(
1990+
str_searcher_empty_needle_ascii_haystack,
1991+
"",
1992+
"abbcbbd",
1993+
[
1994+
Match(0, 0),
1995+
Reject(0, 1),
1996+
Match(1, 1),
1997+
Reject(1, 2),
1998+
Match(2, 2),
1999+
Reject(2, 3),
2000+
Match(3, 3),
2001+
Reject(3, 4),
2002+
Match(4, 4),
2003+
Reject(4, 5),
2004+
Match(5, 5),
2005+
Reject(5, 6),
2006+
Match(6, 6),
2007+
Reject(6, 7),
2008+
Match(7, 7),
2009+
]
2010+
);
2011+
make_test!(
2012+
str_searcher_multibyte_haystack,
2013+
" ",
2014+
"├──",
2015+
[Reject(0, 3), Reject(3, 6), Reject(6, 9),]
2016+
);
2017+
make_test!(
2018+
str_searcher_empty_needle_multibyte_haystack,
2019+
"",
2020+
"├──",
2021+
[
2022+
Match(0, 0),
2023+
Reject(0, 3),
2024+
Match(3, 3),
2025+
Reject(3, 6),
2026+
Match(6, 6),
2027+
Reject(6, 9),
2028+
Match(9, 9),
2029+
]
2030+
);
20272031
make_test!(str_searcher_empty_needle_empty_haystack, "", "", [Match(0, 0),]);
20282032
make_test!(str_searcher_nonempty_needle_empty_haystack, "├", "", []);
2029-
make_test!(char_searcher_ascii_haystack, 'b', "abbcbbd", [
2030-
Reject(0, 1),
2031-
Match(1, 2),
2032-
Match(2, 3),
2033-
Reject(3, 4),
2034-
Match(4, 5),
2035-
Match(5, 6),
2036-
Reject(6, 7),
2037-
]);
2038-
make_test!(char_searcher_multibyte_haystack, ' ', "├──", [
2039-
Reject(0, 3),
2040-
Reject(3, 6),
2041-
Reject(6, 9),
2042-
]);
2043-
make_test!(char_searcher_short_haystack, '\u{1F4A9}', "* \t", [
2044-
Reject(0, 1),
2045-
Reject(1, 2),
2046-
Reject(2, 3),
2047-
]);
2033+
make_test!(
2034+
char_searcher_ascii_haystack,
2035+
'b',
2036+
"abbcbbd",
2037+
[
2038+
Reject(0, 1),
2039+
Match(1, 2),
2040+
Match(2, 3),
2041+
Reject(3, 4),
2042+
Match(4, 5),
2043+
Match(5, 6),
2044+
Reject(6, 7),
2045+
]
2046+
);
2047+
make_test!(
2048+
char_searcher_multibyte_haystack,
2049+
' ',
2050+
"├──",
2051+
[Reject(0, 3), Reject(3, 6), Reject(6, 9),]
2052+
);
2053+
make_test!(
2054+
char_searcher_short_haystack,
2055+
'\u{1F4A9}',
2056+
"* \t",
2057+
[Reject(0, 1), Reject(1, 2), Reject(2, 3),]
2058+
);
20482059

20492060
// See #85462
20502061
#[test]
@@ -2297,21 +2308,21 @@ fn utf8_chars() {
22972308
assert_eq!(schs.len(), 4);
22982309
assert_eq!(schs.iter().cloned().collect::<String>(), s);
22992310

2300-
assert!((from_utf8(s.as_bytes()).is_ok()));
2311+
assert!(from_utf8(s.as_bytes()).is_ok());
23012312
// invalid prefix
2302-
assert!((!from_utf8(&[0x80]).is_ok()));
2313+
assert!(!from_utf8(&[0x80]).is_ok());
23032314
// invalid 2 byte prefix
2304-
assert!((!from_utf8(&[0xc0]).is_ok()));
2305-
assert!((!from_utf8(&[0xc0, 0x10]).is_ok()));
2315+
assert!(!from_utf8(&[0xc0]).is_ok());
2316+
assert!(!from_utf8(&[0xc0, 0x10]).is_ok());
23062317
// invalid 3 byte prefix
2307-
assert!((!from_utf8(&[0xe0]).is_ok()));
2308-
assert!((!from_utf8(&[0xe0, 0x10]).is_ok()));
2309-
assert!((!from_utf8(&[0xe0, 0xff, 0x10]).is_ok()));
2318+
assert!(!from_utf8(&[0xe0]).is_ok());
2319+
assert!(!from_utf8(&[0xe0, 0x10]).is_ok());
2320+
assert!(!from_utf8(&[0xe0, 0xff, 0x10]).is_ok());
23102321
// invalid 4 byte prefix
2311-
assert!((!from_utf8(&[0xf0]).is_ok()));
2312-
assert!((!from_utf8(&[0xf0, 0x10]).is_ok()));
2313-
assert!((!from_utf8(&[0xf0, 0xff, 0x10]).is_ok()));
2314-
assert!((!from_utf8(&[0xf0, 0xff, 0xff, 0x10]).is_ok()));
2322+
assert!(!from_utf8(&[0xf0]).is_ok());
2323+
assert!(!from_utf8(&[0xf0, 0x10]).is_ok());
2324+
assert!(!from_utf8(&[0xf0, 0xff, 0x10]).is_ok());
2325+
assert!(!from_utf8(&[0xf0, 0xff, 0xff, 0x10]).is_ok());
23152326
}
23162327

23172328
#[test]

0 commit comments

Comments
 (0)