Rename RealFileName::Named to LocalPath

This commit is contained in:
Andy Wang 2021-05-04 13:37:28 +01:00 committed by Caleb Cartwright
parent e4b5621b0e
commit ef31361766
2 changed files with 10 additions and 9 deletions

View File

@ -70,7 +70,7 @@ impl From<&FileName> for rustc_span::FileName {
fn from(filename: &FileName) -> rustc_span::FileName { fn from(filename: &FileName) -> rustc_span::FileName {
match filename { match filename {
FileName::Real(path) => { FileName::Real(path) => {
rustc_span::FileName::Real(rustc_span::RealFileName::Named(path.to_owned())) rustc_span::FileName::Real(rustc_span::RealFileName::LocalPath(path.to_owned()))
} }
FileName::Stdin => rustc_span::FileName::Custom("stdin".to_owned()), FileName::Stdin => rustc_span::FileName::Custom("stdin".to_owned()),
} }

View File

@ -65,7 +65,8 @@ fn emit_diagnostic(&mut self, db: &Diagnostic) {
} }
if let Some(primary_span) = &db.span.primary_span() { if let Some(primary_span) = &db.span.primary_span() {
let file_name = self.source_map.span_to_filename(*primary_span); let file_name = self.source_map.span_to_filename(*primary_span);
if let rustc_span::FileName::Real(rustc_span::RealFileName::Named(ref path)) = file_name if let rustc_span::FileName::Real(rustc_span::RealFileName::LocalPath(ref path)) =
file_name
{ {
if self if self
.ignore_path_set .ignore_path_set
@ -157,7 +158,7 @@ pub(crate) fn is_file_parsed(&self, path: &Path) -> bool {
self.parse_sess self.parse_sess
.source_map() .source_map()
.get_source_file(&rustc_span::FileName::Real( .get_source_file(&rustc_span::FileName::Real(
rustc_span::RealFileName::Named(path.to_path_buf()), rustc_span::RealFileName::LocalPath(path.to_path_buf()),
)) ))
.is_some() .is_some()
} }
@ -347,7 +348,7 @@ fn handles_fatal_parse_error_in_ignored_file() {
let source = let source =
String::from(r#"extern "system" fn jni_symbol!( funcName ) ( ... ) -> {} "#); String::from(r#"extern "system" fn jni_symbol!( funcName ) ( ... ) -> {} "#);
source_map.new_source_file( source_map.new_source_file(
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("foo.rs"))), SourceMapFileName::Real(RealFileName::LocalPath(PathBuf::from("foo.rs"))),
source, source,
); );
let mut emitter = build_emitter( let mut emitter = build_emitter(
@ -374,7 +375,7 @@ fn handles_recoverable_parse_error_in_ignored_file() {
let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty())); let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let source = String::from(r#"pub fn bar() { 1x; }"#); let source = String::from(r#"pub fn bar() { 1x; }"#);
source_map.new_source_file( source_map.new_source_file(
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("foo.rs"))), SourceMapFileName::Real(RealFileName::LocalPath(PathBuf::from("foo.rs"))),
source, source,
); );
let mut emitter = build_emitter( let mut emitter = build_emitter(
@ -400,7 +401,7 @@ fn handles_recoverable_parse_error_in_non_ignored_file() {
let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty())); let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let source = String::from(r#"pub fn bar() { 1x; }"#); let source = String::from(r#"pub fn bar() { 1x; }"#);
source_map.new_source_file( source_map.new_source_file(
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("foo.rs"))), SourceMapFileName::Real(RealFileName::LocalPath(PathBuf::from("foo.rs"))),
source, source,
); );
let mut emitter = build_emitter( let mut emitter = build_emitter(
@ -430,15 +431,15 @@ fn handles_mix_of_recoverable_parse_error() {
let fatal_source = let fatal_source =
String::from(r#"extern "system" fn jni_symbol!( funcName ) ( ... ) -> {} "#); String::from(r#"extern "system" fn jni_symbol!( funcName ) ( ... ) -> {} "#);
source_map.new_source_file( source_map.new_source_file(
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("bar.rs"))), SourceMapFileName::Real(RealFileName::LocalPath(PathBuf::from("bar.rs"))),
bar_source, bar_source,
); );
source_map.new_source_file( source_map.new_source_file(
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("foo.rs"))), SourceMapFileName::Real(RealFileName::LocalPath(PathBuf::from("foo.rs"))),
foo_source, foo_source,
); );
source_map.new_source_file( source_map.new_source_file(
SourceMapFileName::Real(RealFileName::Named(PathBuf::from("fatal.rs"))), SourceMapFileName::Real(RealFileName::LocalPath(PathBuf::from("fatal.rs"))),
fatal_source, fatal_source,
); );
let mut emitter = build_emitter( let mut emitter = build_emitter(