mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Use SourceMap to load debugger visualizer files
This commit is contained in:
parent
f33a8c6426
commit
c199c49aef
@ -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};
|
||||
@ -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,
|
||||
));
|
||||
|
Loading…
Reference in New Issue
Block a user