Skip to content

Rollup of 7 pull requests #140355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
12dd4a1
Stabilise c_str_module
clarfonthey Feb 22, 2025
6be84b1
Somehow these stability attributes were able to be omitted before?
clarfonthey Feb 22, 2025
3536324
Fix detection of `main` function if there are expressions around it
GuillaumeGomez Apr 23, 2025
81438c0
Add regression ui test for #140162 and for #139651
GuillaumeGomez Apr 23, 2025
8cd12bf
check types of const param default
lcnr Apr 10, 2025
70c389e
Correctly display stdout and stderr in case a doctest is failing
GuillaumeGomez Apr 25, 2025
c44068b
Add rustdoc-ui regression test for #140289
GuillaumeGomez Apr 25, 2025
3ededc1
Improve code
GuillaumeGomez Apr 25, 2025
3ef98a5
If there is a `;` alone, we consider that the doctest needs to be put…
GuillaumeGomez Apr 25, 2025
59b6cf5
uefi: Update r-efi
Ayush1325 Mar 20, 2025
43d8d89
clarified bootstrap optimization agrs
Kivooeo Apr 26, 2025
9112c86
Update example to use `CStr::to_string_lossy`
shepmaster Apr 25, 2025
aa69e3a
Fix bad handling of macros if there is already a `main` function
GuillaumeGomez Apr 26, 2025
1e295a2
Rollup merge of #137439 - clarfonthey:c-str-module, r=tgross35
tgross35 Apr 27, 2025
2e6c07b
Rollup merge of #138737 - Ayush1325:r-efi-update, r=tgross35
tgross35 Apr 27, 2025
2b7287e
Rollup merge of #139646 - lcnr:default-is-fully-concrete, r=BoxyUwU
tgross35 Apr 27, 2025
6900ea5
Rollup merge of #140220 - GuillaumeGomez:doctest-main-wrapping, r=fmease
tgross35 Apr 27, 2025
8ad1816
Rollup merge of #140291 - GuillaumeGomez:doctest-2024-stdout, r=notri…
tgross35 Apr 27, 2025
d3321a9
Rollup merge of #140297 - shepmaster:cstr-lossy, r=joboet
tgross35 Apr 27, 2025
64bb69a
Rollup merge of #140330 - Kivooeo:new-fix-five, r=clubby789
tgross35 Apr 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/librustdoc/doctest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,22 @@ mod __doctest_mod {{
.output()
.expect(\"failed to run command\");
if !out.status.success() {{
eprint!(\"{{}}\", String::from_utf8_lossy(&out.stderr));
if let Some(code) = out.status.code() {{
eprintln!(\"Test executable failed (exit status: {{code}}).\");
}} else {{
eprintln!(\"Test executable failed (terminated by signal).\");
}}
if !out.stdout.is_empty() || !out.stderr.is_empty() {{
eprintln!();
}}
if !out.stdout.is_empty() {{
eprintln!(\"stdout:\");
eprintln!(\"{{}}\", String::from_utf8_lossy(&out.stdout));
}}
if !out.stderr.is_empty() {{
eprintln!(\"stderr:\");
eprintln!(\"{{}}\", String::from_utf8_lossy(&out.stderr));
}}
ExitCode::FAILURE
}} else {{
ExitCode::SUCCESS
Expand Down
4 changes: 4 additions & 0 deletions tests/rustdoc-ui/doctest/edition-2024-error-output.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ test $DIR/edition-2024-error-output.rs - (line 12) ... FAILED
failures:

---- $DIR/edition-2024-error-output.rs - (line 12) stdout ----
Test executable failed (exit status: 101).

stderr:

thread 'main' panicked at $TMP:6:1:
assertion `left == right` failed
Expand All @@ -13,6 +16,7 @@ assertion `left == right` failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace



failures:
$DIR/edition-2024-error-output.rs - (line 12)

Expand Down
26 changes: 26 additions & 0 deletions tests/rustdoc-ui/doctest/stdout-and-stderr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This test ensures that the output is correctly generated when the
// doctest fails. It checks when there is stderr and stdout, no stdout
// and no stderr/stdout.
//
// This is a regression test for <https://github.com/rust-lang/rust/issues/140289>.

//@ edition: 2024
//@ compile-flags:--test --test-args=--test-threads=1
//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout: "panicked at .+rs:" -> "panicked at $$TMP:"
//@ failure-status: 101
//@ rustc-env:RUST_BACKTRACE=0

//! ```
//! println!("######## from a DOC TEST ########");
//! assert_eq!("doc", "test");
//! ```
//!
//! ```
//! assert_eq!("doc", "test");
//! ```
//!
//! ```
//! std::process::exit(1);
//! ```
46 changes: 46 additions & 0 deletions tests/rustdoc-ui/doctest/stdout-and-stderr.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

running 3 tests
test $DIR/stdout-and-stderr.rs - (line 15) ... FAILED
test $DIR/stdout-and-stderr.rs - (line 20) ... FAILED
test $DIR/stdout-and-stderr.rs - (line 24) ... FAILED

failures:

---- $DIR/stdout-and-stderr.rs - (line 15) stdout ----
Test executable failed (exit status: 101).

stdout:
######## from a DOC TEST ########

stderr:

thread 'main' panicked at $TMP:7:1:
assertion `left == right` failed
left: "doc"
right: "test"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


---- $DIR/stdout-and-stderr.rs - (line 20) stdout ----
Test executable failed (exit status: 101).

stderr:

thread 'main' panicked at $TMP:15:1:
assertion `left == right` failed
left: "doc"
right: "test"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


---- $DIR/stdout-and-stderr.rs - (line 24) stdout ----
Test executable failed (exit status: 1).


failures:
$DIR/stdout-and-stderr.rs - (line 15)
$DIR/stdout-and-stderr.rs - (line 20)
$DIR/stdout-and-stderr.rs - (line 24)

test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME