@@ -834,52 +834,32 @@ fn valid_ui_error_pattern_test(file: &str) -> bool {
834834 . any ( |to_ignore| file. ends_with ( to_ignore) )
835835}
836836
837- fn contains_ui_error_patterns ( file_path : & Path , keep_lto_tests : bool ) -> Result < bool , String > {
838- // Tests generating errors.
837+ fn contains_ui_error_patterns ( file_path : & Path , _keep_lto_tests : bool ) -> Result < bool , String > {
838+ // Inverted logic: UI tests are expected to fail by default unless marked with pass markers.
839+ // Return false (keep) for tests with pass markers, true (remove) for everything else.
839840 let file = File :: open ( file_path)
840841 . map_err ( |error| format ! ( "Failed to read `{}`: {:?}" , file_path. display( ) , error) ) ?;
841842 for line in BufReader :: new ( file) . lines ( ) . map_while ( Result :: ok) {
842843 let line = line. trim ( ) ;
843844 if line. is_empty ( ) {
844845 continue ;
845846 }
847+
848+ // Check for pass markers - these tests should be kept (return false)
846849 if [
847- "//@ error-pattern:" ,
848- "//@ build-fail" ,
849- "//@ run-fail" ,
850- "//@ known-bug" ,
851- "-Cllvm-args" ,
852- "//~" ,
853- "thread" ,
850+ "//@ check-pass" ,
851+ "//@ build-pass" ,
852+ "//@ run-pass" ,
854853 ]
855854 . iter ( )
856- . any ( |check | line. contains ( check ) )
855+ . any ( |marker | line. contains ( marker ) )
857856 {
858- return Ok ( true ) ;
857+ return Ok ( false ) ;
859858 }
860-
861- if !keep_lto_tests
862- && ( line. contains ( "-Clto" )
863- || line. contains ( "-C lto" )
864- || line. contains ( "compile-flags: -Clinker-plugin-lto" ) )
865- && !line. contains ( "-Clto=thin" )
866- {
867- return Ok ( true ) ;
868- }
869-
870- if line. contains ( "//[" ) && line. contains ( "]~" ) {
871- return Ok ( true ) ;
872- }
873- }
874- let file_path = file_path. display ( ) . to_string ( ) ;
875- if file_path. contains ( "ambiguous-4-extern.rs" ) {
876- eprintln ! ( "nothing found for {file_path:?}" ) ;
877859 }
878- // The files in this directory contain errors.
879- if file_path. contains ( "/error-emitter/" ) {
880- return Ok ( true ) ;
881- }
882- Ok ( false )
860+
861+ // Default: remove tests without pass markers (expected to fail by default)
862+ Ok ( true )
883863}
884864
885865// # Parameters
0 commit comments