@@ -97,6 +97,18 @@ def _rustdoc_for_bin_with_transitive_proc_macro_test_impl(ctx):
97
97
98
98
return analysistest .end (env )
99
99
100
+ def _rustdoc_for_lib_with_features_test_impl (ctx ):
101
+ env = analysistest .begin (ctx )
102
+ tut = analysistest .target_under_test (env )
103
+
104
+ _common_rustdoc_checks (env , tut )
105
+
106
+ action = _get_rustdoc_action (env , tut )
107
+
108
+ assert_argv_contains (env , action , "--cfg=feature=\" docs\" " )
109
+
110
+ return analysistest .end (env )
111
+
100
112
def _rustdoc_for_lib_with_cc_lib_test_impl (ctx ):
101
113
env = analysistest .begin (ctx )
102
114
tut = analysistest .target_under_test (env )
@@ -164,6 +176,7 @@ rustdoc_for_lib_with_proc_macro_in_docs_test = analysistest.make(_rustdoc_for_li
164
176
rustdoc_for_bin_with_transitive_proc_macro_test = analysistest .make (_rustdoc_for_bin_with_transitive_proc_macro_test_impl )
165
177
rustdoc_for_lib_with_cc_lib_test = analysistest .make (_rustdoc_for_lib_with_cc_lib_test_impl )
166
178
rustdoc_with_args_test = analysistest .make (_rustdoc_with_args_test_impl )
179
+ rustdoc_for_lib_with_features_test = analysistest .make (_rustdoc_for_lib_with_features_test_impl )
167
180
rustdoc_zip_output_test = analysistest .make (_rustdoc_zip_output_test_impl )
168
181
rustdoc_with_json_error_format_test = analysistest .make (_rustdoc_with_json_error_format_test_impl , config_settings = {
169
182
str (Label ("//rust/settings:error_format" )): "json" ,
@@ -283,6 +296,18 @@ def _define_targets():
283
296
crate_features = ["with_proc_macro" ],
284
297
)
285
298
299
+ _target_maker (
300
+ rust_library ,
301
+ name = "lib_with_features" ,
302
+ srcs = ["rustdoc_features.rs" ],
303
+ crate_features = ["docs" ],
304
+ )
305
+
306
+ rust_doc (
307
+ name = "rustdoc_lib_with_features" ,
308
+ crate = ":lib_with_features" ,
309
+ )
310
+
286
311
cc_library (
287
312
name = "cc_lib" ,
288
313
hdrs = ["rustdoc.h" ],
@@ -424,6 +449,11 @@ def rustdoc_test_suite(name):
424
449
target_under_test = ":lib_with_cc_doc" ,
425
450
)
426
451
452
+ rustdoc_for_lib_with_features_test (
453
+ name = "rustdoc_for_lib_with_features_test" ,
454
+ target_under_test = ":rustdoc_lib_with_features" ,
455
+ )
456
+
427
457
rustdoc_with_args_test (
428
458
name = "rustdoc_with_args_test" ,
429
459
target_under_test = ":rustdoc_with_args" ,
@@ -455,6 +485,7 @@ def rustdoc_test_suite(name):
455
485
":rustdoc_for_lib_with_proc_macro_in_docs_test" ,
456
486
":rustdoc_for_lib_with_proc_macro_test" ,
457
487
":rustdoc_for_lib_with_cc_lib_test" ,
488
+ ":rustdoc_for_lib_with_features_test" ,
458
489
":rustdoc_with_args_test" ,
459
490
":rustdoc_with_json_error_format_test" ,
460
491
":rustdoc_zip_output_test" ,
0 commit comments