@@ -363,279 +363,7 @@ impl TestProps {
363363
364364 if let Some ( handler) = DIRECTIVE_HANDLERS_MAP . get ( ln. name ) {
365365 handler. handle ( config, ln, self ) ;
366- // This directive has been handled, so move on to the next one.
367- return ;
368- }
369-
370- use directives:: * ;
371- let props = & mut * self ;
372-
373- config. push_name_value_directive ( ln, DOC_FLAGS , & mut props. doc_flags , |r| r) ;
374-
375- fn split_flags ( flags : & str ) -> Vec < String > {
376- // Individual flags can be single-quoted to preserve spaces; see
377- // <https://github.com/rust-lang/rust/pull/115948/commits/957c5db6>.
378- flags
379- . split ( '\'' )
380- . enumerate ( )
381- . flat_map ( |( i, f) | {
382- // (preserve line breaks)
383- if i % 2 == 1 { vec ! [ f] } else { f. split_whitespace ( ) . collect ( ) }
384- } )
385- . map ( move |s| s. to_owned ( ) )
386- . collect :: < Vec < _ > > ( )
387- }
388-
389- if let Some ( flags) = config. parse_name_value_directive ( ln, COMPILE_FLAGS ) {
390- let flags = split_flags ( & flags) ;
391- for ( i, flag) in flags. iter ( ) . enumerate ( ) {
392- if flag == "--edition" || flag. starts_with ( "--edition=" ) {
393- panic ! ( "you must use `//@ edition` to configure the edition" ) ;
394- }
395- if ( flag == "-C"
396- && flags. get ( i + 1 ) . is_some_and ( |v| v. starts_with ( "incremental=" ) ) )
397- || flag. starts_with ( "-Cincremental=" )
398- {
399- panic ! (
400- // (preserve line breaks)
401- "you must use `//@ incremental` to enable incremental compilation"
402- ) ;
403- }
404- }
405- props. compile_flags . extend ( flags) ;
406- }
407-
408- if let Some ( range) = parse_edition_range ( config, ln) {
409- props. edition = Some ( range. edition_to_test ( config. edition ) ) ;
410- }
411-
412- config. parse_and_update_revisions ( ln, & mut props. revisions ) ;
413-
414- if let Some ( flags) = config. parse_name_value_directive ( ln, RUN_FLAGS ) {
415- props. run_flags . extend ( split_flags ( & flags) ) ;
416- }
417-
418- if props. pp_exact . is_none ( ) {
419- props. pp_exact = config. parse_pp_exact ( ln) ;
420- }
421-
422- config. set_name_directive ( ln, SHOULD_ICE , & mut props. should_ice ) ;
423- config. set_name_directive ( ln, BUILD_AUX_DOCS , & mut props. build_aux_docs ) ;
424- config. set_name_directive (
425- // (preserve line breaks)
426- ln,
427- UNIQUE_DOC_OUT_DIR ,
428- & mut props. unique_doc_out_dir ,
429- ) ;
430-
431- config. set_name_directive ( ln, FORCE_HOST , & mut props. force_host ) ;
432- config. set_name_directive ( ln, CHECK_STDOUT , & mut props. check_stdout ) ;
433- config. set_name_directive ( ln, CHECK_RUN_RESULTS , & mut props. check_run_results ) ;
434- config. set_name_directive (
435- ln,
436- DONT_CHECK_COMPILER_STDOUT ,
437- & mut props. dont_check_compiler_stdout ,
438- ) ;
439- config. set_name_directive (
440- ln,
441- DONT_CHECK_COMPILER_STDERR ,
442- & mut props. dont_check_compiler_stderr ,
443- ) ;
444- config. set_name_directive ( ln, NO_PREFER_DYNAMIC , & mut props. no_prefer_dynamic ) ;
445-
446- if let Some ( m) = config. parse_name_value_directive ( ln, PRETTY_MODE ) {
447- props. pretty_mode = m;
448- }
449-
450- config. set_name_directive (
451- // (preserve line breaks)
452- ln,
453- PRETTY_COMPARE_ONLY ,
454- & mut props. pretty_compare_only ,
455- ) ;
456-
457- // Call a helper method to deal with aux-related directives.
458- parse_and_update_aux ( config, ln, & mut props. aux ) ;
459-
460- config. push_name_value_directive (
461- // (preserve line breaks)
462- ln,
463- EXEC_ENV ,
464- & mut props. exec_env ,
465- Config :: parse_env,
466- ) ;
467- config. push_name_value_directive (
468- // (preserve line breaks)
469- ln,
470- UNSET_EXEC_ENV ,
471- & mut props. unset_exec_env ,
472- |r| r. trim ( ) . to_owned ( ) ,
473- ) ;
474- config. push_name_value_directive (
475- ln,
476- RUSTC_ENV ,
477- & mut props. rustc_env ,
478- Config :: parse_env,
479- ) ;
480- config. push_name_value_directive (
481- ln,
482- UNSET_RUSTC_ENV ,
483- & mut props. unset_rustc_env ,
484- |r| r. trim ( ) . to_owned ( ) ,
485- ) ;
486- config. push_name_value_directive (
487- // (preserve line breaks)
488- ln,
489- FORBID_OUTPUT ,
490- & mut props. forbid_output ,
491- |r| r,
492- ) ;
493- config. set_name_directive (
494- ln,
495- CHECK_TEST_LINE_NUMBERS_MATCH ,
496- & mut props. check_test_line_numbers_match ,
497- ) ;
498-
499- props. update_pass_mode ( ln, config) ;
500- props. update_fail_mode ( ln, config) ;
501-
502- config. set_name_directive ( ln, IGNORE_PASS , & mut props. ignore_pass ) ;
503-
504- if let Some ( NormalizeRule { kind, regex, replacement } ) =
505- config. parse_custom_normalization ( ln)
506- {
507- let rule_tuple = ( regex, replacement) ;
508- match kind {
509- NormalizeKind :: Stdout => props. normalize_stdout . push ( rule_tuple) ,
510- NormalizeKind :: Stderr => props. normalize_stderr . push ( rule_tuple) ,
511- NormalizeKind :: Stderr32bit => {
512- if config. target_cfg ( ) . pointer_width == 32 {
513- props. normalize_stderr . push ( rule_tuple) ;
514- }
515- }
516- NormalizeKind :: Stderr64bit => {
517- if config. target_cfg ( ) . pointer_width == 64 {
518- props. normalize_stderr . push ( rule_tuple) ;
519- }
520- }
521- }
522- }
523-
524- if let Some ( code) = config
525- . parse_name_value_directive ( ln, FAILURE_STATUS )
526- . and_then ( |code| code. trim ( ) . parse :: < i32 > ( ) . ok ( ) )
527- {
528- props. failure_status = Some ( code) ;
529- }
530-
531- config. set_name_directive (
532- ln,
533- DONT_CHECK_FAILURE_STATUS ,
534- & mut props. dont_check_failure_status ,
535- ) ;
536-
537- config. set_name_directive ( ln, RUN_RUSTFIX , & mut props. run_rustfix ) ;
538- config. set_name_directive (
539- ln,
540- RUSTFIX_ONLY_MACHINE_APPLICABLE ,
541- & mut props. rustfix_only_machine_applicable ,
542- ) ;
543- config. set_name_value_directive (
544- // (preserve line breaks)
545- ln,
546- ASSEMBLY_OUTPUT ,
547- & mut props. assembly_output ,
548- |r| r. trim ( ) . to_string ( ) ,
549- ) ;
550- config. set_name_directive (
551- // (preserve line breaks)
552- ln,
553- STDERR_PER_BITWIDTH ,
554- & mut props. stderr_per_bitwidth ,
555- ) ;
556- config. set_name_directive ( ln, INCREMENTAL , & mut props. incremental ) ;
557-
558- // Unlike the other `name_value_directive`s this needs to be handled manually,
559- // because it sets a `bool` flag.
560- if let Some ( known_bug) = config. parse_name_value_directive ( ln, KNOWN_BUG ) {
561- let known_bug = known_bug. trim ( ) ;
562- if known_bug == "unknown"
563- || known_bug. split ( ',' ) . all ( |issue_ref| {
564- issue_ref
565- . trim ( )
566- . split_once ( '#' )
567- . filter ( |( _, number) | {
568- // (preserve line breaks)
569- number. chars ( ) . all ( |digit| digit. is_numeric ( ) )
570- } )
571- . is_some ( )
572- } )
573- {
574- props. known_bug = true ;
575- } else {
576- panic ! (
577- "Invalid known-bug value: {known_bug}\n It requires comma-separated issue references (`#000` or `chalk#000`) or `known-bug: unknown`."
578- ) ;
579- }
580- } else if config. parse_name_directive ( ln, KNOWN_BUG ) {
581- panic ! (
582- "Invalid known-bug attribute, requires comma-separated issue references (`#000` or `chalk#000`) or `known-bug: unknown`."
583- ) ;
584- }
585-
586- config. set_name_value_directive (
587- // (preserve line breaks)
588- ln,
589- TEST_MIR_PASS ,
590- & mut props. mir_unit_test ,
591- |s| s. trim ( ) . to_string ( ) ,
592- ) ;
593- config. set_name_directive ( ln, REMAP_SRC_BASE , & mut props. remap_src_base ) ;
594-
595- if let Some ( flags) = config. parse_name_value_directive ( ln, LLVM_COV_FLAGS ) {
596- props. llvm_cov_flags . extend ( split_flags ( & flags) ) ;
597366 }
598-
599- if let Some ( flags) = config. parse_name_value_directive ( ln, FILECHECK_FLAGS ) {
600- props. filecheck_flags . extend ( split_flags ( & flags) ) ;
601- }
602-
603- config. set_name_directive ( ln, NO_AUTO_CHECK_CFG , & mut props. no_auto_check_cfg ) ;
604-
605- props. update_add_minicore ( ln, config) ;
606-
607- if let Some ( flags) =
608- // (preserve line breaks)
609- config. parse_name_value_directive ( ln, MINICORE_COMPILE_FLAGS )
610- {
611- let flags = split_flags ( & flags) ;
612- for flag in & flags {
613- if flag == "--edition" || flag. starts_with ( "--edition=" ) {
614- panic ! ( "you must use `//@ edition` to configure the edition" ) ;
615- }
616- }
617- props. minicore_compile_flags . extend ( flags) ;
618- }
619-
620- if let Some ( err_kind) =
621- // (preserve line breaks)
622- config. parse_name_value_directive ( ln, DONT_REQUIRE_ANNOTATIONS )
623- {
624- props
625- . dont_require_annotations
626- . insert ( ErrorKind :: expect_from_user_str ( err_kind. trim ( ) ) ) ;
627- }
628-
629- config. set_name_directive (
630- ln,
631- DISABLE_GDB_PRETTY_PRINTERS ,
632- & mut props. disable_gdb_pretty_printers ,
633- ) ;
634- config. set_name_directive (
635- ln,
636- COMPARE_OUTPUT_BY_LINES ,
637- & mut props. compare_output_by_lines ,
638- ) ;
639367 } ,
640368 ) ;
641369 }
@@ -1705,3 +1433,17 @@ impl EditionRange {
17051433 }
17061434 }
17071435}
1436+
1437+ fn split_flags ( flags : & str ) -> Vec < String > {
1438+ // Individual flags can be single-quoted to preserve spaces; see
1439+ // <https://github.com/rust-lang/rust/pull/115948/commits/957c5db6>.
1440+ flags
1441+ . split ( '\'' )
1442+ . enumerate ( )
1443+ . flat_map ( |( i, f) | {
1444+ // (preserve line breaks)
1445+ if i % 2 == 1 { vec ! [ f] } else { f. split_whitespace ( ) . collect ( ) }
1446+ } )
1447+ . map ( move |s| s. to_owned ( ) )
1448+ . collect :: < Vec < _ > > ( )
1449+ }
0 commit comments