Rename ~const Drop to ~const Destruct
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
//! impl bool {}
|
||||
|
||||
use crate::marker::Destruct;
|
||||
|
||||
#[lang = "bool"]
|
||||
impl bool {
|
||||
/// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html),
|
||||
@@ -16,9 +18,10 @@ impl bool {
|
||||
#[unstable(feature = "bool_to_option", issue = "80967")]
|
||||
#[rustc_const_unstable(feature = "const_bool_to_option", issue = "91917")]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn then_some<T>(self, t: T) -> Option<T>
|
||||
where
|
||||
T: ~const Drop,
|
||||
T: ~const Drop + ~const Destruct,
|
||||
{
|
||||
if self { Some(t) } else { None }
|
||||
}
|
||||
@@ -35,10 +38,11 @@ impl bool {
|
||||
#[stable(feature = "lazy_bool_to_option", since = "1.50.0")]
|
||||
#[rustc_const_unstable(feature = "const_bool_to_option", issue = "91917")]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn then<T, F>(self, f: F) -> Option<T>
|
||||
where
|
||||
F: ~const FnOnce() -> T,
|
||||
F: ~const Drop,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
{
|
||||
if self { Some(f()) } else { None }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user