diff options
| author | bors <bors@rust-lang.org> | 2019-07-01 18:49:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-07-01 18:49:30 +0000 |
| commit | 17e62f77f954bed97aae839624bfd6dd68342daf (patch) | |
| tree | 24ae773056f52c261de7bd43bc5bb77ac7184e25 | |
| parent | 6ea4036cd20a4b1ab1d56e555108c21735ff6946 (diff) | |
| parent | a683bb175468354a4ebec51667fec8c3d467240f (diff) | |
| download | rust-17e62f77f954bed97aae839624bfd6dd68342daf.tar.gz rust-17e62f77f954bed97aae839624bfd6dd68342daf.zip | |
Auto merge of #62267 - GuillaumeGomez:revert-implicit-option-return, r=Centril
Revert "implicit `Option`-returning doctests" Reverts #61279 as discussed in #61360. cc @Centril
| -rw-r--r-- | src/doc/rustdoc/src/documentation-tests.md | 13 | ||||
| -rw-r--r-- | src/librustdoc/test.rs | 7 | ||||
| -rw-r--r-- | src/test/rustdoc/process-termination.rs | 12 |
3 files changed, 1 insertions, 31 deletions
diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index a896ce819ae..c9acd3c307b 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 7b90561bdad..63545ab45bf 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 31ae0143d47..32258792b6e 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() {} |
