Skip to content

Commit

Permalink
Rollup merge of rust-lang#134041 - clubby789:debugvis-sourcemap, r=ji…
Browse files Browse the repository at this point in the history
…eyouxu

Use SourceMap to load debugger visualizer files
  • Loading branch information
fmease authored Dec 10, 2024
2 parents 8e9953f + c199c49 commit 599ff4d
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 599ff4d

Please sign in to comment.