rust/compiler/rustc_serialize/src
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
..
int_overflow.rs Add add/sub methods that only panic with debug assertions to rustc 2024-04-13 17:03:12 +02:00
leb128.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
lib.rs Stabilize const_option 2024-10-12 17:07:13 -04:00
opaque.rs Fix used_underscore_binding in rustc_serialize 2024-10-07 15:02:45 +02:00
serialize.rs Fix needless_lifetimes in rustc_serialize 2024-10-08 15:17:45 +02:00