Description
As discussed in #57019, i'd like to refactor the doctest parsing/execution code in rustdoc so that it checks for fn main
and extern crate
during compilation, not before. This allows us to take advantage of macro expansion and a proper parsing step to find multi-line attributes or extern crate
statements with the #[macro_use]
on a separate line.
I believe it's possible to break up the compilation steps in test::run_test
like in core::run_core
, except this time we'd stop after phase_2
and inspect the crate for our desired items. If the test doesn't have a fn main
or the right extern crate
statement, then we can modify the crate in-place (or attempt to splice in the right text in the original text and run compilation again) before continuing. I haven't tried it, but i'd like to sketch it out soon.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status