Skip to content

Commit 17e62f7

Browse files
committed
Auto merge of #62267 - GuillaumeGomez:revert-implicit-option-return, r=Centril
Revert "implicit `Option`-returning doctests" Reverts #61279 as discussed in #61360. cc @Centril
2 parents 6ea4036 + a683bb1 commit 17e62f7

File tree

3 files changed

+1
-31
lines changed

3 files changed

+1
-31
lines changed

src/doc/rustdoc/src/documentation-tests.md

-13
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,6 @@ conversion, so type inference fails because the type is not unique. Please note
253253
that you must write the `(())` in one sequence without intermediate whitespace
254254
so that rustdoc understands you want an implicit `Result`-returning function.
255255

256-
As of version 1.37.0, this simplification also works with `Option`s, which can
257-
be handy to test e.g. iterators or checked arithmetic, for example:
258-
259-
```ignore
260-
/// ```
261-
/// let _ = &[].iter().next()?;
262-
///# Some(())
263-
/// ```
264-
```
265-
266-
Note that the result must be a `Some(())` and this has to be written in one go.
267-
In this case disambiguating the result isn't required.
268-
269256
## Documenting macros
270257

271258
Here’s an example of documenting a macro:

src/librustdoc/test.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,8 @@ pub fn make_test(s: &str,
528528
prog.push_str(everything_else);
529529
} else {
530530
let returns_result = everything_else.trim_end().ends_with("(())");
531-
let returns_option = everything_else.trim_end().ends_with("Some(())");
532531
let (main_pre, main_post) = if returns_result {
533-
(if returns_option {
534-
"fn main() { fn _inner() -> Option<()> {"
535-
} else {
536-
"fn main() { fn _inner() -> Result<(), impl core::fmt::Debug> {"
537-
},
532+
("fn main() { fn _inner() -> Result<(), impl core::fmt::Debug> {",
538533
"}\n_inner().unwrap() }")
539534
} else {
540535
("fn main() {\n", "\n}")

src/test/rustdoc/process-termination.rs

-12
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,4 @@
2121
/// Err("This is returned from `main`, leading to panic")?;
2222
/// Ok::<(), &'static str>(())
2323
/// ```
24-
///
25-
/// This also works with `Option<()>`s now:
26-
///
27-
/// ```rust
28-
/// Some(())
29-
/// ```
30-
///
31-
/// ```rust,should_panic
32-
/// let x: &[u32] = &[];
33-
/// let _ = x.iter().next()?;
34-
/// Some(())
35-
/// ```
3624
pub fn check_process_termination() {}

0 commit comments

Comments
 (0)