Sitelet https://github.com/starkware-libs/cairo/commit/c61ce65a30e63e493013651603a62cf1db18a60e
Skip to content

Commit c61ce65

Browse files
committed
bugfix(compiler): Fix punctuation/newline of bare crate-root diagnostics.
The "Failed to get main module file" and "{path} not found" messages reported when a crate's main module file is missing were inconsistent with every other diagnostic: the former lacked a trailing newline (so it ran into following output, since FormattedDiagnosticEntry's Display adds none and entries are emitted via eprint!), and both lacked the trailing period that diagnostic messages conventionally carry. Add the missing newline and periods.
1 parent 5051f92 commit c61ce65

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎crates/cairo-lang-compiler/src/diagnostics.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl<'a> DiagnosticsReporter<'a> {
160160
self.callback.on_diagnostic(FormattedDiagnosticEntry::new(
161161
Severity::Error,
162162
None,
163-
"Failed to get main module file".to_string(),
163+
"Failed to get main module file.\n".to_string(),
164164
));
165165
continue;
166166
};
@@ -171,7 +171,7 @@ impl<'a> DiagnosticsReporter<'a> {
171171
self.callback.on_diagnostic(FormattedDiagnosticEntry::new(
172172
Severity::Error,
173173
None,
174-
format!("{} not found\n", path.display()),
174+
format!("{} not found.\n", path.display()),
175175
))
176176
}
177177
FileLongId::Virtual(_) => panic!("Missing virtual file."),

‎crates/cairo-lang-compiler/src/diagnostics_test.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ fn test_diagnostics() {
1616
Some(CrateConfiguration::default_for_root(Directory::Real("no/such/path".into())))
1717
);
1818

19-
assert_eq!(get_diagnostics_as_string(&db, None), "error: no/such/path/lib.cairo not found\n");
19+
assert_eq!(get_diagnostics_as_string(&db, None), "error: no/such/path/lib.cairo not found.\n");
2020
}

0 commit comments

Comments
 (0)