From a683bb175468354a4ebec51667fec8c3d467240f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 1 Jul 2019 16:41:37 +0200 Subject: [PATCH] Revert "implicit `Option`-returning doctests" This reverts commit 6bb6c001be34d0932a014df981ee18f165c43374. --- src/doc/rustdoc/src/documentation-tests.md | 13 ------------- src/librustdoc/test.rs | 7 +------ src/test/rustdoc/process-termination.rs | 12 ------------ 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index a896ce819aeb7..c9acd3c307b54 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -253,19 +253,6 @@ conversion, so type inference fails because the type is not unique. Please note that you must write the `(())` in one sequence without intermediate whitespace so that rustdoc understands you want an implicit `Result`-returning function. -As of version 1.37.0, this simplification also works with `Option`s, which can -be handy to test e.g. iterators or checked arithmetic, for example: - -```ignore -/// ``` -/// let _ = &[].iter().next()?; -///# Some(()) -/// ``` -``` - -Note that the result must be a `Some(())` and this has to be written in one go. -In this case disambiguating the result isn't required. - ## Documenting macros Here’s an example of documenting a macro: diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 7b90561bdadb9..63545ab45bf64 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -528,13 +528,8 @@ pub fn make_test(s: &str, prog.push_str(everything_else); } else { let returns_result = everything_else.trim_end().ends_with("(())"); - let returns_option = everything_else.trim_end().ends_with("Some(())"); let (main_pre, main_post) = if returns_result { - (if returns_option { - "fn main() { fn _inner() -> Option<()> {" - } else { - "fn main() { fn _inner() -> Result<(), impl core::fmt::Debug> {" - }, + ("fn main() { fn _inner() -> Result<(), impl core::fmt::Debug> {", "}\n_inner().unwrap() }") } else { ("fn main() {\n", "\n}") diff --git a/src/test/rustdoc/process-termination.rs b/src/test/rustdoc/process-termination.rs index 31ae0143d4771..32258792b6e8b 100644 --- a/src/test/rustdoc/process-termination.rs +++ b/src/test/rustdoc/process-termination.rs @@ -21,16 +21,4 @@ /// Err("This is returned from `main`, leading to panic")?; /// Ok::<(), &'static str>(()) /// ``` -/// -/// This also works with `Option<()>`s now: -/// -/// ```rust -/// Some(()) -/// ``` -/// -/// ```rust,should_panic -/// let x: &[u32] = &[]; -/// let _ = x.iter().next()?; -/// Some(()) -/// ``` pub fn check_process_termination() {}