about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/json.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-02-01 03:58:32 +0000
committerbors <bors@rust-lang.org>2022-02-01 03:58:32 +0000
commit25862ffc8d360b34dd8ec82a2f01750aaab976b7 (patch)
treed9ef0def054f8bc2a497a7d3b5b3d17ed8c15f0f /compiler/rustc_errors/src/json.rs
parenta6cd4aa9a784e3d2e54bca2a1b41082fda67310d (diff)
parentf5a32711dc14ea66510bd5c8a21763183ee5fc99 (diff)
downloadrust-25862ffc8d360b34dd8ec82a2f01750aaab976b7.tar.gz
rust-25862ffc8d360b34dd8ec82a2f01750aaab976b7.zip
Auto merge of #93259 - eddyb:diagbld-scalar-pair, r=jackh726
rustc_errors: only box the `diagnostic` field in `DiagnosticBuilder`.

I happened to need to do the first change (replacing `allow_suggestions` with equivalent functionality on `Diagnostic` itself) as part of a larger change, and noticed that there's only two fields left in `DiagnosticBuilderInner`.

So with this PR, instead of a single pointer, `DiagnosticBuilder` is two pointers, which should work just as well for passing *it* by value (and may even work better wrt some operations, though probably not by much).

But anything that was already taking advantage of `DiagnosticBuilder` being a single pointer, and wrapping it further (e.g. `Result<T, DiagnosticBuilder>` w/ non-ZST `T`), ~~will probably see a slowdown~~, so I want to do a perf run before even trying to propose this.
Diffstat (limited to 'compiler/rustc_errors/src/json.rs')
-rw-r--r--compiler/rustc_errors/src/json.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs
index c2af2b2a86d..ff3478073d9 100644
--- a/compiler/rustc_errors/src/json.rs
+++ b/compiler/rustc_errors/src/json.rs
@@ -345,7 +345,7 @@ struct UnusedExterns<'a, 'b, 'c> {
 
 impl Diagnostic {
     fn from_errors_diagnostic(diag: &crate::Diagnostic, je: &JsonEmitter) -> Diagnostic {
-        let sugg = diag.suggestions.iter().map(|sugg| Diagnostic {
+        let sugg = diag.suggestions.iter().flatten().map(|sugg| Diagnostic {
             message: sugg.msg.clone(),
             code: None,
             level: "help",