Skip to content

Commit

Permalink
peace of mind: be absolutely sure we don't try to emit a 0-part sugge…
Browse files Browse the repository at this point in the history
…stion
  • Loading branch information
dianne committed Feb 5, 2025
1 parent b32a533 commit 8dcdb3e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_mir_build/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,9 @@ impl Subdiagnostic for Rust2024IncompatiblePatSugg {
};
format!("make the implied reference pattern{plural_derefs}{and_modes} explicit")
};
diag.multipart_suggestion_verbose(msg, self.suggestion, applicability);
// FIXME(dianne): for peace of mind, don't risk emitting a 0-part suggestion (that panics!)
if !self.suggestion.is_empty() {
diag.multipart_suggestion_verbose(msg, self.suggestion, applicability);
}
}
}

0 comments on commit 8dcdb3e

Please sign in to comment.