Xuanwo opened a new issue, #5235:
URL: https://github.com/apache/opendal/issues/5235

   ### Describe the bug
   
   Rust doesn't make sure to generate the same layout for the same struct 
defination.
   
   Read 
https://rust-lang.github.io/unsafe-code-guidelines/layout/structs-and-tuples.html
 for more.
   
   ```rust
   [src/v0_50_to_v0_49.rs:69:9] &new_info = AccessorInfo {
       scheme: Memory,
       root: "/",
       name: "0x7f3a1c00bc60",
       native_capability: { Stat | Read | Write | Delete | List | Blocking },
       full_capability: { Stat | Read | Write | CreateDir | Delete | List | 
Blocking },
   }
   [src/v0_50_to_v0_49.rs:71:9] &old_info = AccessorInfo {
       scheme: Memory,
       root: "/",
       name: "0x7f3a1c00bc60",
       native_capability: { Stat | List | Presign },
       full_capability: { Stat | Rename | List | Presign },
   }
   ```
   
   ### Steps to Reproduce
   
   ```rust
   use opendal_v0_50 as new_o;
   
   #[tokio::test]
   async fn test_read() {
       let new_op = 
new_o::Operator::from_config(new_o::services::MemoryConfig::default())
           .unwrap()
           .finish();
       let old_op = opendal_compat::v0_50_to_v0_49(new_op);
   
       old_op.write("test", "hello, world!").await.unwrap();
       let bs = old_op.read("test").await.unwrap();
       assert_eq!(String::from_utf8_lossy(&bs.to_vec()), "hello, world!");
   }
   ```
   
   This test will failed for:
   
   ```shell
   called `Result::unwrap()` on an `Err` value: Unsupported (permanent) at 
write => service memory doesn't support operation write
   
   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   
   
   failures:
       v0_50_to_v0_49::tests::test_read
   ```
   
   ### Expected Behavior
   
   We expect both read and write can work correctly.
   
   ### Additional Context
   
   _No response_
   
   ### Are you willing to submit a PR to fix this bug?
   
   - [X] Yes, I would like to submit a PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to