Improve the diagnostics for unused generic parameters
This commit is contained in:
parent
cb4d9a1902
commit
02320b502d
43 changed files with 370 additions and 170 deletions
|
@ -1511,3 +1511,27 @@ pub struct NotSupportedDelegation<'a> {
|
|||
#[label]
|
||||
pub callee_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_unused_generic_parameter)]
|
||||
pub(crate) struct UnusedGenericParameter {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub param_name: Ident,
|
||||
pub param_def_kind: &'static str,
|
||||
#[subdiagnostic]
|
||||
pub help: UnusedGenericParameterHelp,
|
||||
#[help(hir_analysis_const_param_help)]
|
||||
pub const_param_help: Option<()>,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) enum UnusedGenericParameterHelp {
|
||||
#[help(hir_analysis_unused_generic_parameter_adt_help)]
|
||||
Adt { param_name: Ident, phantom_data: String },
|
||||
#[help(hir_analysis_unused_generic_parameter_adt_no_phantom_data_help)]
|
||||
AdtNoPhantomData { param_name: Ident },
|
||||
#[help(hir_analysis_unused_generic_parameter_ty_alias_help)]
|
||||
TyAlias { param_name: Ident },
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue