11use std:: cell:: RefCell ;
22use std:: collections:: BTreeMap ;
3- use std:: error:: Error as StdError ;
43use std:: io;
54use std:: path:: { Path , PathBuf } ;
65use std:: rc:: Rc ;
@@ -16,6 +15,7 @@ use rustc_span::symbol::sym;
1615
1716use super :: cache:: { build_index, ExternalLocation } ;
1817use super :: print_item:: { full_path, item_path, print_item} ;
18+ use super :: templates;
1919use super :: write_shared:: write_shared;
2020use super :: {
2121 collect_spans_and_sources, print_sidebar, settings, AllTypes , LinkFromSrc , NameDoc , StylePath ,
@@ -33,7 +33,6 @@ use crate::formats::FormatRenderer;
3333use crate :: html:: escape:: Escape ;
3434use crate :: html:: format:: Buffer ;
3535use crate :: html:: markdown:: { self , plain_text_summary, ErrorCodes , IdMap } ;
36- use crate :: html:: static_files:: { PAGE , PRINT_ITEM } ;
3736use crate :: html:: { layout, sources} ;
3837
3938/// Major driving force in all rustdoc rendering. This contains information
@@ -416,16 +415,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
416415 } ;
417416 let mut issue_tracker_base_url = None ;
418417 let mut include_sources = true ;
419-
420- let mut templates = tera:: Tera :: default ( ) ;
421- templates. add_raw_template ( "page.html" , PAGE ) . map_err ( |e| Error {
422- file : "page.html" . into ( ) ,
423- error : format ! ( "{}: {}" , e, e. source( ) . map( |e| e. to_string( ) ) . unwrap_or_default( ) ) ,
424- } ) ?;
425- templates. add_raw_template ( "print_item.html" , PRINT_ITEM ) . map_err ( |e| Error {
426- file : "print_item.html" . into ( ) ,
427- error : format ! ( "{}: {}" , e, e. source( ) . map( |e| e. to_string( ) ) . unwrap_or_default( ) ) ,
428- } ) ?;
418+ let templates = templates:: load ( ) ?;
429419
430420 // Crawl the crate attributes looking for attributes which control how we're
431421 // going to emit HTML
0 commit comments