about summary refs log tree commit diff
path: root/src/librustc_errors/json
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-09 11:50:32 -0700
committerGitHub <noreply@github.com>2020-07-09 11:50:32 -0700
commit89c9e970ddbe47622bcc52b135d35508510daa55 (patch)
treea3d85f853606c2815705ac3b240022efdc4faac2 /src/librustc_errors/json
parent07301e3d549f3f41a3d0a9f31aade293a3b9a3af (diff)
parent81c5bb6a3fb02d1c1c3a4698e9e0e031ef2f4e4e (diff)
Rollup merge of #74079 - nnethercote:session-globals, r=nikomatsakis
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`

r? @Aaron1011
Diffstat (limited to 'src/librustc_errors/json')
-rw-r--r--src/librustc_errors/json/tests.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_errors/json/tests.rs b/src/librustc_errors/json/tests.rs
index a2ed6ad6f35..dcfcdbc63f2 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());