Update to new bootstrap compiler

This commit is contained in:
Mark Rousskov 2021-06-24 12:47:33 -04:00
parent 17ea490310
commit 06661ba759
25 changed files with 11 additions and 394 deletions

View File

@ -10,7 +10,6 @@
)]
#![feature(box_syntax)]
#![feature(box_patterns)]
#![cfg_attr(bootstrap, feature(const_fn_unsize))]
#![feature(const_fn_transmute)]
#![feature(crate_visibility_modifier)]
#![feature(iter_zip)]

View File

@ -8,7 +8,6 @@
#![feature(bool_to_option)]
#![feature(const_cstr_unchecked)]
#![feature(crate_visibility_modifier)]
#![cfg_attr(bootstrap, feature(extended_key_value_attributes))]
#![feature(extern_types)]
#![feature(in_band_lifetimes)]
#![feature(iter_zip)]

View File

@ -5,7 +5,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(crate_visibility_modifier)]
#![feature(backtrace)]
#![cfg_attr(bootstrap, feature(extended_key_value_attributes))]
#![feature(format_args_capture)]
#![feature(iter_zip)]
#![feature(nll)]

View File

@ -3,7 +3,6 @@
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
#![feature(crate_visibility_modifier)]
#![cfg_attr(bootstrap, feature(extended_key_value_attributes))]
#![feature(in_band_lifetimes)]
#![feature(once_cell)]
#![feature(min_specialization)]

View File

@ -136,8 +136,7 @@
#![feature(maybe_uninit_extra, maybe_uninit_slice, maybe_uninit_uninit_array)]
#![feature(alloc_layout_extra)]
#![feature(trusted_random_access)]
#![cfg_attr(bootstrap, feature(try_trait))]
#![cfg_attr(not(bootstrap), feature(try_trait_v2))]
#![feature(try_trait_v2)]
#![feature(min_type_alias_impl_trait)]
#![feature(associated_type_bounds)]
#![feature(slice_group_by)]

View File

@ -130,7 +130,6 @@ where
}
#[inline]
#[cfg(not(bootstrap))]
fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
where
Self: Sized,
@ -150,28 +149,6 @@ where
}
}
#[inline]
#[cfg(bootstrap)]
fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
where
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Output = B>,
{
let _use_the_import: ControlFlow<()>;
match self.peeked.take() {
Some(None) => try { init },
Some(Some(v)) => match self.iter.try_rfold(init, &mut f).into_result() {
Ok(acc) => f(acc, v),
Err(e) => {
self.peeked = Some(Some(v));
R::from_error(e)
}
},
None => self.iter.try_rfold(init, f),
}
}
#[inline]
fn rfold<Acc, Fold>(self, init: Acc, mut fold: Fold) -> Acc
where

View File

@ -2439,7 +2439,6 @@ pub trait Iterator {
/// ```
#[inline]
#[unstable(feature = "try_find", reason = "new API", issue = "63178")]
#[cfg(not(bootstrap))]
fn try_find<F, R, E>(&mut self, f: F) -> Result<Option<Self::Item>, E>
where
Self: Sized,
@ -2466,32 +2465,6 @@ pub trait Iterator {
self.try_fold((), check(f)).break_value().transpose()
}
/// We're bootstrapping.
#[inline]
#[unstable(feature = "try_find", reason = "new API", issue = "63178")]
#[cfg(bootstrap)]
fn try_find<F, R>(&mut self, f: F) -> Result<Option<Self::Item>, R::Error>
where
Self: Sized,
F: FnMut(&Self::Item) -> R,
R: Try<Output = bool>,
{
#[inline]
fn check<F, T, R>(mut f: F) -> impl FnMut((), T) -> ControlFlow<Result<T, R::Error>>
where
F: FnMut(&T) -> R,
R: Try<Output = bool>,
{
move |(), x| match f(&x).into_result() {
Ok(false) => ControlFlow::CONTINUE,
Ok(true) => ControlFlow::Break(Ok(x)),
Err(x) => ControlFlow::Break(Err(x)),
}
}
self.try_fold((), check(f)).break_value().transpose()
}
/// Searches for an element in an iterator, returning its index.
///
/// `position()` takes a closure that returns `true` or `false`. It applies

View File

@ -87,7 +87,6 @@
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_fn_trait_bound)]
#![cfg_attr(bootstrap, feature(const_fn))]
#![feature(const_option)]
#![feature(const_precise_live_drops)]
#![feature(const_ptr_offset)]
@ -112,7 +111,6 @@
#![feature(doc_cfg)]
#![feature(doc_notable_trait)]
#![feature(duration_consts_2)]
#![cfg_attr(bootstrap, feature(extended_key_value_attributes))]
#![feature(extern_types)]
#![feature(fundamental)]
#![feature(intra_doc_pointers)]
@ -165,7 +163,6 @@
#![feature(slice_ptr_get)]
#![feature(no_niche)] // rust-lang/rust#68303
#![feature(no_coverage)] // rust-lang/rust#84605
#![cfg_attr(bootstrap, feature(target_feature_11))]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(or_patterns_back_compat)]

