Rollup merge of #123841 - Kohei316:remove_qualifier_sugg, r=wesleywiser
Improve diagnostic by suggesting to remove visibility qualifier Resolves #123529 This PR improve diagnostic by suggesting to remove visibility qualifier.
This commit is contained in:
commit
15a8b490ea
19 changed files with 77 additions and 44 deletions
|
@ -266,7 +266,11 @@ impl<'a> AstValidator<'a> {
|
|||
return;
|
||||
}
|
||||
|
||||
self.dcx().emit_err(errors::VisibilityNotPermitted { span: vis.span, note });
|
||||
self.dcx().emit_err(errors::VisibilityNotPermitted {
|
||||
span: vis.span,
|
||||
note,
|
||||
remove_qualifier_sugg: vis.span,
|
||||
});
|
||||
}
|
||||
|
||||
fn check_decl_no_pat(decl: &FnDecl, mut report_err: impl FnMut(Span, Option<Ident>, bool)) {
|
||||
|
|
|
@ -31,6 +31,12 @@ pub struct VisibilityNotPermitted {
|
|||
pub span: Span,
|
||||
#[subdiagnostic]
|
||||
pub note: VisibilityNotPermittedNote,
|
||||
#[suggestion(
|
||||
ast_passes_remove_qualifier_sugg,
|
||||
code = "",
|
||||
applicability = "machine-applicable"
|
||||
)]
|
||||
pub remove_qualifier_sugg: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue