trivial cfg(bootstrap) changes
This commit is contained in:
parent
e96538aeeb
commit
181d28bb61
42 changed files with 176 additions and 314 deletions
|
@ -773,10 +773,9 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn unwrap_or(self, default: T) -> T
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => x,
|
||||
|
@ -796,11 +795,10 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn unwrap_or_else<F>(self, f: F) -> T
|
||||
where
|
||||
F: ~const FnOnce() -> T,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => x,
|
||||
|
@ -902,11 +900,10 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn map<U, F>(self, f: F) -> Option<U>
|
||||
where
|
||||
F: ~const FnOnce(T) -> U,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => Some(f(x)),
|
||||
|
@ -932,11 +929,10 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[unstable(feature = "result_option_inspect", issue = "91345")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn inspect<F>(self, f: F) -> Self
|
||||
where
|
||||
F: ~const FnOnce(&T),
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
if let Some(ref x) = self {
|
||||
f(x);
|
||||
|
@ -966,12 +962,11 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn map_or<U, F>(self, default: U, f: F) -> U
|
||||
where
|
||||
F: ~const FnOnce(T) -> U,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
U: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
U: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(t) => f(t),
|
||||
|
@ -996,13 +991,12 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
|
||||
where
|
||||
D: ~const FnOnce() -> U,
|
||||
D: ~const Drop + ~const Destruct,
|
||||
D: ~const Destruct,
|
||||
F: ~const FnOnce(T) -> U,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(t) => f(t),
|
||||
|
@ -1034,10 +1028,9 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn ok_or<E>(self, err: E) -> Result<T, E>
|
||||
where
|
||||
E: ~const Drop + ~const Destruct,
|
||||
E: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(v) => Ok(v),
|
||||
|
@ -1064,11 +1057,10 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>
|
||||
where
|
||||
F: ~const FnOnce() -> E,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(v) => Ok(v),
|
||||
|
@ -1199,11 +1191,10 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn and<U>(self, optb: Option<U>) -> Option<U>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
U: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
U: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(_) => optb,
|
||||
|
@ -1242,11 +1233,10 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn and_then<U, F>(self, f: F) -> Option<U>
|
||||
where
|
||||
F: ~const FnOnce(T) -> Option<U>,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => f(x),
|
||||
|
@ -1281,12 +1271,11 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "option_filter", since = "1.27.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn filter<P>(self, predicate: P) -> Self
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
P: ~const FnOnce(&T) -> bool,
|
||||
P: ~const Drop + ~const Destruct,
|
||||
P: ~const Destruct,
|
||||
{
|
||||
if let Some(x) = self {
|
||||
if predicate(&x) {
|
||||
|
@ -1326,10 +1315,9 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn or(self, optb: Option<T>) -> Option<T>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => Some(x),
|
||||
|
@ -1353,11 +1341,10 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn or_else<F>(self, f: F) -> Option<T>
|
||||
where
|
||||
F: ~const FnOnce() -> Option<T>,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
match self {
|
||||
Some(x) => Some(x),
|
||||
|
@ -1389,10 +1376,9 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "option_xor", since = "1.37.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn xor(self, optb: Option<T>) -> Option<T>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
match (self, optb) {
|
||||
(Some(a), None) => Some(a),
|
||||
|
@ -1428,10 +1414,9 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "option_insert", since = "1.53.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn insert(&mut self, value: T) -> &mut T
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
*self = Some(value);
|
||||
|
||||
|
@ -1462,10 +1447,9 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "option_entry", since = "1.20.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn get_or_insert(&mut self, value: T) -> &mut T
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
{
|
||||
if let None = *self {
|
||||
*self = Some(value);
|
||||
|
@ -1530,11 +1514,10 @@ impl<T> Option<T> {
|
|||
#[inline]
|
||||
#[stable(feature = "option_entry", since = "1.20.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T
|
||||
where
|
||||
F: ~const FnOnce() -> T,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
{
|
||||
if let None = *self {
|
||||
// the compiler isn't smart enough to know that we are not dropping a `T`
|
||||
|
@ -1645,11 +1628,10 @@ impl<T> Option<T> {
|
|||
/// ```
|
||||
#[stable(feature = "option_zip_option", since = "1.46.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>
|
||||
where
|
||||
T: ~const Drop + ~const Destruct,
|
||||
U: ~const Drop + ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
U: ~const Destruct,
|
||||
{
|
||||
match (self, other) {
|
||||
(Some(a), Some(b)) => Some((a, b)),
|
||||
|
@ -1687,13 +1669,12 @@ impl<T> Option<T> {
|
|||
/// ```
|
||||
#[unstable(feature = "option_zip", issue = "70086")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>
|
||||
where
|
||||
F: ~const FnOnce(T, U) -> R,
|
||||
F: ~const Drop + ~const Destruct,
|
||||
T: ~const Drop + ~const Destruct,
|
||||
U: ~const Drop + ~const Destruct,
|
||||
F: ~const Destruct,
|
||||
T: ~const Destruct,
|
||||
U: ~const Destruct,
|
||||
{
|
||||
match (self, other) {
|
||||
(Some(a), Some(b)) => Some(f(a, b)),
|
||||
|
@ -1880,10 +1861,9 @@ const fn expect_failed(msg: &str) -> ! {
|
|||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_clone", issue = "91805")]
|
||||
#[cfg_attr(not(bootstrap), allow(drop_bounds))] // FIXME remove `~const Drop` and this attr when bumping
|
||||
impl<T> const Clone for Option<T>
|
||||
where
|
||||
T: ~const Clone + ~const Drop + ~const Destruct,
|
||||
T: ~const Clone + ~const Destruct,
|
||||
{
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue