Skip to content

Commit

Permalink
Use SourceMap to load debugger visualizer files
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Dec 8, 2024
1 parent f33a8c6 commit c199c49
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions compiler/rustc_passes/src/debugger_visualizer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Detecting usage of the `#[debugger_visualizer]` attribute.
use rustc_ast::Attribute;
use rustc_data_structures::sync::Lrc;
use rustc_expand::base::resolve_path;
use rustc_middle::middle::debugger_visualizer::{DebuggerVisualizerFile, DebuggerVisualizerType};
use rustc_middle::query::{LocalCrate, Providers};
Expand Down Expand Up @@ -49,10 +48,10 @@ impl DebuggerVisualizerCollector<'_> {
}
};

match std::fs::read(&file) {
Ok(contents) => {
match self.sess.source_map().load_binary_file(&file) {
Ok((source, _)) => {
self.visualizers.push(DebuggerVisualizerFile::new(
Lrc::from(contents),
source,
visualizer_type,
file,
));
Expand Down

0 comments on commit c199c49

Please sign in to comment.