diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-02 15:24:04 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-02 19:35:04 +1100 |
| commit | 9893b75e0df842483710ccb8429bfeeaa56b7e76 (patch) | |
| tree | c2aa0c09a79e4efd341dcb372ff60aa1a6043219 | |
| parent | edb357f91224da9106dca7de43947e7257db036d (diff) | |
| download | rust-9893b75e0df842483710ccb8429bfeeaa56b7e76.tar.gz rust-9893b75e0df842483710ccb8429bfeeaa56b7e76.zip | |
Replace two `create_default_session_if_not_set_then` uses.
With `create_default_session_globals_then`, which is preferable when it is appropriate.
| -rw-r--r-- | compiler/rustc_expand/src/tests.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/tests.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_expand/src/tests.rs b/compiler/rustc_expand/src/tests.rs index 8e3219c138c..9f52669e188 100644 --- a/compiler/rustc_expand/src/tests.rs +++ b/compiler/rustc_expand/src/tests.rs @@ -2,7 +2,7 @@ use rustc_ast as ast; use rustc_ast::tokenstream::TokenStream; use rustc_parse::{new_parser_from_source_str, parser::Parser, source_file_to_stream}; use rustc_session::parse::ParseSess; -use rustc_span::create_default_session_if_not_set_then; +use rustc_span::create_default_session_globals_then; use rustc_span::source_map::{FilePathMapping, SourceMap}; use rustc_span::{BytePos, Span}; @@ -181,7 +181,7 @@ impl<T: Write> Write for Shared<T> { } fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &str) { - create_default_session_if_not_set_then(|_| { + create_default_session_globals_then(|| { let (handler, source_map, output) = create_test_handler(); source_map.new_source_file(Path::new("test.rs").to_owned().into(), file_text.to_owned()); diff --git a/compiler/rustc_hir/src/tests.rs b/compiler/rustc_hir/src/tests.rs index a40a0178710..74b8e88a977 100644 --- a/compiler/rustc_hir/src/tests.rs +++ b/compiler/rustc_hir/src/tests.rs @@ -2,7 +2,7 @@ use crate::definitions::{DefKey, DefPathData, DisambiguatedDefPathData}; use rustc_data_structures::stable_hasher::Hash64; use rustc_span::def_id::{DefPathHash, StableCrateId}; use rustc_span::edition::Edition; -use rustc_span::{create_session_if_not_set_then, Symbol}; +use rustc_span::{create_session_globals_then, Symbol}; #[test] fn def_path_hash_depends_on_crate_id() { @@ -14,7 +14,7 @@ fn def_path_hash_depends_on_crate_id() { // the crate by changing the crate disambiguator (e.g. via bumping the // crate's version number). - create_session_if_not_set_then(Edition::Edition2024, |_| { + create_session_globals_then(Edition::Edition2024, || { let id0 = StableCrateId::new(Symbol::intern("foo"), false, vec!["1".to_string()], ""); let id1 = StableCrateId::new(Symbol::intern("foo"), false, vec!["2".to_string()], ""); |
