diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-05-16 15:12:24 +0200 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-07-17 10:03:37 +0200 |
| commit | a9d9a4aab4f6c51d16c2f13e69abcbe8f6c76725 (patch) | |
| tree | 8c6c3d0b30bf387247b71ee4af7d31a02b6a2aa6 /src/librustc_errors | |
| parent | 4a286639e8448476b0235c8fb2c8eeb7779b9251 (diff) | |
| download | rust-a9d9a4aab4f6c51d16c2f13e69abcbe8f6c76725.tar.gz rust-a9d9a4aab4f6c51d16c2f13e69abcbe8f6c76725.zip | |
Change some helps to suggestions
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/diagnostic.rs | 12 | ||||
| -rw-r--r-- | src/librustc_errors/emitter.rs | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index d7c21127474..ee07b6e909f 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -211,6 +211,18 @@ impl Diagnostic { /// Prints out a message with a suggested edit of the code. /// + /// In case of short messages and a simple suggestion, + /// rustc displays it as a label like + /// + /// "try adding parentheses: `(tup.0).1`" + /// + /// The message + /// * should not end in any punctuation (a `:` is added automatically) + /// * should not be a question + /// * should not contain any parts like "the following", "as shown" + /// * may look like "to do xyz, use" or "to do xyz, use abc" + /// * may contain a name of a function, variable or type, but not whole expressions + /// /// See `diagnostic::CodeSuggestion` for more information. pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self { self.suggestions.push(CodeSuggestion { diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 2aea6d125f2..3e8bd093f4f 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -51,7 +51,7 @@ impl Emitter for EmitterWriter { // This substitution is only removal, don't show it format!("help: {}", sugg.msg) } else { - format!("help: {} `{}`", sugg.msg, substitution) + format!("help: {}: `{}`", sugg.msg, substitution) }; primary_span.push_span_label(sugg.substitution_spans().next().unwrap(), msg); } else { |
