about summary refs log tree commit diff
path: root/src/libsyntax/json
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-10 10:26:10 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-11-10 02:46:17 +0100
commitbe023ebe850261c6bb202a02a686827d821c3697 (patch)
tree4595cee969fbdb83ffc536ab940e15be2503e454 /src/libsyntax/json
parent5011ec7fedffe34d943654ffb4308875fc5ec8f3 (diff)
downloadrust-be023ebe850261c6bb202a02a686827d821c3697.tar.gz
rust-be023ebe850261c6bb202a02a686827d821c3697.zip
move config.rs to libsyntax_expand
Diffstat (limited to 'src/libsyntax/json')
-rw-r--r--src/libsyntax/json/tests.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libsyntax/json/tests.rs b/src/libsyntax/json/tests.rs
index eb0d9ef3947..1edefd5bc4b 100644
--- a/src/libsyntax/json/tests.rs
+++ b/src/libsyntax/json/tests.rs
@@ -2,7 +2,6 @@ use super::*;
 
 use crate::json::JsonEmitter;
 use crate::source_map::{FilePathMapping, SourceMap};
-use crate::tests::Shared;
 use crate::with_default_globals;
 
 use errors::emitter::{ColorConfig, HumanReadableErrorType};
@@ -27,6 +26,20 @@ struct SpanTestData {
     pub column_end: u32,
 }
 
+struct Shared<T> {
+    data: Arc<Mutex<T>>,
+}
+
+impl<T: Write> Write for Shared<T> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.data.lock().unwrap().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.data.lock().unwrap().flush()
+    }
+}
+
 /// 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] };