Skip to content

Commit 2809ecc

Browse files
Implemented Display for SourceFileName.
1 parent b41248c commit 2809ecc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/librustc_span/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1146,8 +1146,12 @@ impl<D: Decoder> Decodable<D> for SourceFileName {
11461146
}
11471147

11481148
impl std::fmt::Display for SourceFileName {
1149-
fn fmt(&self, _fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1150-
todo!()
1149+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1150+
if self.was_remapped() {
1151+
write!(fmt, "SourceFileName({}, remapped from {})", self.name, self.unmapped_path())
1152+
} else {
1153+
write!(fmt, "SourceFileName({})", self.name)
1154+
}
11511155
}
11521156
}
11531157

0 commit comments

Comments
 (0)