1
Fork 0

migrate debugger_visualizer.rs to translateable diagnostics

This commit is contained in:
Nathan Stocks 2022-09-21 22:55:29 -06:00
parent c103c3059f
commit 1e86226e9d

View file

@ -13,6 +13,8 @@ use rustc_span::{sym, DebuggerVisualizerFile, DebuggerVisualizerType};
use std::sync::Arc; use std::sync::Arc;
use crate::errors::DebugVisualizerUnreadable;
fn check_for_debugger_visualizer<'tcx>( fn check_for_debugger_visualizer<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
hir_id: HirId, hir_id: HirId,
@ -54,13 +56,12 @@ fn check_for_debugger_visualizer<'tcx>(
debugger_visualizers debugger_visualizers
.insert(DebuggerVisualizerFile::new(Arc::from(contents), visualizer_type)); .insert(DebuggerVisualizerFile::new(Arc::from(contents), visualizer_type));
} }
Err(err) => { Err(error) => {
tcx.sess tcx.sess.emit_err(DebugVisualizerUnreadable {
.struct_span_err( span: meta_item.span,
meta_item.span, file: &file,
&format!("couldn't read {}: {}", file.display(), err), error,
) });
.emit();
} }
} }
} }