Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0d63614

Browse files
author
The Miri Cronjob Bot
committedJul 26, 2024
Merge from rustc
2 parents c4ee91f + cb8f69b commit 0d63614

File tree

13 files changed

+237
-181
lines changed

13 files changed

+237
-181
lines changed
 

‎core/src/char/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,23 @@ mod convert;
2424
mod decode;
2525
mod methods;
2626

27+
// stable re-exports
28+
#[rustfmt::skip]
2729
#[stable(feature = "try_from", since = "1.34.0")]
2830
pub use self::convert::CharTryFromError;
2931
#[stable(feature = "char_from_str", since = "1.20.0")]
3032
pub use self::convert::ParseCharError;
3133
#[stable(feature = "decode_utf16", since = "1.9.0")]
3234
pub use self::decode::{DecodeUtf16, DecodeUtf16Error};
3335

36+
// perma-unstable re-exports
37+
#[rustfmt::skip]
3438
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
3539
pub use self::methods::encode_utf16_raw; // perma-unstable
3640
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
3741
pub use self::methods::encode_utf8_raw; // perma-unstable
3842

43+
#[rustfmt::skip]
3944
use crate::ascii;
4045
use crate::error::Error;
4146
use crate::escape;

‎core/src/ffi/c_str.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ use crate::str;
9494
/// ```
9595
///
9696
/// [str]: prim@str "str"
97-
#[derive(Hash)]
97+
#[derive(PartialEq, Eq, Hash)]
9898
#[stable(feature = "core_c_str", since = "1.64.0")]
9999
#[rustc_has_incoherent_inherent_impls]
100100
#[lang = "CStr"]
@@ -104,7 +104,6 @@ use crate::str;
104104
// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
105105
// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
106106
#[repr(transparent)]
107-
#[allow(clippy::derived_hash_with_manual_eq)]
108107
pub struct CStr {
109108
// FIXME: this should not be represented with a DST slice but rather with
110109
// just a raw `c_char` along with some form of marker to make
@@ -678,15 +677,9 @@ impl CStr {
678677
}
679678
}
680679

