Skip to content

Commit 4e8fd88

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents 0816929 + 6967ac3 commit 4e8fd88

File tree

375 files changed

+730841
-1000
lines changed

Some content is hidden

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

375 files changed

+730841
-1000
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
cargo-features = ["profile-rustflags"]
2+
13
[workspace]
24
resolver = "1"
35
members = [
@@ -44,9 +46,16 @@ object.debug = 0
4446
rustc-demangle.debug = 0
4547
rustc-demangle.opt-level = "s"
4648

49+
# panic_abort must always be compiled with panic=abort, even when the rest of the
50+
# sysroot is panic=unwind.
51+
[profile.dev.package.panic_abort]
52+
rustflags = ["-Cpanic=abort"]
53+
54+
[profile.release.package.panic_abort]
55+
rustflags = ["-Cpanic=abort"]
56+
4757
[patch.crates-io]
48-
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
49-
# here
58+
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on here
5059
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
5160
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
5261
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }

alloc/src/collections/linked_list/tests.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use std::cell::Cell;
21
use std::panic::{AssertUnwindSafe, catch_unwind};
32
use std::thread;
43

54
use rand::RngCore;
65

76
use super::*;
87
use crate::testing::crash_test::{CrashTestDummy, Panic};
8+
use crate::testing::macros::struct_with_counted_drop;
99
use crate::vec::Vec;
1010

1111
#[test]
@@ -1010,22 +1010,6 @@ fn extract_if_drop_panic_leak() {
10101010
assert_eq!(d7.dropped(), 1);
10111011
}
10121012

