diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-05 12:47:12 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-06 09:12:22 +1100 |
| commit | 618409901ac354b57e6f3ea9fdbd6c4e88a10ef9 (patch) | |
| tree | 028f2cfddeebe08522e05c33682aebd6ec09063d /compiler/rustc_interface/src/tests.rs | |
| parent | 35ac2816a0b1e0ff45d64a8b33a1ed9724147be3 (diff) | |
| download | rust-618409901ac354b57e6f3ea9fdbd6c4e88a10ef9.tar.gz rust-618409901ac354b57e6f3ea9fdbd6c4e88a10ef9.zip | |
Fewer early errors.
`build_session` is passed an `EarlyErrorHandler` and then constructs a `Handler`. But the `EarlyErrorHandler` is still used for some time after that. This commit changes `build_session` so it consumes the passed `EarlyErrorHandler`, and also drops it as soon as the `Handler` is built. As a result, `parse_cfg` and `parse_check_cfg` now take a `Handler` instead of an `EarlyErrorHandler`.
Diffstat (limited to 'compiler/rustc_interface/src/tests.rs')
| -rw-r--r-- | compiler/rustc_interface/src/tests.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index f65e37d11e8..f7b6ab331a5 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -26,10 +26,9 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; fn mk_session(matches: getopts::Matches) -> (Session, Cfg) { - let mut handler = EarlyErrorHandler::new(ErrorOutputType::default()); + let mut early_handler = EarlyErrorHandler::new(ErrorOutputType::default()); let registry = registry::Registry::new(&[]); - let sessopts = build_session_options(&mut handler, &matches); - let cfg = parse_cfg(&handler, matches.opt_strs("cfg")); + let sessopts = build_session_options(&mut early_handler, &matches); let temps_dir = sessopts.unstable_opts.temps_dir.as_deref().map(PathBuf::from); let io = CompilerIO { input: Input::Str { name: FileName::Custom(String::new()), input: String::new() }, @@ -38,7 +37,7 @@ fn mk_session(matches: getopts::Matches) -> (Session, Cfg) { temps_dir, }; let sess = build_session( - &handler, + early_handler, sessopts, io, None, @@ -52,6 +51,7 @@ fn mk_session(matches: getopts::Matches) -> (Session, Cfg) { Arc::default(), Default::default(), ); + let cfg = parse_cfg(&sess.diagnostic(), matches.opt_strs("cfg")); (sess, cfg) } |
