Migrate 'rust-call incorrect arguments' diagnostic

This commit is contained in:
clubby789
2023-09-15 01:10:08 +00:00
parent 9edeb19f96
commit b40f11c8a9
3 changed files with 12 additions and 5 deletions
+3
View File
@@ -90,6 +90,9 @@ hir_typeck_return_stmt_outside_of_fn_body =
.encl_body_label = the {$statement_kind} is part of this body...
.encl_fn_label = ...not the enclosing function body
hir_typeck_rustcall_incorrect_args =
functions with the "rust-call" ABI must take a single non-self tuple argument
hir_typeck_struct_expr_non_exhaustive =
cannot create non-exhaustive {$what} using struct expression
+2 -5
View File
@@ -382,7 +382,7 @@ fn confirm_builtin_call(
// to let us test the trait evaluation system.
// Untranslatable diagnostics are okay for rustc internals
#[allow(rustc::untranslatable_diagnostic)]
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::diagnostic_outside_of_impl)]
if self.tcx.has_attr(def_id, sym::rustc_evaluate_where_clauses) {
let predicates = self.tcx.predicates_of(def_id);
let predicates = predicates.instantiate(self.tcx, args);
@@ -474,10 +474,7 @@ fn confirm_builtin_call(
);
self.require_type_is_sized(ty, sp, traits::RustCall);
} else {
self.tcx.sess.span_err(
sp,
"functions with the \"rust-call\" ABI must take a single non-self tuple argument",
);
self.tcx.sess.emit_err(errors::RustCallIncorrectArgs { span: sp });
}
}
+7
View File
@@ -54,6 +54,13 @@ fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
}
}
#[derive(Diagnostic)]
#[diag(hir_typeck_rustcall_incorrect_args)]
pub struct RustCallIncorrectArgs {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(hir_typeck_yield_expr_outside_of_generator, code = "E0627")]
pub struct YieldExprOutsideOfGenerator {