1
Fork 0

Delay parsing of --cfg and --check-cfg options.

By storing the unparsed values in `Config` and then parsing them within
`run_compiler`, the parsing functions can use the main symbol interner,
and not create their own short-lived interners.

This change also eliminates the need for one `EarlyErrorHandler` in
rustdoc, because parsing errors can be reported by another, slightly
later `EarlyErrorHandler`.
This commit is contained in:
Nicholas Nethercote 2023-10-30 13:37:34 +11:00
parent ec2b311914
commit 678e01a3fc
5 changed files with 271 additions and 289 deletions

View file

@ -757,8 +757,7 @@ fn main_args(
(false, true) => {
let input = options.input.clone();
let edition = options.edition;
let config =
core::create_config(handler, options, &render_options, using_internal_features);
let config = core::create_config(options, &render_options, using_internal_features);
// `markdown::render` can invoke `doctest::make_test`, which
// requires session globals and a thread pool, so we use
@ -791,7 +790,7 @@ fn main_args(
let scrape_examples_options = options.scrape_examples_options.clone();
let bin_crate = options.bin_crate;
let config = core::create_config(handler, options, &render_options, using_internal_features);
let config = core::create_config(options, &render_options, using_internal_features);
interface::run_compiler(config, |compiler| {
let sess = compiler.session();