From 06661ba7591b1531555cd084f75540d99ef35ac5 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 24 Jun 2021 12:47:33 -0400 Subject: [PATCH] Update to new bootstrap compiler --- compiler/rustc_ast/src/lib.rs | 1 - compiler/rustc_codegen_llvm/src/lib.rs | 1 - compiler/rustc_errors/src/lib.rs | 1 - compiler/rustc_hir/src/lib.rs | 1 - library/alloc/src/lib.rs | 3 +- library/core/src/iter/adapters/peekable.rs | 23 ------- library/core/src/iter/traits/iterator.rs | 27 -------- library/core/src/lib.rs | 3 - library/core/src/marker.rs | 2 +- library/core/src/ops/control_flow.rs | 48 +-------------- library/core/src/ops/mod.rs | 11 ---- library/core/src/ops/try.rs | 61 ------------------- library/core/src/ops/try_trait.rs | 8 +-- library/core/src/option.rs | 32 ---------- library/core/src/result.rs | 22 ------- library/core/src/task/poll.rs | 53 ---------------- library/core/tests/result.rs | 1 - library/std/src/lib.rs | 1 - library/std/src/panic.rs | 4 +- library/test/src/tests.rs | 38 ------------ library/test/src/types.rs | 8 --- .../src/library-features/try-trait.md | 50 --------------- src/librustdoc/doctest.rs | 2 - src/stage0.txt | 2 +- src/tools/compiletest/src/header.rs | 2 - 25 files changed, 11 insertions(+), 394 deletions(-) delete mode 100644 library/core/src/ops/try.rs delete mode 100644 src/doc/unstable-book/src/library-features/try-trait.md diff --git a/compiler/rustc_ast/src/lib.rs b/compiler/rustc_ast/src/lib.rs index 7c79b4aab3c..3207aee6d2a 100644 --- a/compiler/rustc_ast/src/lib.rs +++ b/compiler/rustc_ast/src/lib.rs @@ -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)] diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 776cb2ee99b..fc890f23853 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -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)] diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 979f2d3b300..ca2386dfae2 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -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)] diff --git a/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs index ad2ecae9233..42575273839 100644 --- a/compiler/rustc_hir/src/lib.rs +++ b/compiler/rustc_hir/src/lib.rs @@ -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)] diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 7b0291c5f2e..e8bd4bcb01f 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -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)] diff --git a/library/core/src/iter/adapters/peekable.rs b/library/core/src/iter/adapters/peekable.rs index 69bd2996efe..91fa1a9ad35 100644 --- a/library/core/src/iter/adapters/peekable.rs +++ b/library/core/src/iter/adapters/peekable.rs @@ -130,7 +130,6 @@ where } #[inline] - #[cfg(not(bootstrap))] fn try_rfold(&mut self, init: B, mut f: F) -> R where Self: Sized, @@ -150,28 +149,6 @@ where } } - #[inline] - #[cfg(bootstrap)] - fn try_rfold(&mut self, init: B, mut f: F) -> R - where - Self: Sized, - F: FnMut(B, Self::Item) -> R, - R: Try, - { - 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(self, init: Acc, mut fold: Fold) -> Acc where diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index 41d9993abaa..0032e8c3e47 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -2439,7 +2439,6 @@ pub trait Iterator { /// ``` #[inline] #[unstable(feature = "try_find", reason = "new API", issue = "63178")] - #[cfg(not(bootstrap))] fn try_find(&mut self, f: F) -> Result, 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(&mut self, f: F) -> Result, R::Error> - where - Self: Sized, - F: FnMut(&Self::Item) -> R, - R: Try, - { - #[inline] - fn check(mut f: F) -> impl FnMut((), T) -> ControlFlow> - where - F: FnMut(&T) -> R, - R: Try, - { - 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 diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 73959291481..7fa8202e5d6 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -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)] diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 2b240455043..271565693d6 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -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" diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index c26b5c67710..c2270c864df 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -51,39 +51,17 @@ use crate::{convert, ops}; pub enum ControlFlow { /// 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` <-> `Result` // is a no-op conversion in the `Try` implementation. } -#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")] -#[cfg(bootstrap)] -impl ops::TryV1 for ControlFlow { - type Output = C; - type Error = B; - #[inline] - fn into_result(self) -> Result { - 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 ops::TryV2 for ControlFlow { type Output = C; @@ -184,31 +162,9 @@ impl ControlFlow { } } -#[cfg(bootstrap)] -impl ControlFlow { - /// 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 ControlFlow { /// Create a `ControlFlow` from any type implementing `Try`. #[inline] diff --git a/library/core/src/ops/mod.rs b/library/core/src/ops/mod.rs index 139a8c0eec9..85e04740d96 100644 --- a/library/core/src/ops/mod.rs +++ b/library/core/src/ops/mod.rs @@ -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")] diff --git a/library/core/src/ops/try.rs b/library/core/src/ops/try.rs deleted file mode 100644 index 9d659e78d3c..00000000000 --- a/library/core/src/ops/try.rs +++ /dev/null @@ -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; - - /// 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; -} diff --git a/library/core/src/ops/try_trait.rs b/library/core/src/ops/try_trait.rs index 0eec52a8701..bd46fb6f2cf 100644 --- a/library/core/src/ops/try_trait.rs +++ b/library/core/src/ops/try_trait.rs @@ -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; } @@ -334,7 +334,7 @@ pub trait FromResidual::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; } diff --git a/library/core/src/option.rs b/library/core/src/option.rs index aedfe88f688..13de1cb3092 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1636,38 +1636,6 @@ impl> FromIterator> for Option { } } -/// 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`) to be converted into your error type, you can -/// implement `impl From` 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 ops::TryV1 for Option { - type Output = T; - type Error = NoneError; - - #[inline] - fn into_result(self) -> Result { - 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 ops::TryV2 for Option { type Output = T; diff --git a/library/core/src/result.rs b/library/core/src/result.rs index babd0a0b552..325efe721e3 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1626,28 +1626,6 @@ impl> FromIterator> for Result { } } -#[unstable(feature = "try_trait", issue = "42327")] -#[cfg(bootstrap)] -impl ops::TryV1 for Result { - 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 ops::TryV2 for Result { type Output = T; diff --git a/library/core/src/task/poll.rs b/library/core/src/task/poll.rs index 9cf89623d88..ce5a8a86a30 100644 --- a/library/core/src/task/poll.rs +++ b/library/core/src/task/poll.rs @@ -128,32 +128,6 @@ impl From for Poll { } } -#[stable(feature = "futures_api", since = "1.36.0")] -#[cfg(bootstrap)] -impl ops::TryV1 for Poll> { - type Output = Poll; - type Error = E; - - #[inline] - fn into_result(self) -> Result { - 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 ops::TryV2 for Poll> { type Output = Poll; @@ -184,33 +158,6 @@ impl> ops::FromResidual> for Pol } } -#[stable(feature = "futures_api", since = "1.36.0")] -#[cfg(bootstrap)] -impl ops::TryV1 for Poll>> { - type Output = Poll>; - type Error = E; - - #[inline] - fn into_result(self) -> Result { - 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 ops::TryV2 for Poll>> { type Output = Poll>; diff --git a/library/core/tests/result.rs b/library/core/tests/result.rs index f4e5e7751b8..612f083a5c1 100644 --- a/library/core/tests/result.rs +++ b/library/core/tests/result.rs @@ -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}; diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 1cfa71e250f..25f6b3c0182 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -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)] diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs index 9e3880dfd41..ee069eefd45 100644 --- a/library/std/src/panic.rs +++ b/library/std/src/panic.rs @@ -133,7 +133,7 @@ pub fn panic_any(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", diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs index 5a4a540b04e..794f7277004 100644 --- a/library/test/src/tests.rs +++ b/library/test/src/tests.rs @@ -61,9 +61,7 @@ fn one_ignored_one_unignored_test() -> Vec { 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 { 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 { 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, }; diff --git a/library/test/src/types.rs b/library/test/src/types.rs index 63907c71ea7..3512a57e8e4 100644 --- a/library/test/src/types.rs +++ b/library/test/src/types.rs @@ -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)] diff --git a/src/doc/unstable-book/src/library-features/try-trait.md b/src/doc/unstable-book/src/library-features/try-trait.md deleted file mode 100644 index 022640067bd..00000000000 --- a/src/doc/unstable-book/src/library-features/try-trait.md +++ /dev/null @@ -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 ops::Try for Option { - type Ok = T; - type Error = None; - - fn into_result(self) -> Result { - 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. diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 1750f05b4dc..7aa54241450 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -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, }, diff --git a/src/stage0.txt b/src/stage0.txt index 1027057f385..e9d0b73e94d 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -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 diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 764f2055277..68e28795347 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -903,9 +903,7 @@ pub fn make_test_description( ignore, should_panic, allow_fail: false, - #[cfg(not(bootstrap))] compile_fail: false, - #[cfg(not(bootstrap))] no_run: false, test_type: test::TestType::Unknown, }