diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-05-05 21:31:25 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2021-07-08 16:16:28 +0200 |
| commit | a2654fb64c9c9d368063b488693d8da17bc9b4e9 (patch) | |
| tree | e6337d870d12feb89266d5dc2a77214458af7440 /compiler/rustc_errors/src/json/tests.rs | |
| parent | 0cd0709f19d316c4796fa71c5f52c8612a5f3771 (diff) | |
| download | rust-a2654fb64c9c9d368063b488693d8da17bc9b4e9.tar.gz rust-a2654fb64c9c9d368063b488693d8da17bc9b4e9.zip | |
Rework SESSION_GLOBALS API to prevent overwriting it
Diffstat (limited to 'compiler/rustc_errors/src/json/tests.rs')
| -rw-r--r-- | compiler/rustc_errors/src/json/tests.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/compiler/rustc_errors/src/json/tests.rs b/compiler/rustc_errors/src/json/tests.rs index e69e868c8ed..d055937ac36 100644 --- a/compiler/rustc_errors/src/json/tests.rs +++ b/compiler/rustc_errors/src/json/tests.rs @@ -39,16 +39,11 @@ impl<T: Write> Write for Shared<T> { } } -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_session_globals(|| { + rustc_span::create_default_session_globals_then(|| { let sm = Lrc::new(SourceMap::new(FilePathMapping::empty())); sm.new_source_file(Path::new("test.rs").to_owned().into(), code.to_owned()); |
