diff options
| author | Trevor Gross <tmgross@umich.edu> | 2024-10-01 17:11:48 -0400 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2024-10-12 17:07:13 -0400 |
| commit | 3c43a60d0652a1e8b62bf11d559a02d5cd20119d (patch) | |
| tree | c6fff8cfa5885bd6f9fa32fea4a98ae91e74351c /compiler/rustc_mir_transform/src/coverage/mod.rs | |
| parent | f5cc292830506e335606e5ff3d812f54397513c3 (diff) | |
| download | rust-3c43a60d0652a1e8b62bf11d559a02d5cd20119d.tar.gz rust-3c43a60d0652a1e8b62bf11d559a02d5cd20119d.zip | |
Stabilize `const_option`
This makes the following API stable in const contexts:
impl<T> Option<T> {
pub const fn as_mut(&mut self) -> Option<&mut T>;
pub const fn expect(self, msg: &str) -> T;
pub const fn unwrap(self) -> T;
pub const unsafe fn unwrap_unchecked(self) -> T;
pub const fn take(&mut self) -> Option<T>;
pub const fn replace(&mut self, value: T) -> Option<T>;
}
impl<T> Option<&T> {
pub const fn copied(self) -> Option<T>
where T: Copy;
}
impl<T> Option<&mut T> {
pub const fn copied(self) -> Option<T>
where T: Copy;
}
impl<T, E> Option<Result<T, E>> {
pub const fn transpose(self) -> Result<Option<T>, E>
}
impl<T> Option<Option<T>> {
pub const fn flatten(self) -> Option<T>;
}
The following functions make use of the unstable
`const_precise_live_drops` feature:
- `expect`
- `unwrap`
- `unwrap_unchecked`
- `transpose`
- `flatten`
Fixes: <https://github.com/rust-lang/rust/issues/67441>
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
0 files changed, 0 insertions, 0 deletions
