Add runtime check to avoid overwrite arg easily in diag and store and restore snapshot when set subdiag arg

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
xizheyin
2025-06-22 00:12:13 +08:00
parent 2fcf1776b9
commit d2d17c60bd
22 changed files with 119 additions and 39 deletions

View File

@@ -1509,7 +1509,7 @@ pub(crate) struct EnumVariantSameName<'tcx> {
#[primary_span]
pub variant_span: Span,
pub dead_name: Symbol,
pub descr: &'tcx str,
pub dead_descr: &'tcx str,
}
#[derive(Subdiagnostic)]
@@ -1707,6 +1707,7 @@ impl Subdiagnostic for UnusedVariableStringInterp {
#[derive(LintDiagnostic)]
#[diag(passes_unused_variable_try_ignore)]
pub(crate) struct UnusedVarTryIgnore {
pub name: String,
#[subdiagnostic]
pub sugg: UnusedVarTryIgnoreSugg,
}