Skip to content

Commit 6bf2b39

Browse files
committed
Canonicalise filenames in diagnostics before using them as a hashtable key
Fixes rust-lang#442
1 parent 7e55143 commit 6bf2b39

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/actions/post_build.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,16 @@ impl<O: Output> PostBuildHandler<O> {
9292
v.clear();
9393
}
9494

95+
let cwd = ::std::env::current_dir().unwrap();
96+
9597
for msg in &messages {
9698
if let Some(FileDiagnostic {
9799
file_path,
98100
diagnostic,
99101
suggestions,
100-
}) = parse_diagnostics(msg)
101-
{
102+
}) = parse_diagnostics(msg) {
102103
results
103-
.entry(file_path)
104+
.entry(cwd.join(file_path))
104105
.or_insert_with(Vec::new)
105106
.push((diagnostic, suggestions));
106107
}
@@ -237,11 +238,9 @@ fn primary_span(message: &CompilerMessage) -> Span {
237238
}
238239

239240
fn emit_notifications<O: Output>(build_results: &BuildResults, show_warnings: bool, out: &O) {
240-
let cwd = ::std::env::current_dir().unwrap();
241-
242241
for (path, diagnostics) in build_results {
243242
let params = PublishDiagnosticsParams {
244-
uri: Url::from_file_path(cwd.join(path)).unwrap(),
243+
uri: Url::from_file_path(path).unwrap(),
245244
diagnostics: diagnostics
246245
.iter()
247246
.filter_map(|&(ref d, _)| {

0 commit comments

Comments
 (0)