forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#56470 - llogiq:process-termination-doctest,…
… r=GuillaumeGomez Modify doctest's auto-`fn main()` to allow `Result`s This lets the default `fn main()` ~~return `impl Termination`~~ unwrap Results, which allows the use of `?` in most tests without adding it manually. This fixes rust-lang#56260 ~~Blocked on `std::process::Termination` stabilization.~~ Using `Termination` would have been cleaner, but this should work OK.
- Loading branch information
Showing
3 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// compile-flags:--test | ||
|
||
/// A check of using various process termination strategies | ||
/// | ||
/// # Examples | ||
/// | ||
/// ```rust | ||
/// assert!(true); // this returns `()`, all is well | ||
/// ``` | ||
/// | ||
/// You can also simply return `Ok(())`, but you'll need to disambiguate the | ||
/// type using turbofish, because we cannot infer the type: | ||
/// | ||
/// ```rust | ||
/// Ok::<(), &'static str>(()) | ||
/// ``` | ||
/// | ||
/// You can err with anything that implements `Debug`: | ||
/// | ||
/// ```rust,should_panic | ||
/// Err("This is returned from `main`, leading to panic")?; | ||
/// Ok::<(), &'static str>(()) | ||
/// ``` | ||
pub fn check_process_termination() {} |