diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-05-19 23:10:09 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-08-23 00:57:29 +0200 |
| commit | f8b8cc4cceda39ec2c0a933fd1ba4b9951401862 (patch) | |
| tree | 2da2dcab650df38c365eb31c5dd85a80e69fcf66 /src/librustdoc/formats | |
| parent | ab000e15e1c6fd571882ebd0852ee39fabe6820d (diff) | |
| download | rust-f8b8cc4cceda39ec2c0a933fd1ba4b9951401862.tar.gz rust-f8b8cc4cceda39ec2c0a933fd1ba4b9951401862.zip | |
Do macro expansion at AST level rather than HIR
Diffstat (limited to 'src/librustdoc/formats')
| -rw-r--r-- | src/librustdoc/formats/renderer.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs index aa4be4db997..305c8c39ba7 100644 --- a/src/librustdoc/formats/renderer.rs +++ b/src/librustdoc/formats/renderer.rs @@ -31,15 +31,6 @@ pub(crate) trait FormatRenderer<'tcx>: Sized { /// reset the information between each call to `item` by using `restore_module_data`. type ModuleData; - /// Sets up any state required for the renderer. When this is called the cache has already been - /// populated. - fn init( - krate: clean::Crate, - options: RenderOptions, - cache: Cache, - tcx: TyCtxt<'tcx>, - ) -> Result<(Self, clean::Crate), Error>; - /// This method is called right before call [`Self::item`]. This method returns a type /// containing information that needs to be reset after the [`Self::item`] method has been /// called with the [`Self::restore_module_data`] method. @@ -105,18 +96,23 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>( } /// Main method for rendering a crate. -pub(crate) fn run_format<'tcx, T: FormatRenderer<'tcx>>( +pub(crate) fn run_format< + 'tcx, + T: FormatRenderer<'tcx>, + F: FnOnce(clean::Crate, RenderOptions, Cache, TyCtxt<'tcx>) -> Result<(T, clean::Crate), Error>, +>( krate: clean::Crate, options: RenderOptions, cache: Cache, tcx: TyCtxt<'tcx>, + init: F, ) -> Result<(), Error> { let prof = &tcx.sess.prof; let emit_crate = options.should_emit_crate(); let (mut format_renderer, krate) = prof .verbose_generic_activity_with_arg("create_renderer", T::descr()) - .run(|| T::init(krate, options, cache, tcx))?; + .run(|| init(krate, options, cache, tcx))?; if !emit_crate { return Ok(()); |
