Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c8663ee
Introduce CoerceShared lang item and trait
aapoalas Aug 29, 2025
fce8c13
Add reborrow CoerceShared feature gate test
aapoalas Aug 29, 2025
35bae9d
Introduce basic Reborrow tests
aapoalas Aug 30, 2025
c4a87eb
fix: Move CoerceShared into ops
aapoalas Sep 15, 2025
e32b975
tests: relax expectations after llvm change 902ddda120a5
durin42 Sep 18, 2025
9877b26
Correctly display merged doctest compilation time
GuillaumeGomez Sep 25, 2025
7a9b6d9
PassWrapper: update for new PGOOptions args in LLVM 22
durin42 Sep 25, 2025
68c0e97
re-order normalizations in run-make linker-warning test
Fabian-Gruenbichler Sep 25, 2025
c0e0d4b
Make `def_path_hash_to_def_id` not panic when passed an invalid hash
Lysxia Sep 26, 2025
4c7292a
PassWrapper: drop unused variable for LLVM 22+
durin42 Sep 26, 2025
99456cc
tests: use max-llvm-major-version instead of ignore-llvm-version
durin42 Sep 26, 2025
2e904c4
update issue number for more_float_constants
joshuarayton Sep 26, 2025
c0de794
std::net: update tcp deferaccept delay type to Duration.
devnexen Apr 29, 2025
852aa20
Rename `rust.use-lld` to `rust.bootstrap-override-lld`
Kobzol Sep 25, 2025
bd860bd
Fix typo in LLVM_VERSION_ macro use
durin42 Sep 26, 2025
b7e444d
Add regression test for merged doctests compilation time display
GuillaumeGomez Sep 25, 2025
e88fa08
move Reborrow to ops, fix fmt issues
aapoalas Sep 26, 2025
186eec8
Rollup merge of #140482 - devnexen:tcp_deferaccept_toduration, r=joboet
GuillaumeGomez Sep 27, 2025
4bc0eb1
Rollup merge of #146037 - aapoalas:reborrow-lang-experiment, r=tmandry
GuillaumeGomez Sep 27, 2025
1e86f72
Rollup merge of #146732 - durin42:llvm-22-less-assumes, r=nikic
GuillaumeGomez Sep 27, 2025
ec55150
Rollup merge of #147018 - Fabian-Gruenbichler:mr/fix-linker-warning-t…
GuillaumeGomez Sep 27, 2025
e97b75f
Rollup merge of #147032 - GuillaumeGomez:fix-doctest-compilation-time…
GuillaumeGomez Sep 27, 2025
6d2310a
Rollup merge of #147046 - Kobzol:bootstrap-ll, r=jieyouxu
GuillaumeGomez Sep 27, 2025
7a66da9
Rollup merge of #147050 - durin42:llvm-22-pgo-options-args, r=cuviper
GuillaumeGomez Sep 27, 2025
aad3956
Rollup merge of #147075 - Lysxia:no-panic-def-path-hash, r=petrochenkov
GuillaumeGomez Sep 27, 2025
bd7e79f
Rollup merge of #147076 - joshuarayton:more-float-constants-issue, r=…
GuillaumeGomez Sep 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
10 changes: 7 additions & 3 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,15 @@ pub(crate) fn run_tests(
std::mem::drop(temp_dir.take());
times.display_times();
});
} else {
// If the first condition branch exited successfully, `test_main_with_exit_callback` will
// not exit the process. So to prevent displaying the times twice, we put it behind an
// `else` condition.
times.display_times();
}
// We ensure temp dir destructor is called.
std::mem::drop(temp_dir);
if nb_errors != 0 {
// We ensure temp dir destructor is called.
std::mem::drop(temp_dir);
times.display_times();
std::process::exit(test::ERROR_EXIT_CODE);
}
}
Expand Down
119 changes: 119 additions & 0 deletions tests/run-make/doctests-compilation-time-info/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
//@ ignore-cross-compile (needs to run doctests)

use run_make_support::rfs::write;
use run_make_support::{cwd, rustdoc};

fn assert_presence_of_compilation_time_report(
content: &str,
success: bool,
should_contain_compile_time: bool,
) {
let mut cmd = rustdoc();
let file = cwd().join("foo.rs");

write(&file, content);
cmd.input(&file).arg("--test").edition("2024").env("RUST_BACKTRACE", "0");
let output = if success { cmd.run() } else { cmd.run_fail() };

assert_eq!(
output
.stdout_utf8()
.split("all doctests ran in ")
.last()
.is_some_and(|s| s.contains("; merged doctests compilation took")),
should_contain_compile_time,
);
}

