1
Fork 0

Auto merge of #109803 - matthiaskrgr:rollup-mojot7k, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #109598 (Improve documentation for str::replace() and str::replacen())
 - #109779 (Update gccjit and remove libc 0.1 dependency)
 - #109784 (Refactor glibc time64 support, riscv32 always has 64-bit `time_t`)
 - #109793 (add comment to `impl !Error for &str`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2023-03-31 06:10:06 +00:00
commit ec7bb8da11
4 changed files with 49 additions and 32 deletions

View file

@ -35,7 +35,7 @@ dependencies = [
[[package]] [[package]]
name = "gccjit" name = "gccjit"
version = "1.0.0" version = "1.0.0"
source = "git+https://github.com/antoyo/gccjit.rs#eefb8c662d61477f34b7c32d26bcda5f1ef08432" source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3"
dependencies = [ dependencies = [
"gccjit_sys", "gccjit_sys",
] ]
@ -43,9 +43,9 @@ dependencies = [
[[package]] [[package]]
name = "gccjit_sys" name = "gccjit_sys"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/antoyo/gccjit.rs#eefb8c662d61477f34b7c32d26bcda5f1ef08432" source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3"
dependencies = [ dependencies = [
"libc 0.1.12", "libc",
] ]
[[package]] [[package]]
@ -64,7 +64,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc 0.2.112", "libc",
"wasi", "wasi",
] ]
@ -74,7 +74,7 @@ version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [ dependencies = [
"libc 0.2.112", "libc",
] ]
[[package]] [[package]]
@ -85,7 +85,7 @@ checksum = "96bd995a092cac79868250589869b5a5d656b02a02bd74c8ebdc566dc7203090"
dependencies = [ dependencies = [
"fm", "fm",
"getopts", "getopts",
"libc 0.2.112", "libc",
"num_cpus", "num_cpus",
"termcolor", "termcolor",
"threadpool", "threadpool",
@ -93,12 +93,6 @@ dependencies = [
"walkdir", "walkdir",
] ]
[[package]]
name = "libc"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.112" version = "0.2.112"
@ -118,7 +112,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi",
"libc 0.2.112", "libc",
] ]
[[package]] [[package]]
@ -133,7 +127,7 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
dependencies = [ dependencies = [
"libc 0.2.112", "libc",
"rand_chacha", "rand_chacha",
"rand_core", "rand_core",
"rand_hc", "rand_hc",
@ -234,7 +228,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc 0.2.112", "libc",
"rand", "rand",
"redox_syscall", "redox_syscall",
"remove_dir_all", "remove_dir_all",
@ -271,7 +265,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
dependencies = [ dependencies = [
"libc 0.2.112", "libc",
] ]
[[package]] [[package]]

View file

@ -256,7 +256,7 @@ impl str {
/// assert_eq!("than an old", s.replace("is", "an")); /// assert_eq!("than an old", s.replace("is", "an"));
/// ``` /// ```
/// ///
/// When the pattern doesn't match: /// When the pattern doesn't match, it returns this string slice as [`String`]:
/// ///
/// ``` /// ```
/// let s = "this is old"; /// let s = "this is old";
@ -297,7 +297,7 @@ impl str {
/// assert_eq!("foo foo new23 foo", s.replacen(char::is_numeric, "new", 1)); /// assert_eq!("foo foo new23 foo", s.replacen(char::is_numeric, "new", 1));
/// ``` /// ```
/// ///
/// When the pattern doesn't match: /// When the pattern doesn't match, it returns this string slice as [`String`]:
/// ///
/// ``` /// ```
/// let s = "this is old"; /// let s = "this is old";

View file

@ -2655,5 +2655,6 @@ impl_fn_for_zst! {
}; };
} }
// This is required to make `impl From<&str> for Box<dyn Error>` and `impl<E> From<E> for Box<dyn Error>` not overlap.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl !crate::error::Error for &str {} impl !crate::error::Error for &str {}

View file

@ -174,6 +174,34 @@ impl From<libc::timespec> for Timespec {
} }
} }
#[cfg(all(
target_os = "linux",
target_env = "gnu",
target_pointer_width = "32",
not(target_arch = "riscv32")
))]
#[repr(C)]
pub(in crate::sys::unix) struct __timespec64 {
pub(in crate::sys::unix) tv_sec: i64,
#[cfg(target_endian = "big")]
_padding: i32,
pub(in crate::sys::unix) tv_nsec: i32,
#[cfg(target_endian = "little")]
_padding: i32,
}
#[cfg(all(
target_os = "linux",
target_env = "gnu",
target_pointer_width = "32",
not(target_arch = "riscv32")
))]
impl From<__timespec64> for Timespec {
fn from(t: __timespec64) -> Timespec {
Timespec::new(t.tv_sec, t.tv_nsec.into())
}
}
#[cfg(any( #[cfg(any(
all(target_os = "macos", any(not(target_arch = "aarch64"))), all(target_os = "macos", any(not(target_arch = "aarch64"))),
target_os = "ios", target_os = "ios",
@ -352,29 +380,23 @@ mod inner {
impl Timespec { impl Timespec {
pub fn now(clock: libc::clockid_t) -> Timespec { pub fn now(clock: libc::clockid_t) -> Timespec {
// Try to use 64-bit time in preparation for Y2038. // Try to use 64-bit time in preparation for Y2038.
#[cfg(all(target_os = "linux", target_env = "gnu", target_pointer_width = "32"))] #[cfg(all(
target_os = "linux",
target_env = "gnu",
target_pointer_width = "32",
not(target_arch = "riscv32")
))]
{ {
use crate::sys::weak::weak; use crate::sys::weak::weak;
// __clock_gettime64 was added to 32-bit arches in glibc 2.34, // __clock_gettime64 was added to 32-bit arches in glibc 2.34,
// and it handles both vDSO calls and ENOSYS fallbacks itself. // and it handles both vDSO calls and ENOSYS fallbacks itself.
weak!(fn __clock_gettime64(libc::clockid_t, *mut __timespec64) -> libc::c_int); weak!(fn __clock_gettime64(libc::clockid_t, *mut super::__timespec64) -> libc::c_int);
#[repr(C)]
struct __timespec64 {
tv_sec: i64,
#[cfg(target_endian = "big")]
_padding: i32,
tv_nsec: i32,
#[cfg(target_endian = "little")]
_padding: i32,
}
if let Some(clock_gettime64) = __clock_gettime64.get() { if let Some(clock_gettime64) = __clock_gettime64.get() {
let mut t = MaybeUninit::uninit(); let mut t = MaybeUninit::uninit();
cvt(unsafe { clock_gettime64(clock, t.as_mut_ptr()) }).unwrap(); cvt(unsafe { clock_gettime64(clock, t.as_mut_ptr()) }).unwrap();
let t = unsafe { t.assume_init() }; return Timespec::from(unsafe { t.assume_init() });
return Timespec::new(t.tv_sec, t.tv_nsec as i64);
} }
} }