diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2021-06-24 12:47:33 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2021-06-28 11:30:49 -0400 |
| commit | 06661ba7591b1531555cd084f75540d99ef35ac5 (patch) | |
| tree | 34f973a21aab174c82621ccc33d53525e917970c /src | |
| parent | 17ea490310ba7c836c93fe1b7002555b3bea5eb1 (diff) | |
| download | rust-06661ba7591b1531555cd084f75540d99ef35ac5.tar.gz rust-06661ba7591b1531555cd084f75540d99ef35ac5.zip | |
Update to new bootstrap compiler
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/unstable-book/src/library-features/try-trait.md | 50 | ||||
| -rw-r--r-- | src/librustdoc/doctest.rs | 2 | ||||
| -rw-r--r-- | src/stage0.txt | 2 | ||||
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 2 |
4 files changed, 1 insertions, 55 deletions
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<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. 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<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, } |