View File

@ -31,7 +31,7 @@ use crate::hash::Hasher;
/// [ub]: ../../reference/behavior-considered-undefined.html
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "send_trait")]
#[cfg_attr(not(bootstrap), lang = "send")]
#[lang = "send"]
#[rustc_on_unimplemented(
message = "`{Self}` cannot be sent between threads safely",
label = "`{Self}` cannot be sent between threads safely"

View File

@ -51,39 +51,17 @@ use crate::{convert, ops};
pub enum ControlFlow<B, C = ()> {
/// Move on to the next phase of the operation as normal.
#[stable(feature = "control_flow_enum_type", since = "1.55.0")]
#[cfg_attr(not(bootstrap), lang = "Continue")]
#[lang = "Continue"]
Continue(C),
/// Exit the operation without running subsequent phases.
#[stable(feature = "control_flow_enum_type", since = "1.55.0")]
#[cfg_attr(not(bootstrap), lang = "Break")]
#[lang = "Break"]
Break(B),
// Yes, the order of the variants doesn't match the type parameters.
// They're in this order so that `ControlFlow<A, B>` <-> `Result<B, A>`
// is a no-op conversion in the `Try` implementation.
}
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
#[cfg(bootstrap)]
impl<B, C> ops::TryV1 for ControlFlow<B, C> {
type Output = C;
type Error = B;
#[inline]
fn into_result(self) -> Result<Self::Output, Self::Error> {
match self {
ControlFlow::Continue(y) => Ok(y),
ControlFlow::Break(x) => Err(x),
}
}
#[inline]
fn from_error(v: Self::Error) -> Self {
ControlFlow::Break(v)
}
#[inline]
fn from_ok(v: Self::Output) -> Self {
ControlFlow::Continue(v)
}
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
impl<B, C> ops::TryV2 for ControlFlow<B, C> {
type Output = C;
@ -184,31 +162,9 @@ impl<B, C> ControlFlow<B, C> {
}
}
#[cfg(bootstrap)]
impl<R: ops::TryV1> ControlFlow<R, R::Output> {
/// Create a `ControlFlow` from any type implementing `Try`.
#[inline]
pub(crate) fn from_try(r: R) -> Self {
match R::into_result(r) {
Ok(v) => ControlFlow::Continue(v),
Err(v) => ControlFlow::Break(R::from_error(v)),
}
}
/// Convert a `ControlFlow` into any type implementing `Try`;
#[inline]
pub(crate) fn into_try(self) -> R {
match self {
ControlFlow::Continue(v) => R::from_ok(v),
ControlFlow::Break(v) => v,
}
}
}
/// These are used only as part of implementing the iterator adapters.
/// They have mediocre names and non-obvious semantics, so aren't
/// currently on a path to potential stabilization.
#[cfg(not(bootstrap))]
impl<R: ops::TryV2> ControlFlow<R, R::Output> {
/// Create a `ControlFlow` from any type implementing `Try`.
#[inline]

View File

@ -147,8 +147,6 @@ mod function;
mod generator;
mod index;
mod range;
#[cfg(bootstrap)]
mod r#try;
mod try_trait;
mod unsize;
@ -183,19 +181,10 @@ pub use self::range::{Range, RangeFrom, RangeFull, RangeTo};
#[stable(feature = "inclusive_range", since = "1.26.0")]
pub use self::range::{Bound, RangeBounds, RangeInclusive, RangeToInclusive};
#[unstable(feature = "try_trait", issue = "42327")]
#[cfg(bootstrap)]
pub use self::r#try::Try;
#[unstable(feature = "try_trait_transition", reason = "for bootstrap", issue = "none")]
#[cfg(bootstrap)]
pub(crate) use self::r#try::Try as TryV1;
#[unstable(feature = "try_trait_v2", issue = "84277")]
pub use self::try_trait::FromResidual;
#[unstable(feature = "try_trait_v2", issue = "84277")]
#[cfg(not(bootstrap))]
pub use self::try_trait::Try;
#[unstable(feature = "try_trait_transition", reason = "for bootstrap", issue = "none")]

View File

@ -1,61 +0,0 @@
/// A trait for customizing the behavior of the `?` operator.
///
/// A type implementing `Try` is one that has a canonical way to view it
/// in terms of a success/failure dichotomy. This trait allows both
/// extracting those success or failure values from an existing instance and
/// creating a new instance from a success or failure value.
#[unstable(feature = "try_trait", issue = "42327")]
#[rustc_on_unimplemented(
on(
all(
any(from_method = "from_error", from_method = "from_ok"),
from_desugaring = "QuestionMark"
),
message = "the `?` operator can only be used in {ItemContext} \
that returns `Result` or `Option` \
(or another type that implements `{Try}`)",
label = "cannot use the `?` operator in {ItemContext} that returns `{Self}`",
enclosing_scope = "this function should return `Result` or `Option` to accept `?`"
),
on(
all(from_method = "into_result", from_desugaring = "QuestionMark"),
message = "the `?` operator can only be applied to values \
that implement `{Try}`",
label = "the `?` operator cannot be applied to type `{Self}`"
)
)]
#[doc(alias = "?")]
#[cfg_attr(bootstrap, lang = "try")]
pub trait Try {
/// The type of this value when viewed as successful.
#[unstable(feature = "try_trait", issue = "42327")]
type Output; // This no longer follows its RFC, but is only used in bootstrap.
/// The type of this value when viewed as failed.
#[unstable(feature = "try_trait", issue = "42327")]
type Error;
/// Applies the "?" operator. A return of `Ok(t)` means that the
/// execution should continue normally, and the result of `?` is the
/// value `t`. A return of `Err(e)` means that execution should branch
/// to the innermost enclosing `catch`, or return from the function.
///
/// If an `Err(e)` result is returned, the value `e` will be "wrapped"
/// in the return type of the enclosing scope (which must itself implement
/// `Try`). Specifically, the value `X::from_error(From::from(e))`
/// is returned, where `X` is the return type of the enclosing function.
#[cfg_attr(bootstrap, lang = "into_result")]
#[unstable(feature = "try_trait", issue = "42327")]
fn into_result(self) -> Result<Self::Output, Self::Error>;
/// Wrap an error value to construct the composite result. For example,
/// `Result::Err(x)` and `Result::from_error(x)` are equivalent.
#[cfg_attr(bootstrap, lang = "from_error")]
#[unstable(feature = "try_trait", issue = "42327")]
fn from_error(v: Self::Error) -> Self;
/// Wrap an OK value to construct the composite result. For example,
/// `Result::Ok(x)` and `Result::from_ok(x)` are equivalent.
#[cfg_attr(bootstrap, lang = "from_ok")]
#[unstable(feature = "try_trait", issue = "42327")]
fn from_ok(v: Self::Output) -> Self;
}

