You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We were attempting to fix a name resolution bug in rustc on rust-lang/rust#112743. During our regression testing, we discovered an issue with rust-openssl. In this post, I'll describe the bug and explore potential solutions.
Error log
[INFO] [stderr] Compiling openssl-macros v0.1.1
[INFO] [stdout] error[E0425]: cannot find function, tuple struct or tuple variant `EVP_PKEY_id` in crate `ffi`
[INFO] [stdout] --> src/pkey.rs:195:36
[INFO] [stdout] |
[INFO] [stdout] 195 | unsafe { Id::from_raw(ffi::EVP_PKEY_id(self.as_ptr())) }
[INFO] [stdout] | ^^^^^^^^^^^ help: a constant with a similar name exists: `EVP_PKEY_DH`
[INFO] [stdout] |
[INFO] [stdout] ::: /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.88/src/./evp.rs:11:1
[INFO] [stdout] |
[INFO] [stdout] 11 | pub const EVP_PKEY_DH: c_int = NID_dhKeyAgreement;
[INFO] [stdout] | ---------------------------- similarly named constant `EVP_PKEY_DH` defined here
Actually, when we compile using rustc code.rs --cfg ossl300, we expect to see an ambiguous error related to EVP_PKEY_id. However, this error is not currently being thrown. Instead, the result indicates that EVP_PKEY_id is referring to openssl::evp::EVP_PKEY_id.
btw, if you remove the cfg_if, you will encounter an ambiguous error:
mod openssl {pubuseself::evp::*;pubuseself::handwritten::*;mod evp {#[cfg(all(ossl300, not(any())))]pubunsafefnEVP_PKEY_id(){}}mod handwritten {pubuseself::evp::*;mod evp {#[cfg(all(ossl300, not(any())))]pubunsafefnEVP_PKEY_id(){}#[cfg(all(not(any(ossl300))))]extern"C"{pubfnEVP_PKEY_id();}}}}pubuse openssl::*;fnmain(){unsafe{EVP_PKEY_id();// `EVP_PKEY_id` is ambiguous}}
Expected
Since I'm not familiar with this project, I'm not entirely certain how to fix this issue correctly. One possible solution is to remove the pub keyword from pub unsafe fn EVP_PKEY_id() {} in handwritten::evp, or to rename it. In any case, I believe we can resolve this problem and release a new version once it's fixed.
The text was updated successfully, but these errors were encountered:
Background
We were attempting to fix a name resolution bug in rustc on rust-lang/rust#112743. During our regression testing, we discovered an issue with rust-openssl. In this post, I'll describe the bug and explore potential solutions.
Error log
More details: rust-lang/rust#112743 (comment)
Reduced
Actually, when we compile using
rustc code.rs --cfg ossl300
, we expect to see an ambiguous error related to EVP_PKEY_id. However, this error is not currently being thrown. Instead, the result indicates that EVP_PKEY_id
is referring toopenssl::evp::EVP_PKEY_id
.btw, if you remove the
cfg_if
, you will encounter an ambiguous error:Expected
Since I'm not familiar with this project, I'm not entirely certain how to fix this issue correctly. One possible solution is to remove the
pub
keyword from pub unsafe fn EVP_PKEY_id() {}
in handwritten::evp
, or to rename it. In any case, I believe we can resolve this problem and release a new version once it's fixed.The text was updated successfully, but these errors were encountered: