diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-02-23 03:18:53 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-02-26 20:24:00 +0300 |
| commit | cdbd8c2f2aa69c4b8fe6f004449440e87c4ab87e (patch) | |
| tree | 3cb1d034cf3a10a3ff41ef80013322ee7358dbf5 /src/libsyntax | |
| parent | bedbad61195d2eae69b43eca49c6d3e2aee8f208 (diff) | |
| download | rust-cdbd8c2f2aa69c4b8fe6f004449440e87c4ab87e.tar.gz rust-cdbd8c2f2aa69c4b8fe6f004449440e87c4ab87e.zip | |
Support flag `-Z ui-testing` for tweaking diagnostic output for UI tests
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/json.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index 98d5fa8f797..57f07ff33f5 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -40,6 +40,7 @@ pub struct JsonEmitter { pretty: bool, /// Whether "approximate suggestions" are enabled in the config approximate_suggestions: bool, + ui_testing: bool, } impl JsonEmitter { @@ -53,6 +54,7 @@ impl JsonEmitter { cm: code_map, pretty, approximate_suggestions, + ui_testing: false, } } @@ -73,8 +75,13 @@ impl JsonEmitter { cm: code_map, pretty, approximate_suggestions, + ui_testing: false, } } + + pub fn ui_testing(self, ui_testing: bool) -> Self { + Self { ui_testing, ..self } + } } impl Emitter for JsonEmitter { @@ -199,7 +206,8 @@ impl Diagnostic { } let buf = BufWriter::default(); let output = buf.clone(); - EmitterWriter::new(Box::new(buf), Some(je.cm.clone()), false, false).emit(db); + EmitterWriter::new(Box::new(buf), Some(je.cm.clone()), false, false) + .ui_testing(je.ui_testing).emit(db); let output = Arc::try_unwrap(output.0).unwrap().into_inner().unwrap(); let output = String::from_utf8(output).unwrap(); |