fn main() {
// Checking with only successful merged doctests.
assert_presence_of_compilation_time_report(
"\
//! ```
//! let x = 12;
//! ```",
true,
true,
);
// Checking with only failing merged doctests.
assert_presence_of_compilation_time_report(
"\
//! ```
//! panic!();
//! ```",
false,
true,
);
// Checking with mix of successful doctests.
assert_presence_of_compilation_time_report(
"\
//! ```
//! let x = 12;
//! ```
//!
//! ```compile_fail
//! let x
//! ```",
true,
true,
);
// Checking with mix of failing doctests.
assert_presence_of_compilation_time_report(
"\
//! ```
//! panic!();
//! ```
//!
//! ```compile_fail
//! let x
//! ```",
false,
true,
);
// Checking with mix of failing doctests (v2).
assert_presence_of_compilation_time_report(
"\
//! ```
//! let x = 12;
//! ```
//!
//! ```compile_fail
//! let x = 12;
//! ```",
false,
true,
);
// Checking with mix of failing doctests (v3).
assert_presence_of_compilation_time_report(
"\
//! ```
//! panic!();
//! ```
//!
//! ```compile_fail
//! let x = 12;
//! ```",
false,
true,
);
// Checking with successful non-merged doctests.
assert_presence_of_compilation_time_report(
"\
//! ```compile_fail
//! let x
//! ```",
true,
// If there is no merged doctests, then we should not display compilation time.
false,
);
// Checking with failing non-merged doctests.
assert_presence_of_compilation_time_report(
"\
//! ```compile_fail
//! let x = 12;
//! ```",
false,
// If there is no merged doctests, then we should not display compilation time.
false,
);
}
1 change: 1 addition & 0 deletions tests/run-make/doctests-merge/doctest-2024.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ test doctest.rs - init (line 8) ... ok

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

all doctests ran in $TIME; merged doctests compilation took $TIME
2 changes: 2 additions & 0 deletions tests/run-make/doctests-merge/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ fn test_and_compare(input_file: &str, stdout_file: &str, edition: &str, dep: &Pa
.expected_file(stdout_file)
.actual_text("output", output.stdout_utf8())
.normalize(r#"finished in \d+\.\d+s"#, "finished in $$TIME")
.normalize(r#"ran in \d+\.\d+s"#, "ran in $$TIME")
.normalize(r#"compilation took \d+\.\d+s"#, "compilation took $$TIME")
.run();
}

Expand Down
6 changes: 3 additions & 3 deletions tests/rustdoc-ui/doctest/doctest-output.edition2015.stdout
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

running 3 tests
test $DIR/doctest-output.rs - (line 12) ... ok
test $DIR/doctest-output.rs - ExpandedStruct (line 28) ... ok
test $DIR/doctest-output.rs - foo::bar (line 22) ... ok
test $DIR/doctest-output.rs - (line 14) ... ok
test $DIR/doctest-output.rs - ExpandedStruct (line 30) ... ok
test $DIR/doctest-output.rs - foo::bar (line 24) ... ok

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

7 changes: 4 additions & 3 deletions tests/rustdoc-ui/doctest/doctest-output.edition2024.stdout
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

running 3 tests
test $DIR/doctest-output.rs - (line 12) ... ok
test $DIR/doctest-output.rs - ExpandedStruct (line 28) ... ok
test $DIR/doctest-output.rs - foo::bar (line 22) ... ok
test $DIR/doctest-output.rs - (line 14) ... ok
test $DIR/doctest-output.rs - ExpandedStruct (line 30) ... ok
test $DIR/doctest-output.rs - foo::bar (line 24) ... ok

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

all doctests ran in $TIME; merged doctests compilation took $TIME
2 changes: 2 additions & 0 deletions tests/rustdoc-ui/doctest/doctest-output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//@[edition2024]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: "ran in \d+\.\d+s" -> "ran in $$TIME"
//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME"
//@ check-pass

//! ```
Expand Down
2 changes: 2 additions & 0 deletions tests/rustdoc-ui/doctest/merged-ignore-no_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//@ 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: "ran in \d+\.\d+s" -> "ran in $$TIME"
//@ normalize-stdout: "compilation took \d+\.\d+s" -> "compilation took $$TIME"
//@ check-pass

/// ```ignore (test)
Expand Down
5 changes: 3 additions & 2 deletions tests/rustdoc-ui/doctest/merged-ignore-no_run.stdout
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

running 2 tests
test $DIR/merged-ignore-no_run.rs - ignored (line 7) ... ignored
test $DIR/merged-ignore-no_run.rs - no_run (line 12) - compile ... ok
test $DIR/merged-ignore-no_run.rs - ignored (line 9) ... ignored
test $DIR/merged-ignore-no_run.rs - no_run (line 14) - compile ... ok

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

all doctests ran in $TIME; merged doctests compilation took $TIME