@@ -199,7 +199,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
199199 let ignore;
200200 let edition;
201201 if let Some ( Event :: Start ( Tag :: CodeBlock ( lang) ) ) = event {
202- let parse_result = LangString :: parse ( & lang, self . check_error_codes ) ;
202+ let parse_result = LangString :: parse ( & lang, self . check_error_codes , false ) ;
203203 if !parse_result. rust {
204204 return Some ( Event :: Start ( Tag :: CodeBlock ( lang) ) ) ;
205205 }
@@ -551,7 +551,8 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
551551 }
552552}
553553
554- pub fn find_testable_code < T : test:: Tester > ( doc : & str , tests : & mut T , error_codes : ErrorCodes ) {
554+ pub fn find_testable_code < T : test:: Tester > ( doc : & str , tests : & mut T , error_codes : ErrorCodes ,
555+ enable_per_target_ignores : bool ) {
555556 let mut parser = Parser :: new ( doc) ;
556557 let mut prev_offset = 0 ;
557558 let mut nb_lines = 0 ;
@@ -564,7 +565,7 @@ pub fn find_testable_code<T: test::Tester>(doc: &str, tests: &mut T, error_codes
564565 let block_info = if s. is_empty ( ) {
565566 LangString :: all_false ( )
566567 } else {
567- LangString :: parse ( & * s, error_codes)
568+ LangString :: parse ( & * s, error_codes, enable_per_target_ignores )
568569 } ;
569570 if !block_info. rust {
570571 continue ;
@@ -639,7 +640,11 @@ impl LangString {
639640 }
640641 }
641642
642- fn parse ( string : & str , allow_error_code_check : ErrorCodes ) -> LangString {
643+ fn parse (
644+ string : & str ,
645+ allow_error_code_check : ErrorCodes ,
646+ enable_per_target_ignores : bool
647+ ) -> LangString {
643648 let allow_error_code_check = allow_error_code_check. as_bool ( ) ;
644649 let mut seen_rust_tags = false ;
645650 let mut seen_other_tags = false ;
@@ -660,7 +665,7 @@ impl LangString {
660665 }
661666 "no_run" => { data. no_run = true ; seen_rust_tags = !seen_other_tags; }
662667 "ignore" => { data. ignore = Ignore :: All ; seen_rust_tags = !seen_other_tags; }
663- x if x. starts_with ( "ignore-" ) => {
668+ x if enable_per_target_ignores && x. starts_with ( "ignore-" ) => {
664669 ignores. push ( x. trim_start_matches ( "ignore-" ) . to_owned ( ) ) ;
665670 seen_rust_tags = !seen_other_tags;
666671 }
@@ -941,7 +946,7 @@ crate fn rust_code_blocks(md: &str) -> Vec<RustCodeBlock> {
941946 let lang_string = if syntax. is_empty ( ) {
942947 LangString :: all_false ( )
943948 } else {
944- LangString :: parse ( & * syntax, ErrorCodes :: Yes )
949+ LangString :: parse ( & * syntax, ErrorCodes :: Yes , false )
945950 } ;
946951
947952 if lang_string. rust {
0 commit comments