Stabilize const_option
· qinheping/verify-rust-std@a2d85a1 (original) (raw)
`@@ -723,7 +723,8 @@ impl Option {
`
723
723
```` /// ```
`724`
`724`
`#[inline]
`
`725`
`725`
`#[stable(feature = "rust1", since = "1.0.0")]
`
`726`
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
``
`726`
`+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
`
``
`727`
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
`727`
`728`
`pub const fn as_mut(&mut self) -> Option<&mut T> {
`
`728`
`729`
`match *self {
`
`729`
`730`
`Some(ref mut x) => Some(x),
`
`@@ -924,7 +925,8 @@ impl<T> Option<T> {
`
`924`
`925`
`#[track_caller]
`
`925`
`926`
`#[stable(feature = "rust1", since = "1.0.0")]
`
`926`
`927`
`#[cfg_attr(not(test), rustc_diagnostic_item = "option_expect")]
`
`927`
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
``
`928`
`+
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
`
``
`929`
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
`928`
`930`
`pub const fn expect(self, msg: &str) -> T {
`
`929`
`931`
`match self {
`
`930`
`932`
`Some(val) => val,
`
`@@ -962,7 +964,8 @@ impl<T> Option<T> {
`
`962`
`964`
`#[track_caller]
`
`963`
`965`
`#[stable(feature = "rust1", since = "1.0.0")]
`
`964`
`966`
`#[cfg_attr(not(test), rustc_diagnostic_item = "option_unwrap")]
`
`965`
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
``
`967`
`+
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
`
``
`968`
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
`966`
`969`
`pub const fn unwrap(self) -> T {
`
`967`
`970`
`match self {
`
`968`
`971`
`Some(val) => val,
`
`@@ -1069,7 +1072,8 @@ impl<T> Option<T> {
`
`1069`
`1072`
`#[inline]
`
`1070`
`1073`
`#[track_caller]
`
`1071`
`1074`
`#[stable(feature = "option_result_unwrap_unchecked", since = "1.58.0")]
`
`1072`
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
``
`1075`
`+
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
`
``
`1076`
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
`1073`
`1077`
`pub const unsafe fn unwrap_unchecked(self) -> T {
`
`1074`
`1078`
`match self {
`
`1075`
`1079`
`Some(val) => val,
`
`@@ -1712,7 +1716,8 @@ impl<T> Option<T> {
`
`1712`
`1716`
```` /// ```
1713
1717
`#[inline]
`
1714
1718
`#[stable(feature = "rust1", since = "1.0.0")]
`
1715
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
``
1719
`+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
`
``
1720
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
1716
1721
`pub const fn take(&mut self) -> Option {
`
1717
1722
`` // FIXME(const-hack) replace mem::replace
by mem::take
when the latter is const ready
``
1718
1723
` mem::replace(self, None)
`
`@@ -1769,8 +1774,9 @@ impl Option {
`
1769
1774
`/// assert_eq!(old, None);
`
1770
1775
```` /// ```
`1771`
`1776`
`#[inline]
`
`1772`
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
`1773`
`1777`
`#[stable(feature = "option_replace", since = "1.31.0")]
`
``
`1778`
`+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
`
``
`1779`
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
`1774`
`1780`
`pub const fn replace(&mut self, value: T) -> Option<T> {
`
`1775`
`1781`
` mem::replace(self, Some(value))
`
`1776`
`1782`
`}
`
`@@ -1878,7 +1884,7 @@ impl<T> Option<&T> {
`
`1878`
`1884`
```` /// ```
1879
1885
`` #[must_use = "self
will be dropped if the result is not used"]
``
1880
1886
`#[stable(feature = "copied", since = "1.35.0")]
`
1881
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
``
1887
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
1882
1888
`pub const fn copied(self) -> Option
`
1883
1889
`where
`
1884
1890
`T: Copy,
`
`@@ -1931,7 +1937,8 @@ impl Option<&mut T> {
`
1931
1937
```` /// ```
`1932`
`1938`
`` #[must_use = "`self` will be dropped if the result is not used"]
``
`1933`
`1939`
`#[stable(feature = "copied", since = "1.35.0")]
`
`1934`
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
``
`1940`
`+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
`
``
`1941`
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
`1935`
`1942`
`pub const fn copied(self) -> Option<T>
`
`1936`
`1943`
`where
`
`1937`
`1944`
`T: Copy,
`
`@@ -1986,7 +1993,8 @@ impl<T, E> Option<Result<T, E>> {
`
`1986`
`1993`
```` /// ```
1987
1994
`#[inline]
`
1988
1995
`#[stable(feature = "transpose_result", since = "1.33.0")]
`
1989
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
``
1996
`+
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
`
``
1997
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
1990
1998
`pub const fn transpose(self) -> Result<Option, E> {
`
1991
1999
`match self {
`
1992
2000
`Some(Ok(x)) => Ok(Some(x)),
`
`@@ -2009,7 +2017,6 @@ const fn unwrap_failed() -> ! {
`
2009
2017
`#[cfg_attr(feature = "panic_immediate_abort", inline)]
`
2010
2018
`#[cold]
`
2011
2019
`#[track_caller]
`
2012
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
2013
2020
`const fn expect_failed(msg: &str) -> ! {
`
2014
2021
`panic_display(&msg)
`
2015
2022
`}
`
`@@ -2534,7 +2541,8 @@ impl Option<Option> {
`
2534
2541
```` /// ```
````
2535
2542
`#[inline]
`
2536
2543
`#[stable(feature = "option_flattening", since = "1.40.0")]
`
2537
``
`-
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
`
``
2544
`+
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
`
``
2545
`+
#[rustc_const_stable(feature = "const_option", since = "CURRENT_RUSTC_VERSION")]
`
2538
2546
`pub const fn flatten(self) -> Option {
`
2539
2547
`` // FIXME(const-hack): could be written with and_then
``
2540
2548
`match self {
`