@@ -40,7 +40,7 @@ crate struct TestOptions {
4040 crate no_crate_inject : bool ,
4141 /// Whether to emit compilation warnings when compiling doctests. Setting this will suppress
4242 /// the default `#![allow(unused)]`.
43- crate display_warnings : bool ,
43+ crate display_doctest_warnings : bool ,
4444 /// Additional crate-level attributes to add to doctests.
4545 crate attrs : Vec < String > ,
4646}
@@ -72,7 +72,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
7272 maybe_sysroot : options. maybe_sysroot . clone ( ) ,
7373 search_paths : options. libs . clone ( ) ,
7474 crate_types,
75- lint_opts : if !options. display_warnings { lint_opts } else { vec ! [ ] } ,
75+ lint_opts : if !options. display_doctest_warnings { lint_opts } else { vec ! [ ] } ,
7676 lint_cap : Some ( options. lint_cap . unwrap_or_else ( || lint:: Forbid ) ) ,
7777 cg : options. codegen_options . clone ( ) ,
7878 externs : options. externs . clone ( ) ,
@@ -106,7 +106,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
106106 } ;
107107
108108 let test_args = options. test_args . clone ( ) ;
109- let display_warnings = options. display_warnings ;
109+ let display_doctest_warnings = options. display_doctest_warnings ;
110110 let nocapture = options. nocapture ;
111111 let externs = options. externs . clone ( ) ;
112112 let json_unused_externs = options. json_unused_externs ;
@@ -119,7 +119,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
119119 let crate_attrs = tcx. hir ( ) . attrs ( CRATE_HIR_ID ) ;
120120
121121 let mut opts = scrape_test_config ( crate_attrs) ;
122- opts. display_warnings |= options. display_warnings ;
122+ opts. display_doctest_warnings |= options. display_doctest_warnings ;
123123 let enable_per_target_ignores = options. enable_per_target_ignores ;
124124 let mut collector = Collector :: new (
125125 tcx. crate_name ( LOCAL_CRATE ) ,
@@ -163,7 +163,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
163163 Err ( ErrorReported ) => return Err ( ErrorReported ) ,
164164 } ;
165165
166- run_tests ( test_args, nocapture, display_warnings , tests) ;
166+ run_tests ( test_args, nocapture, display_doctest_warnings , tests) ;
167167
168168 // Collect and warn about unused externs, but only if we've gotten
169169 // reports for each doctest
@@ -209,22 +209,26 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
209209crate fn run_tests (
210210 mut test_args : Vec < String > ,
211211 nocapture : bool ,
212- display_warnings : bool ,
212+ display_doctest_warnings : bool ,
213213 tests : Vec < test:: TestDescAndFn > ,
214214) {
215215 test_args. insert ( 0 , "rustdoctest" . to_string ( ) ) ;
216216 if nocapture {
217217 test_args. push ( "--nocapture" . to_string ( ) ) ;
218218 }
219- test:: test_main ( & test_args, tests, Some ( test:: Options :: new ( ) . display_output ( display_warnings) ) ) ;
219+ test:: test_main (
220+ & test_args,
221+ tests,
222+ Some ( test:: Options :: new ( ) . display_output ( display_doctest_warnings) ) ,
223+ ) ;
220224}
221225
222226// Look for `#![doc(test(no_crate_inject))]`, used by crates in the std facade.
223227fn scrape_test_config ( attrs : & [ ast:: Attribute ] ) -> TestOptions {
224228 use rustc_ast_pretty:: pprust;
225229
226230 let mut opts =
227- TestOptions { no_crate_inject : false , display_warnings : false , attrs : Vec :: new ( ) } ;
231+ TestOptions { no_crate_inject : false , display_doctest_warnings : false , attrs : Vec :: new ( ) } ;
228232
229233 let test_attrs: Vec < _ > = attrs
230234 . iter ( )
@@ -504,7 +508,7 @@ crate fn make_test(
504508 let mut prog = String :: new ( ) ;
505509 let mut supports_color = false ;
506510
507- if opts. attrs . is_empty ( ) && !opts. display_warnings {
511+ if opts. attrs . is_empty ( ) && !opts. display_doctest_warnings {
508512 // If there aren't any attributes supplied by #![doc(test(attr(...)))], then allow some
509513 // lints that are commonly triggered in doctests. The crate-level test attributes are
510514 // commonly used to make tests fail in case they trigger warnings, so having this there in
0 commit comments