@@ -142,8 +142,6 @@ pub(crate) struct Options {
142
142
// Options that alter generated documentation pages
143
143
/// Crate version to note on the sidebar of generated docs.
144
144
pub ( crate ) crate_version : Option < String > ,
145
- /// Collected options specific to outputting final pages.
146
- pub ( crate ) render_options : RenderOptions ,
147
145
/// The format that we output when rendering.
148
146
///
149
147
/// Currently used only for the `--show-coverage` option.
@@ -159,6 +157,10 @@ pub(crate) struct Options {
159
157
/// Configuration for scraping examples from the current crate. If this option is Some(..) then
160
158
/// the compiler will scrape examples and not generate documentation.
161
159
pub ( crate ) scrape_examples_options : Option < ScrapeExamplesOptions > ,
160
+
161
+ /// Note: this field is duplicated in `RenderOptions` because it's useful
162
+ /// to have it in both places.
163
+ pub ( crate ) unstable_features : rustc_feature:: UnstableFeatures ,
162
164
}
163
165
164
166
impl fmt:: Debug for Options {
@@ -194,14 +196,14 @@ impl fmt::Debug for Options {
194
196
. field ( "persist_doctests" , & self . persist_doctests )
195
197
. field ( "show_coverage" , & self . show_coverage )
196
198
. field ( "crate_version" , & self . crate_version )
197
- . field ( "render_options" , & self . render_options )
198
199
. field ( "runtool" , & self . runtool )
199
200
. field ( "runtool_args" , & self . runtool_args )
200
201
. field ( "enable-per-target-ignores" , & self . enable_per_target_ignores )
201
202
. field ( "run_check" , & self . run_check )
202
203
. field ( "no_run" , & self . no_run )
203
204
. field ( "nocapture" , & self . nocapture )
204
205
. field ( "scrape_examples_options" , & self . scrape_examples_options )
206
+ . field ( "unstable_features" , & self . unstable_features )
205
207
. finish ( )
206
208
}
207
209
}
@@ -267,6 +269,8 @@ pub(crate) struct RenderOptions {
267
269
pub ( crate ) generate_redirect_map : bool ,
268
270
/// Show the memory layout of types in the docs.
269
271
pub ( crate ) show_type_layout : bool ,
272
+ /// Note: this field is duplicated in `Options` because it's useful to have
273
+ /// it in both places.
270
274
pub ( crate ) unstable_features : rustc_feature:: UnstableFeatures ,
271
275
pub ( crate ) emit : Vec < EmitType > ,
272
276
/// If `true`, HTML source pages will generate links for items to their definition.
@@ -316,7 +320,7 @@ impl Options {
316
320
pub ( crate ) fn from_matches (
317
321
matches : & getopts:: Matches ,
318
322
args : Vec < String > ,
319
- ) -> Result < Options , i32 > {
323
+ ) -> Result < ( Options , RenderOptions ) , i32 > {
320
324
let args = & args[ 1 ..] ;
321
325
// Check for unstable options.
322
326
nightly_options:: check_nightly_options ( matches, & opts ( ) ) ;
@@ -710,7 +714,9 @@ impl Options {
710
714
let with_examples = matches. opt_strs ( "with-examples" ) ;
711
715
let call_locations = crate :: scrape_examples:: load_call_locations ( with_examples, & diag) ?;
712
716
713
- Ok ( Options {
717
+ let unstable_features =
718
+ rustc_feature:: UnstableFeatures :: from_environment ( crate_name. as_deref ( ) ) ;
719
+ let options = Options {
714
720
input,
715
721
proc_macro_crate,
716
722
error_format,
@@ -744,42 +750,42 @@ impl Options {
744
750
run_check,
745
751
no_run,
746
752
nocapture,
747
- render_options : RenderOptions {
748
- output,
749
- external_html,
750
- id_map,
751
- playground_url,
752
- module_sorting,
753
- themes,
754
- extension_css,
755
- extern_html_root_urls,
756
- extern_html_root_takes_precedence,
757
- default_settings,
758
- resource_suffix,
759
- enable_minification,
760
- enable_index_page,
761
- index_page,
762
- static_root_path,
763
- markdown_no_toc,
764
- markdown_css,
765
- markdown_playground_url,
766
- document_private,
767
- document_hidden,
768
- generate_redirect_map,
769
- show_type_layout,
770
- unstable_features : rustc_feature:: UnstableFeatures :: from_environment (
771
- crate_name. as_deref ( ) ,
772
- ) ,
773
- emit,
774
- generate_link_to_definition,
775
- call_locations,
776
- no_emit_shared : false ,
777
- } ,
778
753
crate_name,
779
754
output_format,
780
755
json_unused_externs,
781
756
scrape_examples_options,
782
- } )
757
+ unstable_features,
758
+ } ;
759
+ let render_options = RenderOptions {
760
+ output,
761
+ external_html,
762
+ id_map,
763
+ playground_url,
764
+ module_sorting,
765
+ themes,
766
+ extension_css,
767
+ extern_html_root_urls,
768
+ extern_html_root_takes_precedence,
769
+ default_settings,
770
+ resource_suffix,
771
+ enable_minification,
772
+ enable_index_page,
773
+ index_page,
774
+ static_root_path,
775
+ markdown_no_toc,
776
+ markdown_css,
777
+ markdown_playground_url,
778
+ document_private,
779
+ document_hidden,
780
+ generate_redirect_map,
781
+ show_type_layout,
782
+ unstable_features,
783
+ emit,
784
+ generate_link_to_definition,
785
+ call_locations,
786
+ no_emit_shared : false ,
787
+ } ;
788
+ Ok ( ( options, render_options) )
783
789
}
784
790
785
791
/// Returns `true` if the file given as `self.input` is a Markdown file.
0 commit comments