Skip to content

Commit c721120

Browse files
committed
Auto merge of #147775 - matthiaskrgr:rollup-u90jv4x, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #147000 (std: Add Motor OS std library port) - #147732 (remove duplicate inline macro) - #147738 (Don't highlight `let` expressions as having type `bool` in let-chain error messages) - #147739 (Fix whitespace in rustfmt-excluded clippy file) - #147744 (miri subtree update) - #147751 (Use `bit_set::Word` in a couple more places.) - #147752 (style-guide: fix typo for empty struct advice) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f524236 + 2e64881 commit c721120

File tree

77 files changed

+2517
-98
lines changed

Some content is hidden

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

77 files changed

+2517
-98
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ dependencies = [
11641164
"libc",
11651165
"option-ext",
11661166
"redox_users 0.5.2",
1167-
"windows-sys 0.60.2",
1167+
"windows-sys 0.61.2",
11681168
]
11691169

11701170
[[package]]
@@ -2106,19 +2106,19 @@ dependencies = [
21062106

21072107
[[package]]
21082108
name = "libffi"
2109-
version = "4.1.1"
2109+
version = "5.0.0"
21102110
source = "registry+https://github.com/rust-lang/crates.io-index"
2111-
checksum = "e7681c6fab541f799a829e44a445a0666cf8d8a6cfebf89419e6aed52c604e87"
2111+
checksum = "0444124f3ffd67e1b0b0c661a7f81a278a135eb54aaad4078e79fbc8be50c8a5"
21122112
dependencies = [
21132113
"libc",
21142114
"libffi-sys",
21152115
]
21162116

21172117
[[package]]
21182118
name = "libffi-sys"
2119-
version = "3.3.2"
2119+
version = "4.0.0"
21202120
source = "registry+https://github.com/rust-lang/crates.io-index"
2121-
checksum = "7b0d828d367b4450ed08e7d510dc46636cd660055f50d67ac943bfe788767c29"
2121+
checksum = "3d722da8817ea580d0669da6babe2262d7b86a1af1103da24102b8bb9c101ce7"
21222122
dependencies = [
21232123
"cc",
21242124
]
@@ -2374,7 +2374,7 @@ version = "0.6.1"
23742374
source = "registry+https://github.com/rust-lang/crates.io-index"
23752375
checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08"
23762376
dependencies = [
2377-
"windows-sys 0.60.2",
2377+
"windows-sys 0.61.2",
23782378
]
23792379

23802380
[[package]]

compiler/rustc_hir_typeck/src/demand.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
792792
hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Binary(_, lhs, rhs), .. }),
793793
Some(TypeError::Sorts(ExpectedFound { expected, .. })),
794794
) if rhs.hir_id == expr.hir_id
795-
&& self.typeck_results.borrow().expr_ty_adjusted_opt(lhs) == Some(expected) =>
795+
&& self.typeck_results.borrow().expr_ty_adjusted_opt(lhs) == Some(expected)
796+
// let expressions being marked as `bool` is confusing (see issue #147665)
797+
&& !matches!(lhs.kind, hir::ExprKind::Let(..)) =>
796798
{
797799
err.span_label(lhs.span, format!("expected because this is `{expected}`"));
798800
}

compiler/rustc_index/src/bit_set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ impl<T: Idx> BitRelations<ChunkedBitSet<T>> for ChunkedBitSet<T> {
873873
let mut self_chunk_words = **other_chunk_words;
874874
for word in self_chunk_words[0..num_words].iter_mut().rev() {
875875
*word = !*word & tail_mask;
876-
tail_mask = u64::MAX;
876+
tail_mask = Word::MAX;
877877
}
878878
let self_chunk_count = chunk_domain_size - *other_chunk_count;
879879
debug_assert_eq!(
@@ -888,7 +888,7 @@ impl<T: Idx> BitRelations<ChunkedBitSet<T>> for ChunkedBitSet<T> {
888888
) => {
889889
// See `ChunkedBitSet::union` for details on what is happening here.
890890
let num_words = num_words(chunk_domain_size as usize);
891-
let op = |a: u64, b: u64| a & !b;
891+
let op = |a: Word, b: Word| a & !b;
892892
if !bitwise_changes(
893893
&self_chunk_words[0..num_words],
894894
&other_chunk_words[0..num_words],

library/Cargo.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ dependencies = [
166166
"rustc-std-workspace-core",
167167
]
168168

169+
[[package]]
170+
name = "moto-rt"
171+
version = "0.15.0"
172+
source = "registry+https://github.com/rust-lang/crates.io-index"
173+
checksum = "058a2807a30527bee4c30df7ababe971cdde94372d4dbd1ff145bb403381436c"
174+
dependencies = [
175+
"rustc-std-workspace-alloc",
176+
"rustc-std-workspace-core",
177+
]
178+
169179
[[package]]
170180
name = "object"
171181
version = "0.37.3"
@@ -316,6 +326,7 @@ dependencies = [
316326
"hermit-abi",
317327
"libc",
318328
"miniz_oxide",
329+
"moto-rt",
319330
"object",
320331
"panic_abort",
321332
"panic_unwind",

library/alloc/src/sync.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,6 @@ impl<T, A: Allocator> Arc<T, A> {
886886
/// let five = Arc::try_new_in(5, System)?;
887887
/// # Ok::<(), std::alloc::AllocError>(())
888888
/// ```
889-
#[inline]
890889
#[unstable(feature = "allocator_api", issue = "32838")]
891890
#[inline]
892891
pub fn try_new_in(data: T, alloc: A) -> Result<Arc<T, A>, AllocError> {

library/std/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ fortanix-sgx-abi = { version = "0.6.1", features = [
7070
'rustc-dep-of-std',
7171
], public = true }
7272

73+
[target.'cfg(target_os = "motor")'.dependencies]
74+
moto-rt = { version = "0.15", features = ['rustc-dep-of-std'], public = true }
75+
7376
[target.'cfg(target_os = "hermit")'.dependencies]
7477
hermit-abi = { version = "0.5.0", features = [
7578
'rustc-dep-of-std',

library/std/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ fn main() {
3030
|| target_os == "windows"
3131
|| target_os == "fuchsia"
3232
|| (target_vendor == "fortanix" && target_env == "sgx")
33+
|| target_os == "motor"
3334
|| target_os == "hermit"
3435
|| target_os == "trusty"
3536
|| target_os == "l4re"

library/std/src/os/fd/owned.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#![stable(feature = "io_safety", since = "1.63.0")]
44
#![deny(unsafe_op_in_unsafe_fn)]
55

6+
#[cfg(target_os = "motor")]
7+
use moto_rt::libc;
8+
69
use super::raw::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
710
#[cfg(not(target_os = "trusty"))]
811
use crate::fs;
@@ -12,7 +15,8 @@ use crate::mem::ManuallyDrop;
1215
target_arch = "wasm32",
1316
target_env = "sgx",
1417
target_os = "hermit",
15-
target_os = "trusty"
18+
target_os = "trusty",
19+
target_os = "motor"
1620
)))]
1721
use crate::sys::cvt;
1822
#[cfg(not(target_os = "trusty"))]
@@ -95,7 +99,12 @@ impl OwnedFd {
9599
impl BorrowedFd<'_> {
96100
/// Creates a new `OwnedFd` instance that shares the same underlying file
97101
/// description as the existing `BorrowedFd` instance.
98-
#[cfg(not(any(target_arch = "wasm32", target_os = "hermit", target_os = "trusty")))]
102+
#[cfg(not(any(
103+
target_arch = "wasm32",
104+
target_os = "hermit",
105+
target_os = "trusty",
106+
target_os = "motor"
107+
)))]
99108
#[stable(feature = "io_safety", since = "1.63.0")]
100109
pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {
101110
// We want to atomically duplicate this file descriptor and set the
@@ -123,6 +132,15 @@ impl BorrowedFd<'_> {
123132
pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {
124133
Err(crate::io::Error::UNSUPPORTED_PLATFORM)
125134
}
135+
136+
/// Creates a new `OwnedFd` instance that shares the same underlying file
137+
/// description as the existing `BorrowedFd` instance.
138+
#[cfg(target_os = "motor")]
139+
#[stable(feature = "io_safety", since = "1.63.0")]
140+
pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {
141+
let fd = moto_rt::fs::duplicate(self.as_raw_fd()).map_err(crate::sys::map_motor_error)?;
142+
Ok(unsafe { OwnedFd::from_raw_fd(fd) })
143+
}
126144
}
127145

128146
#[stable(feature = "io_safety", since = "1.63.0")]

library/std/src/os/fd/raw.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44

55
#[cfg(target_os = "hermit")]
66
use hermit_abi as libc;
7+
#[cfg(target_os = "motor")]
8+
use moto_rt::libc;
79

10+
#[cfg(target_os = "motor")]
11+
use super::owned::OwnedFd;
812
#[cfg(not(target_os = "trusty"))]
913
use crate::fs;
1014
use crate::io;
1115
#[cfg(target_os = "hermit")]
1216
use crate::os::hermit::io::OwnedFd;
13-
#[cfg(not(target_os = "hermit"))]
17+
#[cfg(all(not(target_os = "hermit"), not(target_os = "motor")))]
1418
use crate::os::raw;
1519
#[cfg(all(doc, not(target_arch = "wasm32")))]
1620
use crate::os::unix::io::AsFd;
@@ -23,10 +27,10 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
2327

2428
/// Raw file descriptors.
2529
#[stable(feature = "rust1", since = "1.0.0")]
26-
#[cfg(not(target_os = "hermit"))]
30+
#[cfg(all(not(target_os = "hermit"), not(target_os = "motor")))]
2731
pub type RawFd = raw::c_int;
2832
#[stable(feature = "rust1", since = "1.0.0")]
29-
#[cfg(target_os = "hermit")]
33+
#[cfg(any(target_os = "hermit", target_os = "motor"))]
3034
pub type RawFd = i32;
3135

3236
/// A trait to extract the raw file descriptor from an underlying object.

library/std/src/os/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ pub mod ios;
155155
pub mod l4re;
156156
#[cfg(target_os = "macos")]
157157
pub mod macos;
158+
#[cfg(target_os = "motor")]
159+
pub mod motor;
158160
#[cfg(target_os = "netbsd")]
159161
pub mod netbsd;
160162
#[cfg(target_os = "nto")]
@@ -182,7 +184,14 @@ pub mod vxworks;
182184
#[cfg(target_os = "xous")]
183185
pub mod xous;
184186

185-
#[cfg(any(unix, target_os = "hermit", target_os = "trusty", target_os = "wasi", doc))]
187+
#[cfg(any(
188+
unix,
189+
target_os = "hermit",
190+
target_os = "trusty",
191+
target_os = "wasi",
192+
target_os = "motor",
193+
doc
194+
))]
186195
pub mod fd;
187196

188197
#[cfg(any(target_os = "linux", target_os = "android", target_os = "cygwin", doc))]

0 commit comments

Comments
 (0)