Skip to content

tests: Change ABIs in tests to more future-resilient ones #142272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/debuginfo/type-names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// gdb-check:type = type_names::GenericStruct<type_names::mod1::Struct2, type_names::mod1::mod2::Struct3>

// gdb-command:whatis generic_struct2
// gdb-check:type = type_names::GenericStruct<type_names::Struct1, extern "fastcall" fn(isize) -> usize>
// gdb-check:type = type_names::GenericStruct<type_names::Struct1, extern "system" fn(isize) -> usize>

// gdb-command:whatis mod_struct
// gdb-check:type = type_names::mod1::Struct2
Expand Down Expand Up @@ -379,7 +379,7 @@ fn main() {
let simple_struct = Struct1;
let generic_struct1: GenericStruct<mod1::Struct2, mod1::mod2::Struct3> =
GenericStruct(PhantomData);
let generic_struct2: GenericStruct<Struct1, extern "fastcall" fn(isize) -> usize> =
let generic_struct2: GenericStruct<Struct1, extern "system" fn(isize) -> usize> =
GenericStruct(PhantomData);
let mod_struct = mod1::Struct2;

Expand Down
4 changes: 2 additions & 2 deletions tests/incremental/hashes/trait_defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ trait TraitAddExternModifier {

// Change extern "C" to extern "stdcall"
#[cfg(any(cfail1,cfail4))]
trait TraitChangeExternCToRustIntrinsic {
trait TraitChangeExternCToExternSystem {
// --------------------------------------------------------------
// -------------------------
// --------------------------------------------------------------
Expand All @@ -458,7 +458,7 @@ trait TraitChangeExternCToRustIntrinsic {
#[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
extern "stdcall" fn method();
extern "system" fn method();
}


Expand Down
9 changes: 3 additions & 6 deletions tests/rustdoc-json/fn_pointer/abi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(abi_vectorcall)]
#![feature(rust_cold_cc)]

//@ is "$.index[?(@.name=='AbiRust')].inner.type_alias.type.function_pointer.header.abi" \"Rust\"
pub type AbiRust = fn();
Expand All @@ -15,8 +15,5 @@ pub type AbiCUnwind = extern "C-unwind" fn();
//@ is "$.index[?(@.name=='AbiSystemUnwind')].inner.type_alias.type.function_pointer.header.abi" '{"System": {"unwind": true}}'
pub type AbiSystemUnwind = extern "system-unwind" fn();

//@ is "$.index[?(@.name=='AbiVecorcall')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall\""'
pub type AbiVecorcall = extern "vectorcall" fn();

//@ is "$.index[?(@.name=='AbiVecorcallUnwind')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall-unwind\""'
pub type AbiVecorcallUnwind = extern "vectorcall-unwind" fn();
//@ is "$.index[?(@.name=='AbiRustCold')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"rust-cold\""'
pub type AbiRustCold = extern "rust-cold" fn();
9 changes: 3 additions & 6 deletions tests/rustdoc-json/fns/abi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(abi_vectorcall)]
#![feature(rust_cold_cc)]

//@ is "$.index[?(@.name=='abi_rust')].inner.function.header.abi" \"Rust\"
pub fn abi_rust() {}
Expand All @@ -15,8 +15,5 @@ pub extern "C-unwind" fn abi_c_unwind() {}
//@ is "$.index[?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
pub extern "system-unwind" fn abi_system_unwind() {}

//@ is "$.index[?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
pub extern "vectorcall" fn abi_vectorcall() {}

//@ is "$.index[?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
pub extern "vectorcall-unwind" fn abi_vectorcall_unwind() {}
//@ is "$.index[?(@.name=='abi_rust_cold')].inner.function.header.abi.Other" '"\"rust-cold\""'
pub extern "rust-cold" fn abi_rust_cold() {}
17 changes: 5 additions & 12 deletions tests/rustdoc-json/methods/abi.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(abi_vectorcall)]

#![feature(rust_cold_cc)]
//@ has "$.index[?(@.name=='Foo')]"
pub struct Foo;

Expand All @@ -19,11 +18,8 @@ impl Foo {
//@ is "$.index[?(@.name=='abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
pub extern "system-unwind" fn abi_system_unwind() {}

//@ is "$.index[?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
pub extern "vectorcall" fn abi_vectorcall() {}

//@ is "$.index[?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
pub extern "vectorcall-unwind" fn abi_vectorcall_unwind() {}
//@ is "$.index[?(@.name=='abi_rust_cold')].inner.function.header.abi.Other" '"\"rust-cold\""'
pub extern "rust-cold" fn abi_rust_cold() {}
}

pub trait Bar {
Expand All @@ -42,9 +38,6 @@ pub trait Bar {
//@ is "$.index[?(@.name=='trait_abi_system_unwind')].inner.function.header.abi" '{"System": {"unwind": true}}'
extern "system-unwind" fn trait_abi_system_unwind() {}

//@ is "$.index[?(@.name=='trait_abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
extern "vectorcall" fn trait_abi_vectorcall() {}

//@ is "$.index[?(@.name=='trait_abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
extern "vectorcall-unwind" fn trait_abi_vectorcall_unwind() {}
//@ is "$.index[?(@.name=='trait_abi_rust_cold')].inner.function.header.abi.Other" '"\"rust-cold\""'
extern "rust-cold" fn trait_abi_rust_cold() {}
}
27 changes: 27 additions & 0 deletions tests/rustdoc-json/vectorcall.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#![feature(abi_vectorcall)]
//@ only-x86_64

//@ is "$.index[?(@.name=='AbiVectorcall')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall\""'
pub type AbiVectorcall = extern "vectorcall" fn();

//@ is "$.index[?(@.name=='AbiVectorcallUnwind')].inner.type_alias.type.function_pointer.header.abi.Other" '"\"vectorcall-unwind\""'
pub type AbiVectorcallUnwind = extern "vectorcall-unwind" fn();

//@ has "$.index[?(@.name=='Foo')]"
pub struct Foo;

impl Foo {
//@ is "$.index[?(@.name=='abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
pub extern "vectorcall" fn abi_vectorcall() {}

//@ is "$.index[?(@.name=='abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
pub extern "vectorcall-unwind" fn abi_vectorcall_unwind() {}
}

pub trait Bar {
//@ is "$.index[?(@.name=='trait_abi_vectorcall')].inner.function.header.abi.Other" '"\"vectorcall\""'
extern "vectorcall" fn trait_abi_vectorcall() {}

//@ is "$.index[?(@.name=='trait_abi_vectorcall_unwind')].inner.function.header.abi.Other" '"\"vectorcall-unwind\""'
extern "vectorcall-unwind" fn trait_abi_vectorcall_unwind() {}
}
Loading