diff options
| author | Jonathan Turner <jonathandturner@users.noreply.github.com> | 2016-09-28 20:21:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-28 20:21:51 -0700 |
| commit | 45fd0626a4f5cf84cef8de1c644b5ff582c65e8b (patch) | |
| tree | 274939aec1bffabcc86ceafee1668d0d9e8b17e1 /src/libsyntax | |
| parent | 8f2c0005066682a341673172983924ae189b25d5 (diff) | |
| parent | e8a4db25acde9d2d23a4ebfb464d283d495b5b8d (diff) | |
| download | rust-45fd0626a4f5cf84cef8de1c644b5ff582c65e8b.tar.gz rust-45fd0626a4f5cf84cef8de1c644b5ff582c65e8b.zip | |
Rollup merge of #36760 - nrc:input2, r=alexcrichton
Allow supplying an error destination via the compiler driver Allows replacing stderr with a buffer from the client. Also, some refactoring around run_compiler.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/json.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index a40c30b3e33..a1c273baeea 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -38,14 +38,24 @@ pub struct JsonEmitter { } impl JsonEmitter { + pub fn stderr(registry: Option<Registry>, + code_map: Rc<CodeMap>) -> JsonEmitter { + JsonEmitter { + dst: Box::new(io::stderr()), + registry: registry, + cm: code_map, + } + } + pub fn basic() -> JsonEmitter { JsonEmitter::stderr(None, Rc::new(CodeMap::new())) } - pub fn stderr(registry: Option<Registry>, - code_map: Rc<CodeMap>) -> JsonEmitter { + pub fn new(dst: Box<Write + Send>, + registry: Option<Registry>, + code_map: Rc<CodeMap>) -> JsonEmitter { JsonEmitter { - dst: Box::new(io::stderr()), + dst: dst, registry: registry, cm: code_map, } |
