Rollup merge of #130667 - workingjubilee:she-is-c-c-c-cold, r=compiler-errors

compiler: Accept "improper" ctypes in extern "rust-cold" fn
This commit is contained in:
Michael Goulet 2024-09-21 15:18:58 -04:00 committed by GitHub
commit a66563ff0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -1320,7 +1320,10 @@ fn check_foreign_static(&mut self, id: hir::OwnerId, span: Span) {
} }
fn is_internal_abi(&self, abi: SpecAbi) -> bool { fn is_internal_abi(&self, abi: SpecAbi) -> bool {
matches!(abi, SpecAbi::Rust | SpecAbi::RustCall | SpecAbi::RustIntrinsic) matches!(
abi,
SpecAbi::Rust | SpecAbi::RustCall | SpecAbi::RustCold | SpecAbi::RustIntrinsic
)
} }
/// Find any fn-ptr types with external ABIs in `ty`. /// Find any fn-ptr types with external ABIs in `ty`.

View File

@ -0,0 +1,14 @@
//@ check-pass
#![feature(rust_cold_cc)]
// extern "rust-cold" is a "Rust" ABI so we accept `repr(Rust)` types as arg/ret without warnings.
pub extern "rust-cold" fn f(_: ()) -> Result<(), ()> {
Ok(())
}
extern "rust-cold" {
pub fn g(_: ()) -> Result<(), ()>;
}
fn main() {}