compiler: Directly use rustc_abi in hir_{analysis,typeck}
This commit is contained in:
parent
bbd18e29da
commit
89ec8c2cfe
19 changed files with 58 additions and 56 deletions
|
@ -91,6 +91,7 @@ mod impl_wf_check;
|
|||
mod outlives;
|
||||
mod variance;
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::middle;
|
||||
|
@ -100,19 +101,23 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
|
|||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::traits;
|
||||
|
||||
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
||||
|
||||
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
|
||||
fn require_c_abi_if_c_variadic(
|
||||
tcx: TyCtxt<'_>,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
abi: ExternAbi,
|
||||
span: Span,
|
||||
) {
|
||||
const CONVENTIONS_UNSTABLE: &str =
|
||||
"`C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`";
|
||||
const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
|
||||
const UNSTABLE_EXPLAIN: &str =
|
||||
"using calling conventions other than `C` or `cdecl` for varargs functions is unstable";
|
||||
|
||||
if !decl.c_variadic || matches!(abi, Abi::C { .. } | Abi::Cdecl { .. }) {
|
||||
if !decl.c_variadic || matches!(abi, ExternAbi::C { .. } | ExternAbi::Cdecl { .. }) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue