Move naked fn checks to hir_typeck

This commit is contained in:
Oli Scherer
2025-05-30 15:19:58 +00:00
parent 685d1c9e29
commit 02e2766cc3
8 changed files with 73 additions and 77 deletions

View File

@@ -1196,51 +1196,6 @@ pub(crate) struct UnlabeledCfInWhileCondition<'a> {
pub cf_type: &'a str,
}
#[derive(Diagnostic)]
#[diag(passes_no_patterns)]
pub(crate) struct NoPatterns {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(passes_params_not_allowed)]
#[help]
pub(crate) struct ParamsNotAllowed {
#[primary_span]
pub span: Span,
}
pub(crate) struct NakedFunctionsAsmBlock {
pub span: Span,
pub multiple_asms: Vec<Span>,
pub non_asms: Vec<Span>,
}
impl<G: EmissionGuarantee> Diagnostic<'_, G> for NakedFunctionsAsmBlock {
#[track_caller]
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
let mut diag = Diag::new(dcx, level, fluent::passes_naked_functions_asm_block);
diag.span(self.span);
diag.code(E0787);
for span in self.multiple_asms.iter() {
diag.span_label(*span, fluent::passes_label_multiple_asm);
}
for span in self.non_asms.iter() {
diag.span_label(*span, fluent::passes_label_non_asm);
}
diag
}
}
#[derive(Diagnostic)]
#[diag(passes_naked_functions_must_naked_asm, code = E0787)]
pub(crate) struct NakedFunctionsMustNakedAsm {
#[primary_span]
#[label]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(passes_naked_functions_incompatible_attribute, code = E0736)]
pub(crate) struct NakedFunctionIncompatibleAttribute {