Skip to content

Commit

Permalink
Unrolled build for rust-lang#130667
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#130667 - workingjubilee:she-is-c-c-c-cold, r=compiler-errors

compiler: Accept "improper" ctypes in extern "rust-cold" fn
  • Loading branch information
rust-timer authored Sep 22, 2024
2 parents 1d68e6d + 93993c7 commit b60c771
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_lint/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,10 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
}

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`.
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/lint/rust-cold-fn-accept-improper-ctypes.rs
Original file line number Diff line number Diff line change
@@ -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() {}

0 comments on commit b60c771

Please sign in to comment.