@@ -142,8 +142,6 @@ pub(crate) struct Options {
142142 // Options that alter generated documentation pages
143143 /// Crate version to note on the sidebar of generated docs.
144144 pub ( crate ) crate_version : Option < String > ,
145- /// Collected options specific to outputting final pages.
146- pub ( crate ) render_options : RenderOptions ,
147145 /// The format that we output when rendering.
148146 ///
149147 /// Currently used only for the `--show-coverage` option.
@@ -159,6 +157,10 @@ pub(crate) struct Options {
159157 /// Configuration for scraping examples from the current crate. If this option is Some(..) then
160158 /// the compiler will scrape examples and not generate documentation.
161159 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 ,
162164}
163165
164166impl fmt:: Debug for Options {
@@ -194,14 +196,14 @@ impl fmt::Debug for Options {
194196 . field ( "persist_doctests" , & self . persist_doctests )
195197 . field ( "show_coverage" , & self . show_coverage )
196198 . field ( "crate_version" , & self . crate_version )
197- . field ( "render_options" , & self . render_options )
198199 . field ( "runtool" , & self . runtool )
199200 . field ( "runtool_args" , & self . runtool_args )
200201 . field ( "enable-per-target-ignores" , & self . enable_per_target_ignores )
201202 . field ( "run_check" , & self . run_check )
202203 . field ( "no_run" , & self . no_run )
203204 . field ( "nocapture" , & self . nocapture )
204205 . field ( "scrape_examples_options" , & self . scrape_examples_options )
206+ . field ( "unstable_features" , & self . unstable_features )
205207 . finish ( )
206208 }
207209}
@@ -267,6 +269,8 @@ pub(crate) struct RenderOptions {
267269 pub ( crate ) generate_redirect_map : bool ,
268270 /// Show the memory layout of types in the docs.
269271 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.
270274 pub ( crate ) unstable_features : rustc_feature:: UnstableFeatures ,
271275 pub ( crate ) emit : Vec < EmitType > ,
272276 /// If `true`, HTML source pages will generate links for items to their definition.
@@ -316,7 +320,7 @@ impl Options {
316320 pub ( crate ) fn from_matches (
317321 matches : & getopts:: Matches ,
318322 args : Vec < String > ,
319- ) -> Result < Options , i32 > {
323+ ) -> Result < ( Options , RenderOptions ) , i32 > {
320324 let args = & args[ 1 ..] ;
321325 // Check for unstable options.
322326 nightly_options:: check_nightly_options ( matches, & opts ( ) ) ;
@@ -710,7 +714,9 @@ impl Options {
710714 let with_examples = matches. opt_strs ( "with-examples" ) ;
711715 let call_locations = crate :: scrape_examples:: load_call_locations ( with_examples, & diag) ?;
712716
713- Ok ( Options {
717+ let unstable_features =
718+ rustc_feature:: UnstableFeatures :: from_environment ( crate_name. as_deref ( ) ) ;
719+ let options = Options {
714720 input,
715721 proc_macro_crate,
716722 error_format,
@@ -744,42 +750,42 @@ impl Options {
744750 run_check,
745751 no_run,
746752 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- } ,
778753 crate_name,
779754 output_format,
780755 json_unused_externs,
781756 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) )
783789 }
784790
785791 /// Returns `true` if the file given as `self.input` is a Markdown file.
0 commit comments