681-
#[stable(feature = "rust1", since = "1.0.0")]
682-
impl PartialEq for CStr {
683-
#[inline]
684-
fn eq(&self, other: &CStr) -> bool {
685-
self.to_bytes().eq(other.to_bytes())
686-
}
687-
}
688-
#[stable(feature = "rust1", since = "1.0.0")]
689-
impl Eq for CStr {}
680+
// `.to_bytes()` representations are compared instead of the inner `[c_char]`s,
681+
// because `c_char` is `i8` (not `u8`) on some platforms.
682+
// That is why this is implemented manually and not derived.
690683
#[stable(feature = "rust1", since = "1.0.0")]
691684
impl PartialOrd for CStr {
692685
#[inline]

‎core/src/intrinsics/simd.rs

-12
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,6 @@ extern "rust-intrinsic" {
243243
#[rustc_nounwind]
244244
pub fn simd_shuffle<T, U, V>(x: T, y: T, idx: U) -> V;
245245

246-
/// Shuffle two vectors by const indices.
247-
///
248-
/// `T` must be a vector.
249-
///
250-
/// `U` must be a vector with the same element type as `T` and the same length as `IDX`.
251-
///
252-
/// Returns a new vector such that element `i` is selected from `xy[IDX[i]]`, where `xy`
253-
/// is the concatenation of `x` and `y`. It is a compile-time error if `IDX[i]` is out-of-bounds
254-
/// of `xy`.
255-
#[rustc_nounwind]
256-
pub fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
257-
258246
/// Read a vector of pointers.
259247
///
260248
/// `T` must be a vector.

‎core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@
249249
#![feature(transparent_unions)]
250250
#![feature(try_blocks)]
251251
#![feature(unboxed_closures)]
252-
#![feature(unsized_const_params)]
253252
#![feature(unsized_fn_params)]
254253
#![feature(with_negative_coherence)]
255254
// tidy-alphabetical-end

‎core/src/marker.rs

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ use crate::hash::Hasher;
4242
/// }
4343
/// ```
4444
#[unstable(feature = "internal_impls_macro", issue = "none")]
45+
// Allow implementations of `UnsizedConstParamTy` even though std cannot use that feature.
46+
#[allow_internal_unstable(unsized_const_params)]
4547
macro marker_impls {
4648
( $(#[$($meta:tt)*])* $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => {
4749
$(#[$($meta)*])* impl< $($($bounds)*)? > $Trait for $T {}

‎core/src/unicode/mod.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#![unstable(feature = "unicode_internals", issue = "none")]
22
#![allow(missing_docs)]
33

4-
// The `pub use` ones are for use in alloc, and are not re-exported in std.
5-
6-
pub(crate) use unicode_data::alphabetic::lookup as Alphabetic;
4+
// for use in alloc, not re-exported in std.
5+
#[rustfmt::skip]
76
pub use unicode_data::case_ignorable::lookup as Case_Ignorable;
87
pub use unicode_data::cased::lookup as Cased;
9-
pub(crate) use unicode_data::cc::lookup as Cc;
108
pub use unicode_data::conversions;
9+
10+
#[rustfmt::skip]
11+
pub(crate) use unicode_data::alphabetic::lookup as Alphabetic;
12+
pub(crate) use unicode_data::cc::lookup as Cc;
1113
pub(crate) use unicode_data::grapheme_extend::lookup as Grapheme_Extend;
1214
pub(crate) use unicode_data::lowercase::lookup as Lowercase;
1315
pub(crate) use unicode_data::n::lookup as N;

‎core/tests/ffi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mod cstr;

‎core/tests/ffi/cstr.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use core::ffi::CStr;
2+
3+
#[test]
4+
fn compares_as_u8s() {
5+
let a: &CStr = c"Hello!"; // Starts with ascii
6+
let a_bytes: &[u8] = a.to_bytes();
7+
assert!((..0b1000_0000).contains(&a_bytes[0]));
8+
9+
let b: &CStr = c"こんにちは!"; // Starts with non ascii
10+
let b_bytes: &[u8] = b.to_bytes();
11+
assert!((0b1000_0000..).contains(&b_bytes[0]));
12+
13+
assert_eq!(Ord::cmp(a, b), Ord::cmp(a_bytes, b_bytes));
14+
assert_eq!(PartialOrd::partial_cmp(a, b), PartialOrd::partial_cmp(a_bytes, b_bytes));
15+
}

‎core/tests/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ mod clone;
132132
mod cmp;
133133
mod const_ptr;
134134
mod convert;
135+
mod ffi;
135136
mod fmt;
136137
mod future;
137138
mod hash;

‎std/src/rt.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
#![deny(unsafe_op_in_unsafe_fn)]
1717
#![allow(unused_macros)]
1818

19+
#[rustfmt::skip]
1920
pub use crate::panicking::{begin_panic, panic_count};
2021
pub use core::panicking::{panic_display, panic_fmt};
2122

23+
#[rustfmt::skip]
2224
use crate::sync::Once;
2325
use crate::sys;
2426
use crate::thread::{self, Thread};

‎std/src/sys/pal/unix/net.rs

+19-10
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,25 @@ impl Socket {
214214
}
215215
0 => {}
216216
_ => {
217-
// linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
218-
// for POLLHUP rather than read readiness
219-
if pollfd.revents & libc::POLLHUP != 0 {
220-
let e = self.take_error()?.unwrap_or_else(|| {
221-
io::const_io_error!(
222-
io::ErrorKind::Uncategorized,
223-
"no error set after POLLHUP",
224-
)
225-
});
226-
return Err(e);
217+
if cfg!(target_os = "vxworks") {
218+
// VxWorks poll does not return POLLHUP or POLLERR in revents. Check if the
219+
// connnection actually succeeded and return ok only when the socket is
220+
// ready and no errors were found.
221+
if let Some(e) = self.take_error()? {
222+
return Err(e);
223+
}
224+
} else {
225+
// linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
226+
// for POLLHUP or POLLERR rather than read readiness
227+
if pollfd.revents & (libc::POLLHUP | libc::POLLERR) != 0 {
228+
let e = self.take_error()?.unwrap_or_else(|| {
229+
io::const_io_error!(
230+
io::ErrorKind::Uncategorized,
231+
"no error set after POLLHUP",
232+
)
233+
});
234+
return Err(e);
235+
}
227236
}
228237

229238
return Ok(());

‎std/src/sys/pal/windows/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ impl File {
416416
dwHighDateTime: (info.LastWriteTime >> 32) as u32,
417417
},
418418
change_time: Some(c::FILETIME {
419-
dhLowDateTime: info.ChangeTime as c::DWORD,
420-
dhHighDateTime: (info.ChangeTime >> 32) as c::DWORD,
419+
dwLowDateTime: info.ChangeTime as u32,
420+
dwHighDateTime: (info.ChangeTime >> 32) as u32,
421421
}),
422422
file_size: 0,
423423
reparse_tag: 0,
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.