We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c773442 commit e3f5ad6Copy full SHA for e3f5ad6
src/libsyntax/diagnostics/plugin.rs
@@ -92,6 +92,18 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
92
}
93
_ => unreachable!()
94
};
95
+ // Check that the description starts and ends with a newline.
96
+ description.map(|raw_msg| {
97
+ let msg = raw_msg.as_str();
98
+ let last = msg.len() - 1;
99
+ if &msg[0..1] != "\n" || &msg[last..] != "\n" {
100
+ ecx.span_err(span, &format!(
101
+ "description for error code {} doesn't start and end with a newline",
102
+ token::get_ident(*code)
103
+ ));
104
+ }
105
+ raw_msg
106
+ });
107
with_registered_diagnostics(|diagnostics| {
108
if diagnostics.insert(code.name, description).is_some() {
109
ecx.span_err(span, &format!(
0 commit comments