diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-03-04 16:31:49 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-03-05 08:11:45 +1100 |
| commit | 80d2bdb6191609c8a3940a1a7959ac1ac16e8ed6 (patch) | |
| tree | 828bd479b6f4dfa59a3fe1b4efe6f9439d0a216f /compiler/rustc_interface/src/interface.rs | |
| parent | 4260f7ec679dca38911e983113a0243fb8f905dc (diff) | |
| download | rust-80d2bdb6191609c8a3940a1a7959ac1ac16e8ed6.tar.gz rust-80d2bdb6191609c8a3940a1a7959ac1ac16e8ed6.zip | |
Rename all `ParseSess` variables/fields/lifetimes as `psess`.
Existing names for values of this type are `sess`, `parse_sess`, `parse_session`, and `ps`. `sess` is particularly annoying because that's also used for `Session` values, which are often co-located, and it can be difficult to know which type a value named `sess` refers to. (That annoyance is the main motivation for this change.) `psess` is nice and short, which is good for a name used this much. The commit also renames some `parse_sess_created` values as `psess_created`.
Diffstat (limited to 'compiler/rustc_interface/src/interface.rs')
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index cd7957c3bce..3a2bbed19be 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -45,7 +45,7 @@ pub struct Compiler { pub(crate) fn parse_cfg(dcx: &DiagCtxt, cfgs: Vec<String>) -> Cfg { cfgs.into_iter() .map(|s| { - let sess = ParseSess::with_silent_emitter(format!( + let psess = ParseSess::with_silent_emitter(format!( "this error occurred on the command line: `--cfg={s}`" )); let filename = FileName::cfg_spec_source_code(&s); @@ -61,7 +61,7 @@ pub(crate) fn parse_cfg(dcx: &DiagCtxt, cfgs: Vec<String>) -> Cfg { }; } - match maybe_new_parser_from_source_str(&sess, filename, s.to_string()) { + match maybe_new_parser_from_source_str(&psess, filename, s.to_string()) { Ok(mut parser) => match parser.parse_meta_item() { Ok(meta_item) if parser.token == token::Eof => { if meta_item.path.segments.len() != 1 { @@ -107,7 +107,7 @@ pub(crate) fn parse_check_cfg(dcx: &DiagCtxt, specs: Vec<String>) -> CheckCfg { let mut check_cfg = CheckCfg { exhaustive_names, exhaustive_values, ..CheckCfg::default() }; for s in specs { - let sess = ParseSess::with_silent_emitter(format!( + let psess = ParseSess::with_silent_emitter(format!( "this error occurred on the command line: `--check-cfg={s}`" )); let filename = FileName::cfg_spec_source_code(&s); @@ -127,7 +127,7 @@ pub(crate) fn parse_check_cfg(dcx: &DiagCtxt, specs: Vec<String>) -> CheckCfg { error!("expected `cfg(name, values(\"value1\", \"value2\", ... \"valueN\"))`") }; - let mut parser = match maybe_new_parser_from_source_str(&sess, filename, s.to_string()) { + let mut parser = match maybe_new_parser_from_source_str(&psess, filename, s.to_string()) { Ok(parser) => parser, Err(errs) => { errs.into_iter().for_each(|err| err.cancel()); @@ -277,7 +277,7 @@ pub struct Config { pub lint_caps: FxHashMap<lint::LintId, lint::Level>, /// This is a callback from the driver that is called when [`ParseSess`] is created. - pub parse_sess_created: Option<Box<dyn FnOnce(&mut ParseSess) + Send>>, + pub psess_created: Option<Box<dyn FnOnce(&mut ParseSess) + Send>>, /// This is a callback to hash otherwise untracked state used by the caller, if the /// hash changes between runs the incremental cache will be cleared. @@ -393,14 +393,14 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se let cfg = parse_cfg(&sess.dcx(), config.crate_cfg); let mut cfg = config::build_configuration(&sess, cfg); util::add_configuration(&mut cfg, &mut sess, &*codegen_backend); - sess.parse_sess.config = cfg; + sess.psess.config = cfg; let mut check_cfg = parse_check_cfg(&sess.dcx(), config.crate_check_cfg); check_cfg.fill_well_known(&sess.target); - sess.parse_sess.check_config = check_cfg; + sess.psess.check_config = check_cfg; - if let Some(parse_sess_created) = config.parse_sess_created { - parse_sess_created(&mut sess.parse_sess); + if let Some(psess_created) = config.psess_created { + psess_created(&mut sess.psess); } if let Some(hash_untracked_state) = config.hash_untracked_state { @@ -422,7 +422,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se let compiler = Compiler { sess, codegen_backend, override_queries: config.override_queries }; - rustc_span::set_source_map(compiler.sess.parse_sess.clone_source_map(), move || { + rustc_span::set_source_map(compiler.sess.psess.clone_source_map(), move || { // There are two paths out of `f`. // - Normal exit. // - Panic, e.g. triggered by `abort_if_errors`. |
