Skip to content

Commit 6afc3a8

Browse files
committed
Auto merge of rust-lang#120852 - matthiaskrgr:rollup-01pr8gj, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - rust-lang#120351 (Implement SystemTime for UEFI) - rust-lang#120354 (improve normalization of `Pointee::Metadata`) - rust-lang#120776 (Move path implementations into `sys`) - rust-lang#120790 (better error message on download CI LLVM failure) - rust-lang#120806 (Clippy subtree update) - rust-lang#120815 (Improve `Option::inspect` docs) - rust-lang#120822 (Emit more specific diagnostics when enums fail to cast with `as`) - rust-lang#120827 (Print image input file and checksum in CI only) - rust-lang#120836 (hide impls if trait bound is proven from env) - rust-lang#120844 (Build DebugInfo for async closures) - rust-lang#120851 (Remove duplicate release note) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8d1395a + 4b1201b commit 6afc3a8

File tree

26 files changed

+173
-59
lines changed

26 files changed

+173
-59
lines changed

core/src/option.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,18 +1073,23 @@ impl<T> Option<T> {
10731073
}
10741074
}
10751075

1076-
/// Calls the provided closure with a reference to the contained value (if [`Some`]).
1076+
/// Calls a function with a reference to the contained value if [`Some`].
1077+
///
1078+
/// Returns the original option.
10771079
///
10781080
/// # Examples
10791081
///
10801082
/// ```
1081-
/// let v = vec![1, 2, 3, 4, 5];
1083+
/// let list = vec![1, 2, 3];
10821084
///
1083-
/// // prints "got: 4"
1084-
/// let x: Option<&usize> = v.get(3).inspect(|x| println!("got: {x}"));
1085+
/// // prints "got: 2"
1086+
/// let x = list
1087+
/// .get(1)
1088+
/// .inspect(|x| println!("got: {x}"))
1089+
/// .expect("list should be long enough");
10851090
///
10861091
/// // prints nothing
1087-
/// let x: Option<&usize> = v.get(5).inspect(|x| println!("got: {x}"));
1092+
/// list.get(5).inspect(|x| println!("got: {x}"));
10881093
/// ```
10891094
#[inline]
10901095
#[stable(feature = "result_option_inspect", since = "1.76.0")]

core/src/result.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,9 @@ impl<T, E> Result<T, E> {
830830
}
831831
}
832832

833-
/// Calls the provided closure with a reference to the contained value (if [`Ok`]).
833+
/// Calls a function with a reference to the contained value if [`Ok`].
834+
///
835+
/// Returns the original result.
834836
///
835837
/// # Examples
836838
///
@@ -851,7 +853,9 @@ impl<T, E> Result<T, E> {
851853
self
852854
}
853855

854-
/// Calls the provided closure with a reference to the contained error (if [`Err`]).
856+
/// Calls a function with a reference to the contained value if [`Err`].
857+
///
858+
/// Returns the original result.
855859
///
856860
/// # Examples
857861
///

std/src/sys/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ mod personality;
77

88
pub mod cmath;
99
pub mod os_str;
10+
pub mod path;
1011

1112
// FIXME(117276): remove this, move feature implementations into individual
1213
// submodules.

std/src/sys/pal/hermit/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ pub mod io;
2828
pub mod memchr;
2929
pub mod net;
3030
pub mod os;
31-
#[path = "../unix/path.rs"]
32-
pub mod path;
3331
#[path = "../unsupported/pipe.rs"]
3432
pub mod pipe;
3533
#[path = "../unsupported/process.rs"]

std/src/sys/pal/sgx/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub mod io;
2222
pub mod memchr;
2323
pub mod net;
2424
pub mod os;
25-
pub mod path;
2625
#[path = "../unsupported/pipe.rs"]
2726
pub mod pipe;
2827
#[path = "../unsupported/process.rs"]

std/src/sys/pal/solid/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub mod fs;
2929
pub mod io;
3030
pub mod net;
3131
pub mod os;
32-
pub mod path;
3332
#[path = "../unsupported/pipe.rs"]
3433
pub mod pipe;
3534
#[path = "../unsupported/process.rs"]

std/src/sys/pal/teeos/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ pub mod net;
2525
#[path = "../unsupported/once.rs"]
2626
pub mod once;
2727
pub mod os;
28-
#[path = "../unix/path.rs"]
29-
pub mod path;
3028
#[path = "../unsupported/pipe.rs"]
3129
pub mod pipe;
3230
#[path = "../unsupported/process.rs"]

std/src/sys/pal/uefi/helpers.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,11 @@ pub(crate) fn image_handle_protocol<T>(protocol_guid: Guid) -> Option<NonNull<T>
146146
let system_handle = uefi::env::try_image_handle()?;
147147
open_protocol(system_handle, protocol_guid).ok()
148148
}
149+
150+
/// Get RuntimeServices
151+
pub(crate) fn runtime_services() -> Option<NonNull<r_efi::efi::RuntimeServices>> {
152+
let system_table: NonNull<r_efi::efi::SystemTable> =
153+
crate::os::uefi::env::try_system_table()?.cast();
154+
let runtime_services = unsafe { (*system_table.as_ptr()).runtime_services };
155+
NonNull::new(runtime_services)
156+
}

std/src/sys/pal/uefi/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub mod net;
2626
#[path = "../unsupported/once.rs"]
2727
pub mod once;
2828
pub mod os;
29-
pub mod path;
3029
#[path = "../unsupported/pipe.rs"]
3130
pub mod pipe;
3231
#[path = "../unsupported/process.rs"]
@@ -38,7 +37,6 @@ pub mod thread;
3837
pub mod thread_local_key;
3938
#[path = "../unsupported/thread_parking.rs"]
4039
pub mod thread_parking;
41-
#[path = "../unsupported/time.rs"]
4240
pub mod time;
4341

4442
mod helpers;

std/src/sys/pal/uefi/path.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)