@@ -163,7 +163,7 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, options: RustdocOptions) -> Result<()
163163 let args_path = temp_dir. path ( ) . join ( "rustdoc-cfgs" ) ;
164164 crate :: wrap_return ( dcx, generate_args_file ( & args_path, & options) ) ?;
165165
166- let CreateRunnableDoctests {
166+ let CreateRunnableDocTests {
167167 standalone_tests,
168168 mergeable_tests,
169169 rustdoc_options,
@@ -179,7 +179,7 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, options: RustdocOptions) -> Result<()
179179 let opts = scrape_test_config ( crate_name, crate_attrs, args_path) ;
180180 let enable_per_target_ignores = options. enable_per_target_ignores ;
181181
182- let mut collector = CreateRunnableDoctests :: new ( options, opts) ;
182+ let mut collector = CreateRunnableDocTests :: new ( options, opts) ;
183183 let hir_collector = HirCollector :: new (
184184 & compiler. sess ,
185185 tcx. hir ( ) ,
@@ -250,7 +250,7 @@ pub(crate) fn run_tests(
250250 rustdoc_options : & Arc < RustdocOptions > ,
251251 unused_extern_reports : & Arc < Mutex < Vec < UnusedExterns > > > ,
252252 mut standalone_tests : Vec < test:: TestDescAndFn > ,
253- mergeable_tests : FxHashMap < Edition , Vec < ( DocTestBuilder , ScrapedDoctest ) > > ,
253+ mergeable_tests : FxHashMap < Edition , Vec < ( DocTestBuilder , ScrapedDocTest ) > > ,
254254) {
255255 let mut test_args = Vec :: with_capacity ( rustdoc_options. test_args . len ( ) + 1 ) ;
256256 test_args. insert ( 0 , "rustdoctest" . to_string ( ) ) ;
@@ -432,8 +432,13 @@ fn wrapped_rustc_command(rustc_wrappers: &[PathBuf], rustc_binary: &Path) -> Com
432432 command
433433}
434434
435- /// This struct contains information needed for running a doctest.
436- struct RunnableDoctest {
435+ /// Information needed for running a bundle of doctests.
436+ ///
437+ /// This data structure contains the "full" test code, including the wrappers
438+ /// (if multiple doctests are merged), `main` function,
439+ /// and everything needed to calculate the compiler's command-line arguments.
440+ /// The `# ` prefix on boring lines has also been stripped.
441+ struct RunnableDocTest {
437442 full_test_code : String ,
438443 full_test_line_offset : usize ,
439444 test_opts : IndividualTestOptions ,
@@ -444,14 +449,14 @@ struct RunnableDoctest {
444449 no_run : bool ,
445450}
446451
447- impl RunnableDoctest {
452+ impl RunnableDocTest {
448453 fn path_for_merged_doctest ( & self ) -> PathBuf {
449454 self . test_opts . outdir . path ( ) . join ( & format ! ( "doctest_{}.rs" , self . edition) )
450455 }
451456}
452457
453458fn run_test (
454- doctest : RunnableDoctest ,
459+ doctest : RunnableDocTest ,
455460 rustdoc_options : & RustdocOptions ,
456461 supports_color : bool ,
457462 is_multiple_tests : bool ,
@@ -700,15 +705,15 @@ impl IndividualTestOptions {
700705}
701706
702707/// A doctest scraped from the code, ready to be turned into a runnable test.
703- pub ( crate ) struct ScrapedDoctest {
708+ pub ( crate ) struct ScrapedDocTest {
704709 filename : FileName ,
705710 line : usize ,
706711 langstr : LangString ,
707712 text : String ,
708713 name : String ,
709714}
710715
711- impl ScrapedDoctest {
716+ impl ScrapedDocTest {
712717 fn new (
713718 filename : FileName ,
714719 line : usize ,
@@ -748,14 +753,14 @@ impl ScrapedDoctest {
748753 }
749754}
750755
751- pub ( crate ) trait DoctestVisitor {
756+ pub ( crate ) trait DocTestVisitor {
752757 fn visit_test ( & mut self , test : String , config : LangString , rel_line : MdRelLine ) ;
753758 fn visit_header ( & mut self , _name : & str , _level : u32 ) { }
754759}
755760
756- struct CreateRunnableDoctests {
761+ struct CreateRunnableDocTests {
757762 standalone_tests : Vec < test:: TestDescAndFn > ,
758- mergeable_tests : FxHashMap < Edition , Vec < ( DocTestBuilder , ScrapedDoctest ) > > ,
763+ mergeable_tests : FxHashMap < Edition , Vec < ( DocTestBuilder , ScrapedDocTest ) > > ,
759764
760765 rustdoc_options : Arc < RustdocOptions > ,
761766 opts : GlobalTestOptions ,
@@ -765,10 +770,10 @@ struct CreateRunnableDoctests {
765770 can_merge_doctests : bool ,
766771}
767772
768- impl CreateRunnableDoctests {
769- fn new ( rustdoc_options : RustdocOptions , opts : GlobalTestOptions ) -> CreateRunnableDoctests {
773+ impl CreateRunnableDocTests {
774+ fn new ( rustdoc_options : RustdocOptions , opts : GlobalTestOptions ) -> CreateRunnableDocTests {
770775 let can_merge_doctests = rustdoc_options. edition >= Edition :: Edition2024 ;
771- CreateRunnableDoctests {
776+ CreateRunnableDocTests {
772777 standalone_tests : Vec :: new ( ) ,
773778 mergeable_tests : FxHashMap :: default ( ) ,
774779 rustdoc_options : Arc :: new ( rustdoc_options) ,
@@ -780,7 +785,7 @@ impl CreateRunnableDoctests {
780785 }
781786 }
782787
783- fn add_test ( & mut self , scraped_test : ScrapedDoctest ) {
788+ fn add_test ( & mut self , scraped_test : ScrapedDocTest ) {
784789 // For example `module/file.rs` would become `module_file_rs`
785790 let file = scraped_test
786791 . filename
@@ -829,7 +834,7 @@ impl CreateRunnableDoctests {
829834 fn generate_test_desc_and_fn (
830835 & mut self ,
831836 test : DocTestBuilder ,
832- scraped_test : ScrapedDoctest ,
837+ scraped_test : ScrapedDocTest ,
833838 ) -> test:: TestDescAndFn {
834839 if !scraped_test. langstr . compile_fail {
835840 self . compiling_test_count . fetch_add ( 1 , Ordering :: SeqCst ) ;
@@ -847,7 +852,7 @@ impl CreateRunnableDoctests {
847852
848853fn generate_test_desc_and_fn (
849854 test : DocTestBuilder ,
850- scraped_test : ScrapedDoctest ,
855+ scraped_test : ScrapedDocTest ,
851856 opts : GlobalTestOptions ,
852857 rustdoc_options : Arc < RustdocOptions > ,
853858 unused_externs : Arc < Mutex < Vec < UnusedExterns > > > ,
@@ -894,7 +899,7 @@ fn doctest_run_fn(
894899 test_opts : IndividualTestOptions ,
895900 global_opts : GlobalTestOptions ,
896901 doctest : DocTestBuilder ,
897- scraped_test : ScrapedDoctest ,
902+ scraped_test : ScrapedDocTest ,
898903 rustdoc_options : Arc < RustdocOptions > ,
899904 unused_externs : Arc < Mutex < Vec < UnusedExterns > > > ,
900905) -> Result < ( ) , String > {
@@ -907,7 +912,7 @@ fn doctest_run_fn(
907912 & global_opts,
908913 Some ( & global_opts. crate_name ) ,
909914 ) ;
910- let runnable_test = RunnableDoctest {
915+ let runnable_test = RunnableDocTest {
911916 full_test_code,
912917 full_test_line_offset,
913918 test_opts,
@@ -980,7 +985,7 @@ fn doctest_run_fn(
980985}
981986
982987#[ cfg( test) ] // used in tests
983- impl DoctestVisitor for Vec < usize > {
988+ impl DocTestVisitor for Vec < usize > {
984989 fn visit_test ( & mut self , _test : String , _config : LangString , rel_line : MdRelLine ) {
985990 self . push ( 1 + rel_line. offset ( ) ) ;
986991 }
0 commit comments