View File

@ -128,7 +128,7 @@ use crate::ops::ControlFlow;
)
)]
#[doc(alias = "?")]
#[cfg_attr(not(bootstrap), lang = "Try")]
#[lang = "Try"]
pub trait Try: FromResidual {
/// The type of the value produced by `?` when *not* short-circuiting.
#[unstable(feature = "try_trait_v2", issue = "84277")]
@ -186,7 +186,7 @@ pub trait Try: FromResidual {
/// let r = std::iter::empty().try_fold(4, |_, ()| -> Option<_> { unreachable!() });
/// assert_eq!(r, Some(4));
/// ```
#[cfg_attr(not(bootstrap), lang = "from_output")]
#[lang = "from_output"]
#[unstable(feature = "try_trait_v2", issue = "84277")]
fn from_output(output: Self::Output) -> Self;
@ -213,7 +213,7 @@ pub trait Try: FromResidual {
/// ControlFlow::Break(ControlFlow::Break(3)),
/// );
/// ```
#[cfg_attr(not(bootstrap), lang = "branch")]
#[lang = "branch"]
#[unstable(feature = "try_trait_v2", issue = "84277")]
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
}
@ -334,7 +334,7 @@ pub trait FromResidual<R = <Self as Try>::Residual> {
/// ControlFlow::Break(5),
/// );
/// ```
#[cfg_attr(not(bootstrap), lang = "from_residual")]
#[lang = "from_residual"]
#[unstable(feature = "try_trait_v2", issue = "84277")]
fn from_residual(residual: R) -> Self;
}

View File

@ -1636,38 +1636,6 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
}
}
/// The error type that results from applying the try operator (`?`) to a `None` value. If you wish
/// to allow `x?` (where `x` is an `Option<T>`) to be converted into your error type, you can
/// implement `impl From<NoneError>` for `YourErrorType`. In that case, `x?` within a function that
/// returns `Result<_, YourErrorType>` will translate a `None` value into an `Err` result.
#[rustc_diagnostic_item = "none_error"]
#[unstable(feature = "try_trait", issue = "42327")]
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
#[cfg(bootstrap)]
pub struct NoneError;
#[unstable(feature = "try_trait", issue = "42327")]
#[cfg(bootstrap)]
impl<T> ops::TryV1 for Option<T> {
type Output = T;
type Error = NoneError;
#[inline]
fn into_result(self) -> Result<T, NoneError> {
self.ok_or(NoneError)
}
#[inline]
fn from_ok(v: T) -> Self {
Some(v)
}
#[inline]
fn from_error(_: NoneError) -> Self {
None
}
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
impl<T> ops::TryV2 for Option<T> {
type Output = T;

View File

@ -1626,28 +1626,6 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
}
}
#[unstable(feature = "try_trait", issue = "42327")]
#[cfg(bootstrap)]
impl<T, E> ops::TryV1 for Result<T, E> {
type Output = T;
type Error = E;
#[inline]
fn into_result(self) -> Self {
self
}
#[inline]
fn from_ok(v: T) -> Self {
Ok(v)
}
#[inline]
fn from_error(v: E) -> Self {
Err(v)
}
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
impl<T, E> ops::TryV2 for Result<T, E> {
type Output = T;

View File

@ -128,32 +128,6 @@ impl<T> From<T> for Poll<T> {
}
}
#[stable(feature = "futures_api", since = "1.36.0")]
#[cfg(bootstrap)]
impl<T, E> ops::TryV1 for Poll<Result<T, E>> {
type Output = Poll<T>;
type Error = E;
#[inline]
fn into_result(self) -> Result<Self::Output, Self::Error> {
match self {
Poll::Ready(Ok(x)) => Ok(Poll::Ready(x)),
Poll::Ready(Err(e)) => Err(e),
Poll::Pending => Ok(Poll::Pending),
}
}
#[inline]
fn from_error(e: Self::Error) -> Self {
Poll::Ready(Err(e))
}
#[inline]
fn from_ok(x: Self::Output) -> Self {
x.map(Ok)
}
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
impl<T, E> ops::TryV2 for Poll<Result<T, E>> {
type Output = Poll<T>;
@ -184,33 +158,6 @@ impl<T, E, F: From<E>> ops::FromResidual<Result<convert::Infallible, E>> for Pol
}
}
#[stable(feature = "futures_api", since = "1.36.0")]
#[cfg(bootstrap)]
impl<T, E> ops::TryV1 for Poll<Option<Result<T, E>>> {
type Output = Poll<Option<T>>;
type Error = E;
#[inline]
fn into_result(self) -> Result<Self::Output, Self::Error> {
match self {
Poll::Ready(Some(Ok(x))) => Ok(Poll::Ready(Some(x))),
Poll::Ready(Some(Err(e))) => Err(e),
Poll::Ready(None) => Ok(Poll::Ready(None)),
Poll::Pending => Ok(Poll::Pending),
}
}
#[inline]
fn from_error(e: Self::Error) -> Self {
Poll::Ready(Some(Err(e)))
}
#[inline]
fn from_ok(x: Self::Output) -> Self {
x.map(|x| x.map(Ok))
}
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
impl<T, E> ops::TryV2 for Poll<Option<Result<T, E>>> {
type Output = Poll<Option<T>>;

View File

@ -391,7 +391,6 @@ fn result_opt_conversions() {
}
#[test]
#[cfg(not(bootstrap))] // Needs the V2 trait
fn result_try_trait_v2_branch() {
use core::num::NonZeroU32;
use core::ops::{ControlFlow::*, Try};

View File

@ -268,7 +268,6 @@
#![feature(exact_size_is_empty)]
#![feature(exhaustive_patterns)]
#![feature(extend_one)]
#![cfg_attr(bootstrap, feature(extended_key_value_attributes))]
#![feature(float_interpolation)]
#![feature(fn_traits)]
#![feature(format_args_nl)]

View File

@ -133,7 +133,7 @@ pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
/// [`AssertUnwindSafe`] wrapper struct can be used to force this trait to be
/// implemented for any closed over variables passed to `catch_unwind`.
#[stable(feature = "catch_unwind", since = "1.9.0")]
#[cfg_attr(all(not(bootstrap), not(test)), lang = "unwind_safe")]
#[cfg_attr(not(test), lang = "unwind_safe")]
#[rustc_on_unimplemented(
message = "the type `{Self}` may not be safely transferred across an unwind boundary",
label = "`{Self}` may not be safely transferred across an unwind boundary"
@ -149,7 +149,7 @@ pub auto trait UnwindSafe {}
/// This is a "helper marker trait" used to provide impl blocks for the
/// [`UnwindSafe`] trait, for more information see that documentation.
#[stable(feature = "catch_unwind", since = "1.9.0")]
#[cfg_attr(all(not(bootstrap), not(test)), lang = "ref_unwind_safe")]
#[cfg_attr(not(test), lang = "ref_unwind_safe")]
#[rustc_on_unimplemented(
message = "the type `{Self}` may contain interior mutability and a reference may not be safely \
transferrable across a catch_unwind boundary",

View File

@ -61,9 +61,7 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
ignore: true,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -75,9 +73,7 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -97,9 +93,7 @@ pub fn do_not_run_ignored_tests() {
ignore: true,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -120,9 +114,7 @@ pub fn ignored_tests_result_in_ignored() {
ignore: true,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -147,9 +139,7 @@ fn test_should_panic() {
ignore: false,
should_panic: ShouldPanic::Yes,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -174,9 +164,7 @@ fn test_should_panic_good_message() {
ignore: false,
should_panic: ShouldPanic::YesWithMessage("error message"),
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -206,9 +194,7 @@ fn test_should_panic_bad_message() {
ignore: false,
should_panic: ShouldPanic::YesWithMessage(expected),
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -242,9 +228,7 @@ fn test_should_panic_non_string_message_type() {
ignore: false,
should_panic: ShouldPanic::YesWithMessage(expected),
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -270,9 +254,7 @@ fn test_should_panic_but_succeeds() {
ignore: false,
should_panic,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -306,9 +288,7 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -343,9 +323,7 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type,
},
@ -384,9 +362,7 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type,
}
@ -499,9 +475,7 @@ pub fn exclude_should_panic_option() {
ignore: false,
should_panic: ShouldPanic::Yes,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -525,9 +499,7 @@ pub fn exact_filter_match() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -621,9 +593,7 @@ pub fn sort_tests() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
@ -702,9 +672,7 @@ pub fn test_bench_no_iter() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
};
@ -726,9 +694,7 @@ pub fn test_bench_iter() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
};
@ -744,9 +710,7 @@ fn should_sort_failures_before_printing_them() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
};
@ -756,9 +720,7 @@ fn should_sort_failures_before_printing_them() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
};

View File

@ -124,9 +124,7 @@ pub struct TestDesc {
pub ignore: bool,
pub should_panic: options::ShouldPanic,
pub allow_fail: bool,
#[cfg(not(bootstrap))]
pub compile_fail: bool,
#[cfg(not(bootstrap))]
pub no_run: bool,
pub test_type: TestType,
}
@ -147,7 +145,6 @@ impl TestDesc {
/// Returns None for ignored test or that that are just run, otherwise give a description of the type of test.
/// Descriptions include "should panic", "compile fail" and "compile".
#[cfg(not(bootstrap))]
pub fn test_mode(&self) -> Option<&'static str> {
if self.ignore {
return None;
@ -169,11 +166,6 @@ impl TestDesc {
}
None
}
#[cfg(bootstrap)]
pub fn test_mode(&self) -> Option<&'static str> {
None
}
}
#[derive(Debug)]

View File

@ -1,50 +0,0 @@
# `try_trait`
The tracking issue for this feature is: [#42327]
[#42327]: https://github.com/rust-lang/rust/issues/42327
------------------------
This introduces a new trait `Try` for extending the `?` operator to types
other than `Result` (a part of [RFC 1859]). The trait provides the canonical
way to _view_ a type in terms of a success/failure dichotomy. This will
allow `?` to supplant the `try_opt!` macro on `Option` and the `try_ready!`
macro on `Poll`, among other things.
[RFC 1859]: https://github.com/rust-lang/rfcs/pull/1859
Here's an example implementation of the trait:
```rust,ignore (cannot-reimpl-Try)
/// A distinct type to represent the `None` value of an `Option`.
///
/// This enables using the `?` operator on `Option`; it's rarely useful alone.
#[derive(Debug)]
#[unstable(feature = "try_trait", issue = "42327")]
pub struct None { _priv: () }
#[unstable(feature = "try_trait", issue = "42327")]
impl<T> ops::Try for Option<T> {
type Ok = T;
type Error = None;
fn into_result(self) -> Result<T, None> {
self.ok_or(None { _priv: () })
}
fn from_ok(v: T) -> Self {
Some(v)
}
fn from_error(_: None) -> Self {
None
}
}
```
Note the `Error` associated type here is a new marker. The `?` operator
allows interconversion between different `Try` implementers only when
the error type can be converted `Into` the error type of the enclosing
function (or catch block). Having a distinct error type (as opposed to
just `()`, or similar) restricts this to where it's semantically meaningful.

View File

@ -942,9 +942,7 @@ impl Tester for Collector {
// compiler failures are test failures
should_panic: testing::ShouldPanic::No,
allow_fail: config.allow_fail,
#[cfg(not(bootstrap))]
compile_fail: config.compile_fail,
#[cfg(not(bootstrap))]
no_run,
test_type: testing::TestType::DocTest,
},

View File

@ -12,7 +12,7 @@
# stable release's version number. `date` is the date where the release we're
# bootstrapping off was released.
date: 2021-05-23
date: 2021-06-23
rustc: beta
# We use a nightly rustfmt to format the source because it solves some

View File

@ -903,9 +903,7 @@ pub fn make_test_description<R: Read>(
ignore,
should_panic,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: test::TestType::Unknown,
}