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_driver_impl | |
| 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_driver_impl')
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_driver_impl/src/pretty.rs | 6 |
2 files changed, 9 insertions, 11 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 410e7eba30a..ab1e37e4ac2 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -314,7 +314,7 @@ fn run_compiler( file_loader, locale_resources: DEFAULT_LOCALE_RESOURCES, lint_caps: Default::default(), - parse_sess_created: None, + psess_created: None, hash_untracked_state: None, register_lints: None, override_queries: None, @@ -768,7 +768,7 @@ fn print_crate_info( } Cfg => { let mut cfgs = sess - .parse_sess + .psess .config .iter() .filter_map(|&(name, value)| { @@ -1215,12 +1215,10 @@ pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option<geto fn parse_crate_attrs<'a>(sess: &'a Session) -> PResult<'a, ast::AttrVec> { match &sess.io.input { - Input::File(ifile) => rustc_parse::parse_crate_attrs_from_file(ifile, &sess.parse_sess), - Input::Str { name, input } => rustc_parse::parse_crate_attrs_from_source_str( - name.clone(), - input.clone(), - &sess.parse_sess, - ), + Input::File(ifile) => rustc_parse::parse_crate_attrs_from_file(ifile, &sess.psess), + Input::Str { name, input } => { + rustc_parse::parse_crate_attrs_from_source_str(name.clone(), input.clone(), &sess.psess) + } } } diff --git a/compiler/rustc_driver_impl/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs index ff5ffd2454a..768d98ce01e 100644 --- a/compiler/rustc_driver_impl/src/pretty.rs +++ b/compiler/rustc_driver_impl/src/pretty.rs @@ -260,7 +260,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) { ExpandedIdentified => Box::new(AstIdentifiedAnn), ExpandedHygiene => Box::new(AstHygieneAnn { sess }), }; - let parse = &sess.parse_sess; + let psess = &sess.psess; let is_expanded = ppm.needs_ast_map(); ex.with_krate(|krate| { pprust_ast::print_crate( @@ -270,8 +270,8 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) { src, &*annotation, is_expanded, - parse.edition, - &sess.parse_sess.attr_id_generator, + psess.edition, + &sess.psess.attr_id_generator, ) }) } |
