Skip to content

Commit ec7bb8d

Browse files
committed
Auto merge of rust-lang#109803 - matthiaskrgr:rollup-mojot7k, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - rust-lang#109598 (Improve documentation for str::replace() and str::replacen()) - rust-lang#109779 (Update gccjit and remove libc 0.1 dependency) - rust-lang#109784 (Refactor glibc time64 support, riscv32 always has 64-bit `time_t`) - rust-lang#109793 (add comment to `impl !Error for &str`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents eb3e9c1 + ec276c7 commit ec7bb8d

File tree

4 files changed

+49
-32
lines changed

4 files changed

+49
-32
lines changed

compiler/rustc_codegen_gcc/Cargo.lock

+10-16
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ dependencies = [
3535
[[package]]
3636
name = "gccjit"
3737
version = "1.0.0"
38-
source = "git+https://github.com/antoyo/gccjit.rs#eefb8c662d61477f34b7c32d26bcda5f1ef08432"
38+
source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3"
3939
dependencies = [
4040
"gccjit_sys",
4141
]
4242

4343
[[package]]
4444
name = "gccjit_sys"
4545
version = "0.0.1"
46-
source = "git+https://github.com/antoyo/gccjit.rs#eefb8c662d61477f34b7c32d26bcda5f1ef08432"
46+
source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3"
4747
dependencies = [
48-
"libc 0.1.12",
48+
"libc",
4949
]
5050

5151
[[package]]
@@ -64,7 +64,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
6464
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
6565
dependencies = [
6666
"cfg-if",
67-
"libc 0.2.112",
67+
"libc",
6868
"wasi",
6969
]
7070

@@ -74,7 +74,7 @@ version = "0.1.19"
7474
source = "registry+https://github.com/rust-lang/crates.io-index"
7575
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
7676
dependencies = [
77-
"libc 0.2.112",
77+
"libc",
7878
]
7979

8080
[[package]]
@@ -85,20 +85,14 @@ checksum = "96bd995a092cac79868250589869b5a5d656b02a02bd74c8ebdc566dc7203090"
8585
dependencies = [
8686
"fm",
8787
"getopts",
88-
"libc 0.2.112",
88+
"libc",
8989
"num_cpus",
9090
"termcolor",
9191
"threadpool",
9292
"wait-timeout",
9393
"walkdir",
9494
]
9595

96-
[[package]]
97-
name = "libc"
98-
version = "0.1.12"
99-
source = "registry+https://github.com/rust-lang/crates.io-index"
100-
checksum = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122"
101-
10296
[[package]]
10397
name = "libc"
10498
version = "0.2.112"
@@ -118,7 +112,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
118112
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
119113
dependencies = [
120114
"hermit-abi",
121-
"libc 0.2.112",
115+
"libc",
122116
]
123117

124118
[[package]]
@@ -133,7 +127,7 @@ version = "0.8.4"
133127
source = "registry+https://github.com/rust-lang/crates.io-index"
134128
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
135129
dependencies = [
136-
"libc 0.2.112",
130+
"libc",
137131
"rand_chacha",
138132
"rand_core",
139133
"rand_hc",
@@ -234,7 +228,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
234228
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
235229
dependencies = [
236230
"cfg-if",
237-
"libc 0.2.112",
231+
"libc",
238232
"rand",
239233
"redox_syscall",
240234
"remove_dir_all",
@@ -271,7 +265,7 @@ version = "0.2.0"
271265
source = "registry+https://github.com/rust-lang/crates.io-index"
272266
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
273267
dependencies = [
274-
"libc 0.2.112",
268+
"libc",
275269
]
276270

277271
[[package]]

library/alloc/src/str.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl str {
256256
/// assert_eq!("than an old", s.replace("is", "an"));
257257
/// ```
258258
///
259-
/// When the pattern doesn't match:
259+
/// When the pattern doesn't match, it returns this string slice as [`String`]:
260260
///
261261
/// ```
262262
/// let s = "this is old";
@@ -297,7 +297,7 @@ impl str {
297297
/// assert_eq!("foo foo new23 foo", s.replacen(char::is_numeric, "new", 1));
298298
/// ```
299299
///
300-
/// When the pattern doesn't match:
300+
/// When the pattern doesn't match, it returns this string slice as [`String`]:
301301
///
302302
/// ```
303303
/// let s = "this is old";

library/core/src/str/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2655,5 +2655,6 @@ impl_fn_for_zst! {
26552655
};
26562656
}
26572657

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

library/std/src/sys/unix/time.rs

+36-14
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,34 @@ impl From<libc::timespec> for Timespec {
174174
}
175175
}
176176

177+
#[cfg(all(
178+
target_os = "linux",
179+
target_env = "gnu",
180+
target_pointer_width = "32",
181+
not(target_arch = "riscv32")
182+
))]
183+
#[repr(C)]
184+
pub(in crate::sys::unix) struct __timespec64 {
185+
pub(in crate::sys::unix) tv_sec: i64,
186+
#[cfg(target_endian = "big")]
187+
_padding: i32,
188+
pub(in crate::sys::unix) tv_nsec: i32,
189+
#[cfg(target_endian = "little")]
190+
_padding: i32,
191+
}
192+
193+
#[cfg(all(
194+
target_os = "linux",
195+
target_env = "gnu",
196+
target_pointer_width = "32",
197+
not(target_arch = "riscv32")
198+
))]
199+
impl From<__timespec64> for Timespec {
200+
fn from(t: __timespec64) -> Timespec {
201+
Timespec::new(t.tv_sec, t.tv_nsec.into())
202+
}
203+
}
204+
177205
#[cfg(any(
178206
all(target_os = "macos", any(not(target_arch = "aarch64"))),
179207
target_os = "ios",
@@ -352,29 +380,23 @@ mod inner {
352380
impl Timespec {
353381
pub fn now(clock: libc::clockid_t) -> Timespec {
354382
// Try to use 64-bit time in preparation for Y2038.
355-
#[cfg(all(target_os = "linux", target_env = "gnu", target_pointer_width = "32"))]
383+
#[cfg(all(
384+
target_os = "linux",
385+
target_env = "gnu",
386+
target_pointer_width = "32",
387+
not(target_arch = "riscv32")
388+
))]
356389
{
357390
use crate::sys::weak::weak;
358391

359392
// __clock_gettime64 was added to 32-bit arches in glibc 2.34,
360393
// and it handles both vDSO calls and ENOSYS fallbacks itself.
361-
weak!(fn __clock_gettime64(libc::clockid_t, *mut __timespec64) -> libc::c_int);
362-
363-
#[repr(C)]
364-
struct __timespec64 {
365-
tv_sec: i64,
366-
#[cfg(target_endian = "big")]
367-
_padding: i32,
368-
tv_nsec: i32,
369-
#[cfg(target_endian = "little")]
370-
_padding: i32,
371-
}
394+
weak!(fn __clock_gettime64(libc::clockid_t, *mut super::__timespec64) -> libc::c_int);
372395

373396
if let Some(clock_gettime64) = __clock_gettime64.get() {
374397
let mut t = MaybeUninit::uninit();
375398
cvt(unsafe { clock_gettime64(clock, t.as_mut_ptr()) }).unwrap();
376-
let t = unsafe { t.assume_init() };
377-
return Timespec::new(t.tv_sec, t.tv_nsec as i64);
399+
return Timespec::from(unsafe { t.assume_init() });
378400
}
379401
}
380402

0 commit comments

Comments
 (0)