Skip to content

Failed to build because of incompatible type #18350

Closed
@zonyitoo

Description

@zonyitoo

I just upgraded my rustc to rustc 0.13.0-nightly (f168c12c5 2014-10-25 20:57:10 +0000). But when I tried to rebuild my project, it failed with the following errors:

/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:179:11: 179:17 error: cannot infer an appropriate lifetime due to conflicting requirements
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:179     match method {
                                                                             ^~~~~~
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:178:69: 246:2 note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the block at 178:68...
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:178 pub fn with_name(method: &str, key: &[u8]) -> Option<CipherVariant> {
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:179     match method {
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:180         #[cfg(feature="cipher-aes-cfb")]
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:181         CIPHER_AES_128_CFB => Some(OpenSSLCrypto(openssl::OpenSSLCipher::new(CipherTypeAes128Cfb, key))),
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:182         #[cfg(feature="cipher-aes-cfb")]
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:183         CIPHER_AES_128_CFB_1 => Some(OpenSSLCrypto(openssl::OpenSSLCipher::new(CipherTypeAes128Cfb1, key))),
                                                                   ...
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:179:11: 179:17 note: ...so that types are compatible (expected `&str`, found `&str`)
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:179     match method {
                                                                             ^~~~~~
note: but, the lifetime must be valid for the static lifetime...
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:238:9: 238:23 note: ...so that types are compatible (expected `&str`, found `&'static str`)
/Users/zonyitoo/Projects/shadowsocks-rust/src/crypto/cipher.rs:238         CIPHER_RC2_CFB => Some(OpenSSLCrypto(openssl::OpenSSLCipher::new(CipherTypeRc2Cfb, key))),
                                                                           ^~~~~~~~~~~~~~
error: aborting due to previous error

CIPHER_AES_128_CFB, CIPHER_AES_128_CFB_1, etc... are constants of type &'static str.

What does the error mean? I am confused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions