Skip to content

Commit 798393a

Browse files
committed
Fix tests
1 parent 1f321d4 commit 798393a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

crates/rustc_utils/src/source_map/range.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl FilenameIndex {
144144
// rustc seems to store relative paths to files in the workspace, so if filename is absolute,
145145
// we can compare them using Path::ends_with
146146
FileName::Real(real_file_name) => {
147-
let other = real_file_name.path(RemapPathScopeComponents::empty()).to_path_buf();
147+
let other = real_file_name.path(RemapPathScopeComponents::DOCUMENTATION).to_path_buf();
148148
let canonical = other.canonicalize();
149149
let other = canonical.as_ref().unwrap_or(&other);
150150
filename.ends_with(other)
@@ -159,7 +159,7 @@ impl FilenameIndex {
159159
.iter()
160160
.filter_map(|file| match &file.name {
161161
FileName::Real(other) =>
162-
Some(other.path(RemapPathScopeComponents::empty()).display().to_string()),
162+
Some(other.path(RemapPathScopeComponents::DOCUMENTATION).display().to_string()),
163163
_ => None,
164164
})
165165
.collect::<Vec<_>>()
@@ -273,7 +273,7 @@ impl ByteRange {
273273
let file = source_map.lookup_source_file(span.lo());
274274
let filename = match &file.name {
275275
FileName::Real(real_file_name) => {
276-
let filename = real_file_name.path(RemapPathScopeComponents::empty());
276+
let filename = real_file_name.path(RemapPathScopeComponents::DOCUMENTATION);
277277
Filename(filename.to_path_buf()).intern_with_ctx(&mut ctx)
278278
}
279279
filename => bail!("Range::from_span doesn't support {filename:?}"),

crates/rustc_utils/src/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl FileLoader for StringLoader {
4848
}
4949

5050
fn current_directory(&self) -> io::Result<std::path::PathBuf> {
51-
Err(io::Error::new(io::ErrorKind::NotFound, "not found"))
51+
Ok(std::env::current_dir().unwrap())
5252
}
5353
}
5454

0 commit comments

Comments
 (0)