I'm using v2.0.0-preview branch to play with demo, code snip as following:
(using sgx_types and sgx_crypto)

```rust
fn sha_hash(input: &str) -> sgx_types::error::SgxResult<String> {
    let v = match Sha256::digest(input.as_bytes()) {
        Ok(v) => v,
        Err(e) => return Err(e),
    };
    let bytes = v.as_slice();
    let result = base64::engine::general_purpose::STANDARD.encode(&bytes);
    Ok(result)
}
```

rustc fails with

```
error[E0308]: mismatched types
   --> src/lib.rs:52:30
    |
52  |         Err(e) => return Err(e),
    |                          --- ^ expected `SgxStatus`, found 
`sgx_types::error::SgxStatus`
    |                          |
    |                          arguments to this enum variant are incorrect
    |
    = note: `sgx_types::error::SgxStatus` and `SgxStatus` have similar names, 
but are actually distinct types
note: `sgx_types::error::SgxStatus` is defined in crate `sgx_types`
   --> 
/home/ubuntu/preview/incubator-teaclave-sgx-sdk/sgx_types/src/error/mod.rs:24:1
    |
24  | / impl_enum! {
25  | |     #[repr(u32)]
26  | |     #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
27  | |     pub enum SgxStatus {
...   |
112 | |     }
113 | | }
    | |_^
note: `SgxStatus` is defined in crate `sgx_types`
   --> 
/home/ubuntu/preview/incubator-teaclave-sgx-sdk/sgx_types/src/error/mod.rs:24:1
    |
24  | / impl_enum! {
25  | |     #[repr(u32)]
26  | |     #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
27  | |     pub enum SgxStatus {
...   |
112 | |     }
113 | | }
    | |_^
    = note: perhaps two different versions of crate `sgx_types` are being used?
```

I'm confused `SgxStatus` is defined in single local crate, it cannot be 
imported as multiple versions? and I tried to mimic this to minimal 
reproducible case with std codes (manually written), but it just compiles and 
runs

No idea what causes this, can you help?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/455
You are receiving this because you are subscribed to this thread.

Message ID: <apache/incubator-teaclave-sgx-sdk/issues/4...@github.com>

Reply via email to