@@ -199,7 +199,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
199
199
let ignore;
200
200
let edition;
201
201
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 ) ;
203
203
if !parse_result. rust {
204
204
return Some ( Event :: Start ( Tag :: CodeBlock ( lang) ) ) ;
205
205
}
@@ -551,7 +551,8 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
551
551
}
552
552
}
553
553
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 ) {
555
556
let mut parser = Parser :: new ( doc) ;
556
557
let mut prev_offset = 0 ;
557
558
let mut nb_lines = 0 ;
@@ -564,7 +565,7 @@ pub fn find_testable_code<T: test::Tester>(doc: &str, tests: &mut T, error_codes
564
565
let block_info = if s. is_empty ( ) {
565
566
LangString :: all_false ( )
566
567
} else {
567
- LangString :: parse ( & * s, error_codes)
568
+ LangString :: parse ( & * s, error_codes, enable_per_target_ignores )
568
569
} ;
569
570
if !block_info. rust {
570
571
continue ;
@@ -639,7 +640,11 @@ impl LangString {
639
640
}
640
641
}
641
642
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 {
643
648
let allow_error_code_check = allow_error_code_check. as_bool ( ) ;
644
649
let mut seen_rust_tags = false ;
645
650
let mut seen_other_tags = false ;
@@ -660,7 +665,7 @@ impl LangString {
660
665
}
661
666
"no_run" => { data. no_run = true ; seen_rust_tags = !seen_other_tags; }
662
667
"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-" ) => {
664
669
ignores. push ( x. trim_start_matches ( "ignore-" ) . to_owned ( ) ) ;
665
670
seen_rust_tags = !seen_other_tags;
666
671
}
@@ -941,7 +946,7 @@ crate fn rust_code_blocks(md: &str) -> Vec<RustCodeBlock> {
941
946
let lang_string = if syntax. is_empty ( ) {
942
947
LangString :: all_false ( )
943
948
} else {
944
- LangString :: parse ( & * syntax, ErrorCodes :: Yes )
949
+ LangString :: parse ( & * syntax, ErrorCodes :: Yes , false )
945
950
} ;
946
951
947
952
if lang_string. rust {
0 commit comments