@@ -40,7 +40,7 @@ crate struct TestOptions {
40
40
crate no_crate_inject : bool ,
41
41
/// Whether to emit compilation warnings when compiling doctests. Setting this will suppress
42
42
/// the default `#![allow(unused)]`.
43
- crate display_warnings : bool ,
43
+ crate display_doctest_warnings : bool ,
44
44
/// Additional crate-level attributes to add to doctests.
45
45
crate attrs : Vec < String > ,
46
46
}
@@ -72,7 +72,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
72
72
maybe_sysroot : options. maybe_sysroot . clone ( ) ,
73
73
search_paths : options. libs . clone ( ) ,
74
74
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 ! [ ] } ,
76
76
lint_cap : Some ( options. lint_cap . unwrap_or_else ( || lint:: Forbid ) ) ,
77
77
cg : options. codegen_options . clone ( ) ,
78
78
externs : options. externs . clone ( ) ,
@@ -106,7 +106,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
106
106
} ;
107
107
108
108
let test_args = options. test_args . clone ( ) ;
109
- let display_warnings = options. display_warnings ;
109
+ let display_doctest_warnings = options. display_doctest_warnings ;
110
110
let nocapture = options. nocapture ;
111
111
let externs = options. externs . clone ( ) ;
112
112
let json_unused_externs = options. json_unused_externs ;
@@ -119,7 +119,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
119
119
let crate_attrs = tcx. hir ( ) . attrs ( CRATE_HIR_ID ) ;
120
120
121
121
let mut opts = scrape_test_config ( crate_attrs) ;
122
- opts. display_warnings |= options. display_warnings ;
122
+ opts. display_doctest_warnings |= options. display_doctest_warnings ;
123
123
let enable_per_target_ignores = options. enable_per_target_ignores ;
124
124
let mut collector = Collector :: new (
125
125
tcx. crate_name ( LOCAL_CRATE ) ,
@@ -163,7 +163,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
163
163
Err ( ErrorReported ) => return Err ( ErrorReported ) ,
164
164
} ;
165
165
166
- run_tests ( test_args, nocapture, display_warnings , tests) ;
166
+ run_tests ( test_args, nocapture, display_doctest_warnings , tests) ;
167
167
168
168
// Collect and warn about unused externs, but only if we've gotten
169
169
// reports for each doctest
@@ -209,22 +209,26 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
209
209
crate fn run_tests (
210
210
mut test_args : Vec < String > ,
211
211
nocapture : bool ,
212
- display_warnings : bool ,
212
+ display_doctest_warnings : bool ,
213
213
tests : Vec < test:: TestDescAndFn > ,
214
214
) {
215
215
test_args. insert ( 0 , "rustdoctest" . to_string ( ) ) ;
216
216
if nocapture {
217
217
test_args. push ( "--nocapture" . to_string ( ) ) ;
218
218
}
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
+ ) ;
220
224
}
221
225
222
226
// Look for `#![doc(test(no_crate_inject))]`, used by crates in the std facade.
223
227
fn scrape_test_config ( attrs : & [ ast:: Attribute ] ) -> TestOptions {
224
228
use rustc_ast_pretty:: pprust;
225
229
226
230
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 ( ) } ;
228
232
229
233
let test_attrs: Vec < _ > = attrs
230
234
. iter ( )
@@ -504,7 +508,7 @@ crate fn make_test(
504
508
let mut prog = String :: new ( ) ;
505
509
let mut supports_color = false ;
506
510
507
- if opts. attrs . is_empty ( ) && !opts. display_warnings {
511
+ if opts. attrs . is_empty ( ) && !opts. display_doctest_warnings {
508
512
// If there aren't any attributes supplied by #![doc(test(attr(...)))], then allow some
509
513
// lints that are commonly triggered in doctests. The crate-level test attributes are
510
514
// commonly used to make tests fail in case they trigger warnings, so having this there in
0 commit comments