File tree Expand file tree Collapse file tree 6 files changed +48
-4
lines changed
tools/run-make-support/src
diagnostics-traits-from-duplicate-crates
rustdoc-merge-no-input-finalize Expand file tree Collapse file tree 6 files changed +48
-4
lines changed Original file line number Diff line number Diff line change @@ -671,7 +671,13 @@ fn run_test(
671671
672672 debug ! ( "compiler invocation for doctest: {compiler:?}" ) ;
673673
674- let mut child = compiler. spawn ( ) . expect ( "Failed to spawn rustc process" ) ;
674+ let mut child = match compiler. spawn ( ) {
675+ Ok ( child) => child,
676+ Err ( error) => {
677+ eprintln ! ( "Failed to spawn {:?}: {error:?}" , compiler. get_program( ) ) ;
678+ return ( Duration :: default ( ) , Err ( TestFailure :: CompileError ) ) ;
679+ }
680+ } ;
675681 let output = if let Some ( merged_test_code) = & doctest. merged_test_code {
676682 // compile-fail tests never get merged, so this should always pass
677683 let status = child. wait ( ) . expect ( "Failed to wait" ) ;
@@ -733,7 +739,13 @@ fn run_test(
733739 let status = if !status. success ( ) {
734740 status
735741 } else {
736- let mut child_runner = runner_compiler. spawn ( ) . expect ( "Failed to spawn rustc process" ) ;
742+ let mut child_runner = match runner_compiler. spawn ( ) {
743+ Ok ( child) => child,
744+ Err ( error) => {
745+ eprintln ! ( "Failed to spawn {:?}: {error:?}" , runner_compiler. get_program( ) ) ;
746+ return ( Duration :: default ( ) , Err ( TestFailure :: CompileError ) ) ;
747+ }
748+ } ;
737749 child_runner. wait ( ) . expect ( "Failed to wait" )
738750 } ;
739751
Original file line number Diff line number Diff line change @@ -387,6 +387,13 @@ impl CompletedProcess {
387387 self
388388 }
389389
390+ /// Checks that `stderr` doesn't contain the Internal Compiler Error message.
391+ #[ track_caller]
392+ pub fn assert_not_ice ( & self ) -> & Self {
393+ self . assert_stderr_not_contains ( "error: the compiler unexpectedly panicked. this is a bug" ) ;
394+ self
395+ }
396+
390397 /// Checks that `stderr` does not contain the regex pattern `unexpected`.
391398 #[ track_caller]
392399 pub fn assert_stderr_not_contains_regex < S : AsRef < str > > ( & self , unexpected : S ) -> & Self {
Original file line number Diff line number Diff line change @@ -43,5 +43,5 @@ fn main() {
4343 . extern_ ( "minibevy" , "libminibevy-b.rmeta" )
4444 . extern_ ( "minirapier" , "libminirapier.rmeta" )
4545 . run_fail ( )
46- . assert_stderr_not_contains ( "error: the compiler unexpectedly panicked. this is a bug" ) ;
46+ . assert_not_ice ( ) ;
4747}
Original file line number Diff line number Diff line change @@ -24,5 +24,5 @@ fn main() {
2424 . arg ( format ! ( "--include-parts-dir={}" , parts_out_dir. display( ) ) )
2525 . arg ( "--merge=finalize" )
2626 . run ( ) ;
27- output. assert_stderr_not_contains ( "error: the compiler unexpectedly panicked. this is a bug." ) ;
27+ output. assert_not_ice ( ) ;
2828}
Original file line number Diff line number Diff line change 1+ //! ```
2+ //! let x = 12;
3+ //! ```
Original file line number Diff line number Diff line change 1+ // This test ensures that if the rustdoc test binary is not executable, it will
2+ // gracefully fail and not panic.
3+
4+ //@ needs-target-std
5+
6+ use run_make_support:: { path, rfs, rustdoc} ;
7+
8+ fn main ( ) {
9+ let absolute_path = path ( "foo.rs" ) . canonicalize ( ) . expect ( "failed to get absolute path" ) ;
10+ let output = rustdoc ( )
11+ . input ( "foo.rs" )
12+ . arg ( "--test" )
13+ . arg ( "-Zunstable-options" )
14+ . arg ( "--test-builder" )
15+ . arg ( & absolute_path)
16+ . run_fail ( ) ;
17+
18+ // We check that rustdoc outputs the error correctly...
19+ output. assert_stdout_contains ( "Failed to spawn " ) ;
20+ // ... and that we didn't panic.
21+ output. assert_not_ice ( ) ;
22+ }
You can’t perform that action at this time.
0 commit comments