diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2018-01-18 17:17:46 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2018-01-29 11:40:50 +0530 |
| commit | 937bc2e04aaad37f97d367f7c5073c352e357bb5 (patch) | |
| tree | d145db7363e4645e9fd8dea3ccd3e368c92ed180 /src/librustc_errors/diagnostic_builder.rs | |
| parent | 385ef1514c80fb8c0cb061dc69eb1d953a84e2b3 (diff) | |
| download | rust-937bc2e04aaad37f97d367f7c5073c352e357bb5.tar.gz rust-937bc2e04aaad37f97d367f7c5073c352e357bb5.zip | |
Add approximate suggestions for rustfix
This adds `span_approximate_suggestion()` that lets you emit a suggestion marked as "approximate" in the JSON output. UI users see no difference. This is for when rustc and clippy wish to emit suggestions which will make sense to the reader (e.g. they may have placeholders like `<type>`) but are not source-applicable, so that rustfix/etc can ignore these. fixes #39254
Diffstat (limited to 'src/librustc_errors/diagnostic_builder.rs')
| -rw-r--r-- | src/librustc_errors/diagnostic_builder.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 61674ada6fa..2536fc648c7 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -186,6 +186,16 @@ impl<'a> DiagnosticBuilder<'a> { msg: &str, suggestions: Vec<String>) -> &mut Self); + forward!(pub fn span_approximate_suggestion(&mut self, + sp: Span, + msg: &str, + suggestion: String) + -> &mut Self); + forward!(pub fn span_approximate_suggestions(&mut self, + sp: Span, + msg: &str, + suggestions: Vec<String>) + -> &mut Self); forward!(pub fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self); forward!(pub fn code(&mut self, s: DiagnosticId) -> &mut Self); |
