borrowck/errors: fix i18n error in delayed bug
During borrowck, the `MultiSpan` from a buffered diagnostic is cloned and used to emit a delayed bug indicating a diagnostic was buffered - when the buffered diagnostic is translated, then the cloned `MultiSpan` may contain labels which can only render with the diagnostic's arguments, but the delayed bug being emitted won't have those arguments. Adds a function which clones `MultiSpan` without also cloning the contained labels, and use this function when creating the buffered diagnostic delayed bug. Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
parent
ced592a99b
commit
3857d9c2da
2 changed files with 12 additions and 5 deletions
|
@ -2306,11 +2306,10 @@ mod error {
|
|||
|
||||
pub fn buffer_error(&mut self, t: DiagnosticBuilder<'_, ErrorGuaranteed>) {
|
||||
if let None = self.tainted_by_errors {
|
||||
self.tainted_by_errors = Some(
|
||||
self.tcx
|
||||
.sess
|
||||
.delay_span_bug(t.span.clone(), "diagnostic buffered but not emitted"),
|
||||
)
|
||||
self.tainted_by_errors = Some(self.tcx.sess.delay_span_bug(
|
||||
t.span.clone_ignoring_labels(),
|
||||
"diagnostic buffered but not emitted",
|
||||
))
|
||||
}
|
||||
t.buffer(&mut self.buffered);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue