mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Migrate 'rust-call incorrect arguments' diagnostic
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user