Trevor Gross
19f6c17df4
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>
2024-10-12 17:07:13 -04:00
..
2024-09-22 19:11:29 -04:00
2024-10-04 23:28:22 +00:00
2024-09-22 19:11:29 -04:00
2024-09-22 19:11:29 -04:00
2024-10-04 23:44:27 +00:00
2024-10-12 13:13:50 +02:00
2024-10-04 23:44:27 +00:00
2024-10-06 19:00:09 +02:00
2024-09-25 13:26:48 +02:00
2024-10-11 13:11:13 +00:00
2024-09-22 19:11:29 -04:00
2024-09-25 13:26:48 +02:00
2024-08-21 01:31:11 -04:00
2024-10-12 17:07:13 -04:00
2024-09-22 19:11:29 -04:00
2024-10-02 19:45:17 +08:00
2024-07-29 08:26:52 +10:00
2024-04-30 22:27:19 +02:00
2024-10-06 19:00:09 +02:00
2024-10-02 17:36:31 +08:00