diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-07-06 10:53:14 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-07-09 14:11:44 +1000 |
| commit | 81c5bb6a3fb02d1c1c3a4698e9e0e031ef2f4e4e (patch) | |
| tree | 1415d42d29241899a5a7ebeef59a556256ab2bb5 /src/librustc_errors | |
| parent | 2753fab7ce3647033146b07c8b6c9f4856a910b0 (diff) | |
| download | rust-81c5bb6a3fb02d1c1c3a4698e9e0e031ef2f4e4e.tar.gz rust-81c5bb6a3fb02d1c1c3a4698e9e0e031ef2f4e4e.zip | |
Eliminate confusing "globals" terminology.
There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs`
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/json/tests.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_errors/json/tests.rs b/src/librustc_errors/json/tests.rs index 35912901d68..3a501dd5254 100644 --- a/src/librustc_errors/json/tests.rs +++ b/src/librustc_errors/json/tests.rs @@ -39,16 +39,16 @@ impl<T: Write> Write for Shared<T> { } } -fn with_default_globals(f: impl FnOnce()) { - let globals = rustc_span::Globals::new(rustc_span::edition::DEFAULT_EDITION); - rustc_span::GLOBALS.set(&globals, || rustc_span::GLOBALS.set(&globals, f)) +fn with_default_session_globals(f: impl FnOnce()) { + let session_globals = rustc_span::SessionGlobals::new(rustc_span::edition::DEFAULT_EDITION); + rustc_span::SESSION_GLOBALS.set(&session_globals, f); } /// Test the span yields correct positions in JSON. fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) { let expected_output = TestData { spans: vec![expected_output] }; - with_default_globals(|| { + with_default_session_globals(|| { let sm = Lrc::new(SourceMap::new(FilePathMapping::empty())); sm.new_source_file(Path::new("test.rs").to_owned().into(), code.to_owned()); |
