@@ -9,7 +9,7 @@ use super::{
99 AllowUnused , Emit , FailMode , LinkToAux , PassMode , TargetLocation , TestCx , TestOutput ,
1010 Truncated , UI_FIXED , WillExecute ,
1111} ;
12- use crate :: { errors , json} ;
12+ use crate :: json;
1313
1414impl TestCx < ' _ > {
1515 pub ( super ) fn run_ui_test ( & self ) {
@@ -127,9 +127,7 @@ impl TestCx<'_> {
127127 ) ;
128128 }
129129
130- let expected_errors = errors:: load_errors ( & self . testpaths . file , self . revision ) ;
131-
132- if let WillExecute :: Yes = should_run {
130+ let output_to_check = if let WillExecute :: Yes = should_run {
133131 let proc_res = self . exec_compiled_test ( ) ;
134132 let run_output_errors = if self . props . check_run_results {
135133 self . load_compare_outputs ( & proc_res, TestOutput :: Run , explicit)
@@ -150,44 +148,19 @@ impl TestCx<'_> {
150148 self . fatal_proc_rec ( "test run succeeded!" , & proc_res) ;
151149 }
152150
153- let output_to_check = self . get_output ( & proc_res) ;
154- if !self . props . error_patterns . is_empty ( ) || !self . props . regex_error_patterns . is_empty ( )
155- {
156- // "// error-pattern" comments
157- self . check_all_error_patterns ( & output_to_check, & proc_res, pm) ;
158- }
159- self . check_forbid_output ( & output_to_check, & proc_res)
160- }
151+ self . get_output ( & proc_res)
152+ } else {
153+ self . get_output ( & proc_res)
154+ } ;
161155
162156 debug ! (
163- "run_ui_test: explicit={:?} config.compare_mode={:?} expected_errors={:?} \
157+ "run_ui_test: explicit={:?} config.compare_mode={:?} \
164158 proc_res.status={:?} props.error_patterns={:?}",
165- explicit,
166- self . config. compare_mode,
167- expected_errors,
168- proc_res. status,
169- self . props. error_patterns
159+ explicit, self . config. compare_mode, proc_res. status, self . props. error_patterns
170160 ) ;
171161
172- if !explicit && self . config . compare_mode . is_none ( ) {
173- // "//~ERROR comments"
174- self . check_expected_errors ( expected_errors, & proc_res) ;
175- } else if explicit && !expected_errors. is_empty ( ) {
176- let msg = format ! (
177- "line {}: cannot combine `--error-format` with {} annotations; use `error-pattern` instead" ,
178- expected_errors[ 0 ] . line_num_str( ) ,
179- expected_errors[ 0 ] . kind,
180- ) ;
181- self . fatal ( & msg) ;
182- }
183- let output_to_check = self . get_output ( & proc_res) ;
184- if should_run == WillExecute :: No
185- && ( !self . props . error_patterns . is_empty ( )
186- || !self . props . regex_error_patterns . is_empty ( ) )
187- {
188- // "// error-pattern" comments
189- self . check_all_error_patterns ( & output_to_check, & proc_res, pm) ;
190- }
162+ self . check_expected_errors ( & proc_res) ;
163+ self . check_all_error_patterns ( & output_to_check, & proc_res) ;
191164 self . check_forbid_output ( & output_to_check, & proc_res) ;
192165
193166 if self . props . run_rustfix && self . config . compare_mode . is_none ( ) {
0 commit comments