1013-
macro_rules! struct_with_counted_drop {
1014-
($struct_name:ident$(($elt_ty:ty))?, $drop_counter:ident $(=> $drop_stmt:expr)?) => {
1015-
thread_local! {static $drop_counter: Cell<u32> = Cell::new(0);}
1016-
1017-
struct $struct_name$(($elt_ty))?;
1018-
1019-
impl Drop for $struct_name {
1020-
fn drop(&mut self) {
1021-
$drop_counter.set($drop_counter.get() + 1);
1022-
1023-
$($drop_stmt(self))?
1024-
}
1025-
}
1026-
};
1027-
}
1028-
10291013
#[test]
10301014
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
10311015
fn extract_if_pred_panic_leak() {

alloc/src/collections/vec_deque/tests.rs

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
2-
#![allow(static_mut_refs)]
3-
41
use core::iter::TrustedLen;
52

63
use super::*;
4+
use crate::testing::macros::struct_with_counted_drop;
75

86
#[bench]
97
fn bench_push_back_100(b: &mut test::Bencher) {
@@ -1086,36 +1084,24 @@ fn test_clone_from() {
10861084

10871085
#[test]
10881086
fn test_vec_deque_truncate_drop() {
1089-
static mut DROPS: u32 = 0;
1090-
#[derive(Clone)]
1091-
struct Elem(#[allow(dead_code)] i32);
1092-
impl Drop for Elem {
1093-
fn drop(&mut self) {
1094-
unsafe {
1095-
DROPS += 1;
1096-
}
1097-
}
1098-
}
1087+
struct_with_counted_drop!(Elem, DROPS);
10991088

1100-
let v = vec![Elem(1), Elem(2), Elem(3), Elem(4), Elem(5)];
1101-
for push_front in 0..=v.len() {
1102-
let v = v.clone();
1103-
let mut tester = VecDeque::with_capacity(5);
1104-
for (index, elem) in v.into_iter().enumerate() {
1089+
const LEN: usize = 5;
1090+
for push_front in 0..=LEN {
1091+
let mut tester = VecDeque::with_capacity(LEN);
1092+
for index in 0..LEN {
11051093
if index < push_front {
1106-
tester.push_front(elem);
1094+
tester.push_front(Elem);
11071095
} else {
1108-
tester.push_back(elem);
1096+
tester.push_back(Elem);
11091097
}
11101098
}
1111-
assert_eq!(unsafe { DROPS }, 0);
1099+
assert_eq!(DROPS.get(), 0);
11121100
tester.truncate(3);
1113-
assert_eq!(unsafe { DROPS }, 2);
1101+
assert_eq!(DROPS.get(), 2);
11141102
tester.truncate(0);
1115-
assert_eq!(unsafe { DROPS }, 5);
1116-
unsafe {
1117-
DROPS = 0;
1118-
}
1103+
assert_eq!(DROPS.get(), 5);
1104+
DROPS.set(0);
11191105
}
11201106
}
11211107

alloc/src/ffi/c_str.rs

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,46 @@ impl From<&CStr> for CString {
10991099
}
11001100
}
11011101

1102+
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1103+
impl PartialEq<CStr> for CString {
1104+
#[inline]
1105+
fn eq(&self, other: &CStr) -> bool {
1106+
**self == *other
1107+
}
1108+
1109+
#[inline]
1110+
fn ne(&self, other: &CStr) -> bool {
1111+
**self != *other
1112+
}
1113+
}
1114+
1115+
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1116+
impl PartialEq<&CStr> for CString {
1117+
#[inline]
1118+
fn eq(&self, other: &&CStr) -> bool {
1119+
**self == **other
1120+
}
1121+
1122+
#[inline]
1123+
fn ne(&self, other: &&CStr) -> bool {
1124+
**self != **other
1125+
}
1126+
}
1127+
1128+
#[cfg(not(no_global_oom_handling))]
1129+
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1130+
impl PartialEq<Cow<'_, CStr>> for CString {
1131+
#[inline]
1132+
fn eq(&self, other: &Cow<'_, CStr>) -> bool {
1133+
**self == **other
1134+
}
1135+
1136+
#[inline]
1137+
fn ne(&self, other: &Cow<'_, CStr>) -> bool {
1138+
**self != **other
1139+
}
1140+
}
1141+
11021142
#[stable(feature = "cstring_asref", since = "1.7.0")]
11031143
impl ops::Index<ops::RangeFull> for CString {
11041144
type Output = CStr;
@@ -1181,6 +1221,75 @@ impl CStr {
11811221
}
11821222
}
11831223

1224+
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1225+
impl PartialEq<CString> for CStr {
1226+
#[inline]
1227+
fn eq(&self, other: &CString) -> bool {
1228+
*self == **other
1229+
}
1230+
1231+
#[inline]
1232+
fn ne(&self, other: &CString) -> bool {
1233+
*self != **other
1234+
}
1235+
}
1236+
1237+
#[cfg(not(no_global_oom_handling))]
1238+
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1239+
impl PartialEq<Cow<'_, Self>> for CStr {
1240+
#[inline]
1241+
fn eq(&self, other: &Cow<'_, Self>) -> bool {
1242+
*self == **other
1243+
}
1244+
1245+
#[inline]
1246+
fn ne(&self, other: &Cow<'_, Self>) -> bool {
1247+
*self != **other
1248+
}
1249+
}
1250+
1251+
#[cfg(not(no_global_oom_handling))]
1252+
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1253+
impl PartialEq<CStr> for Cow<'_, CStr> {
1254+
#[inline]
1255+
fn eq(&self, other: &CStr) -> bool {
1256+
**self == *other
1257+
}
1258+
1259+
#[inline]
1260+
fn ne(&self, other: &CStr) -> bool {
1261+
**self != *other
1262+
}
1263+
}
1264+
1265+
#[cfg(not(no_global_oom_handling))]
1266+
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1267+
impl PartialEq<&CStr> for Cow<'_, CStr> {
1268+
#[inline]
1269+
fn eq(&self, other: &&CStr) -> bool {
1270+
**self == **other
1271+
}
1272+
1273+
#[inline]
1274+
fn ne(&self, other: &&CStr) -> bool {
1275+
**self != **other
1276+
}
1277+
}
1278+
1279+
#[cfg(not(no_global_oom_handling))]
1280+
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1281+
impl PartialEq<CString> for Cow<'_, CStr> {
1282+
#[inline]
1283+
fn eq(&self, other: &CString) -> bool {
1284+
**self == **other
1285+
}
1286+
1287+
#[inline]
1288+
fn ne(&self, other: &CString) -> bool {
1289+
**self != **other
1290+
}
1291+
}
1292+
11841293
#[stable(feature = "rust1", since = "1.0.0")]
11851294
impl core::error::Error for NulError {
11861295
#[allow(deprecated)]

0 commit comments

Comments
 (0)