pretty: bool,
ui_testing: bool,
json_rendered: HumanReadableErrorType,
+ terminal_width: Option<usize>,
macro_backtrace: bool,
}
source_map: Lrc<SourceMap>,
pretty: bool,
json_rendered: HumanReadableErrorType,
+ terminal_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
+ terminal_width,
macro_backtrace,
}
}
pub fn basic(
pretty: bool,
json_rendered: HumanReadableErrorType,
+ terminal_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
let file_path_mapping = FilePathMapping::empty();
Lrc::new(SourceMap::new(file_path_mapping)),
pretty,
json_rendered,
+ terminal_width,
macro_backtrace,
)
}
source_map: Lrc<SourceMap>,
pretty: bool,
json_rendered: HumanReadableErrorType,
+ terminal_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
+ terminal_width,
macro_backtrace,
}
}
// The following data types are provided just for serialisation.
-#[derive(RustcEncodable)]
+#[derive(Encodable)]
struct Diagnostic {
/// The primary error message.
message: String,
rendered: Option<String>,
}
-#[derive(RustcEncodable)]
+#[derive(Encodable)]
struct DiagnosticSpan {
file_name: String,
byte_start: u32,
expansion: Option<Box<DiagnosticSpanMacroExpansion>>,
}
-#[derive(RustcEncodable)]
+#[derive(Encodable)]
struct DiagnosticSpanLine {
text: String,
highlight_end: usize,
}
-#[derive(RustcEncodable)]
+#[derive(Encodable)]
struct DiagnosticSpanMacroExpansion {
/// span where macro was applied to generate this code; note that
/// this may itself derive from a macro (if
def_site_span: DiagnosticSpan,
}
-#[derive(RustcEncodable)]
+#[derive(Encodable)]
struct DiagnosticCode {
/// The code itself.
code: String,
explanation: Option<&'static str>,
}
-#[derive(RustcEncodable)]
+#[derive(Encodable)]
struct ArtifactNotification<'a> {
/// The path of the artifact.
artifact: &'a Path,
let buf = BufWriter::default();
let output = buf.clone();
je.json_rendered
- .new_emitter(Box::new(buf), Some(je.sm.clone()), false, None, je.macro_backtrace)
+ .new_emitter(
+ Box::new(buf),
+ Some(je.sm.clone()),
+ false,
+ je.terminal_width,
+ je.macro_backtrace,
+ )
.ui_testing(je.ui_testing)
.emit_diagnostic(diag);
let output = Arc::try_unwrap(output.0).unwrap().into_inner().unwrap();