diff options
| author | bors <bors@rust-lang.org> | 2021-05-10 15:08:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-05-10 15:08:08 +0000 |
| commit | 266f452118e27e6a3d9d6b6f9d5483890a18345f (patch) | |
| tree | f7c265a409313ccccae721461c059e78dc0d8eb0 /compiler/rustc_errors/src | |
| parent | 544d124b81fb54e1904b6cd53de9bf92b6b3d0b9 (diff) | |
| parent | e76340191edaa9a517db8e670a73ff24143aeb23 (diff) | |
| download | rust-266f452118e27e6a3d9d6b6f9d5483890a18345f.tar.gz rust-266f452118e27e6a3d9d6b6f9d5483890a18345f.zip | |
Auto merge of #85150 - Dylan-DPC:rollup-q26gbx3, r=Dylan-DPC
Rollup of 6 pull requests
Successful merges:
- #85050 (Fix suggestions for missing return type lifetime specifiers)
- #85075 (Improve "panic message is not a string literal" warning)
- #85096 (Make unchecked_{add,sub,mul} inherent methods unstably const)
- #85112 (ensure failing promoteds in const/static bodies are handled correctly)
- #85146 (Provide io::Seek::rewind)
- #85147 (:arrow_up: rust-analyzer)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index b2f6a0c1014..14ccced2c6a 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -283,6 +283,22 @@ impl Diagnostic { suggestion: Vec<(Span, String)>, applicability: Applicability, ) -> &mut Self { + self.multipart_suggestion_with_style( + msg, + suggestion, + applicability, + SuggestionStyle::ShowCode, + ) + } + + /// [`Diagnostic::multipart_suggestion()`] but you can set the [`SuggestionStyle`]. + pub fn multipart_suggestion_with_style( + &mut self, + msg: &str, + suggestion: Vec<(Span, String)>, + applicability: Applicability, + style: SuggestionStyle, + ) -> &mut Self { assert!(!suggestion.is_empty()); self.suggestions.push(CodeSuggestion { substitutions: vec![Substitution { @@ -292,7 +308,7 @@ impl Diagnostic { .collect(), }], msg: msg.to_owned(), - style: SuggestionStyle::ShowCode, + style, applicability, tool_metadata: Default::default(), }); |
