-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-craneliftThings relevant to the [future] cranelift backendThings relevant to the [future] cranelift backendA-testsuiteArea: The testsuite used to check the correctness of rustcArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Lines 253 to 269 in e41ced3
| #[test] | |
| #[allow(warnings)] | |
| // Have a symbol for the test below. It doesn’t need to be an actual variadic function, match the | |
| // ABI, or even point to an actual executable code, because the function itself is never invoked. | |
| #[no_mangle] | |
| pub fn test_variadic_fnptr() { | |
| use core::hash::{Hash, SipHasher}; | |
| extern { | |
| fn test_variadic_fnptr(_: u64, ...) -> f64; | |
| } | |
| let p: unsafe extern fn(u64, ...) -> f64 = test_variadic_fnptr; | |
| let q = p.clone(); | |
| assert_eq!(p, q); | |
| assert!(!(p < q)); | |
| let mut s = SipHasher::new(); | |
| assert_eq!(p.hash(&mut s), q.hash(&mut s)); | |
| } |
This causes a crash when trying to test libcore with cg_clif, as Cranelift doesn't allow incompatible definitions of the same function. While this currently works for cg_llvm, according to rust-lang/unsafe-code-guidelines#198 it is likely to become forbidden with cg_llvm too.
Metadata
Metadata
Assignees
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-craneliftThings relevant to the [future] cranelift backendThings relevant to the [future] cranelift backendA-testsuiteArea: The testsuite used to check the correctness of rustcArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.