Skip to content

Commit

Permalink
Sync with changes to Diagnostic and JsonEmitter
Browse files Browse the repository at this point in the history
  • Loading branch information
adpaco-aws committed Mar 1, 2024
1 parent 20723d8 commit ea494c2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions kani-compiler/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
//! Module used to configure a compiler session.

use crate::args::Arguments;
use rustc_data_structures::sync::Lrc;
use rustc_errors::emitter::Emitter;
use rustc_errors::{
emitter::Emitter, emitter::HumanReadableErrorType, fallback_fluent_bundle, json::JsonEmitter,
ColorConfig, Diagnostic, TerminalUrl,
emitter::HumanReadableErrorType, fallback_fluent_bundle, json::JsonEmitter, ColorConfig,
DiagInner,
};
use rustc_session::config::ErrorOutputType;
use rustc_session::EarlyDiagCtxt;
use rustc_span::source_map::FilePathMapping;
use rustc_span::source_map::SourceMap;
use std::io;
use std::io::IsTerminal;
use std::panic;
use std::sync::LazyLock;
Expand Down Expand Up @@ -49,17 +54,14 @@ static JSON_PANIC_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send
let msg = format!("Kani unexpectedly panicked at {info}.",);
let fallback_bundle =
fallback_fluent_bundle(rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), false);
let mut emitter = JsonEmitter::basic(
false,
HumanReadableErrorType::Default(ColorConfig::Never),
None,
let mut emitter = JsonEmitter::new(
Box::new(io::BufWriter::new(io::stderr())),
Lrc::new(SourceMap::new(FilePathMapping::empty())),
fallback_bundle,
None,
false,
false,
TerminalUrl::No,
HumanReadableErrorType::Default(ColorConfig::Never),
);
let diagnostic = Diagnostic::new(rustc_errors::Level::Bug, msg);
let diagnostic = DiagInner::new(rustc_errors::Level::Bug, msg);
emitter.emit_diagnostic(diagnostic);
(*JSON_PANIC_HOOK)(info);
}));
Expand Down

0 comments on commit ea494c2

Please sign in to comment.