Remove stored args from diagnostics

This commit is contained in:
Jonathan Brouwer
2026-03-06 17:24:52 +01:00
parent 2b0552f0cb
commit c2f1e9d71d
3 changed files with 31 additions and 47 deletions
-12
View File
@@ -235,9 +235,6 @@ pub struct DiagInner {
pub suggestions: Suggestions,
pub args: DiagArgMap,
// This is used to store args and restore them after a subdiagnostic is rendered.
pub reserved_args: DiagArgMap,
/// This is not used for highlighting or rendering any error message. Rather, it can be used
/// as a sort key to sort a buffer of diagnostics. By default, it is the primary span of
/// `span` if there is one. Otherwise, it is `DUMMY_SP`.
@@ -268,7 +265,6 @@ pub fn new_with_messages(level: Level, messages: Vec<(DiagMessage, Style)>) -> S
children: vec![],
suggestions: Suggestions::Enabled(vec![]),
args: Default::default(),
reserved_args: Default::default(),
sort_span: DUMMY_SP,
is_lint: None,
long_ty_path: None,
@@ -333,14 +329,6 @@ pub fn remove_arg(&mut self, name: &str) {
self.args.swap_remove(name);
}
pub fn store_args(&mut self) {
self.reserved_args = self.args.clone();
}
pub fn restore_args(&mut self) {
self.args = std::mem::take(&mut self.reserved_args);
}
pub fn emitted_at_sub_diag(&self) -> Subdiag {
let track = format!("-Ztrack-diagnostics: created at {}", self.emitted_at);
Subdiag {