-
- Downloads
Auto merge of #1044 - faern:modern-alignment, r=alexcrichton
Add alignment feature and use #[repr(align(x))] Trying to solve #1042. Here I introduce the discussed feature that will allow going from struct alignment with a private `__align` field to using `#[repr(align(x))]`. However, I have not implemented it for all structs that require alignment yet, only `in6_addr`. This because I did not want to spend too much time before we have discussed and solved the remaining questions regarding this. One thing to discuss is testing. I have so far not done anything to the CI scripts. So currently they will still test the crate only with the `align` feature disabled. Thus they will make sure the `__align` fields are still correct. But no automatic tests make sure everything is correct when the `align` feature is turned on. What do we want to do about that? Can we insert another `cargo test` with `--features align` to make all the Travis jobs run the test suite twice, or will that slow things down too much? I have tried using this version of libc in rustc and the standard library. And successfully changed `Ipv6Addr::new` to not use any `unsafe` and to become a `const fn`. Whether or not we want that is out of scope for this PR, but my point was that the changes introduced with this PR allow much more flexible usage of the libc structs that have alignment.
No related branches found
No related tags found
Showing
- Cargo.toml 1 addition, 0 deletionsCargo.toml
- README.md 10 additions, 0 deletionsREADME.md
- ci/run.sh 5 additions, 1 deletionci/run.sh
- libc-test/Cargo.toml 1 addition, 0 deletionslibc-test/Cargo.toml
- src/fuchsia/mod.rs 110 additions, 38 deletionssrc/fuchsia/mod.rs
- src/macros.rs 17 additions, 0 deletionssrc/macros.rs
- src/redox/net.rs 2 additions, 0 deletionssrc/redox/net.rs
- src/unix/mod.rs 2 additions, 0 deletionssrc/unix/mod.rs
- src/unix/newlib/mod.rs 72 additions, 23 deletionssrc/unix/newlib/mod.rs
- src/unix/notbsd/emscripten.rs 27 additions, 12 deletionssrc/unix/notbsd/emscripten.rs
- src/unix/notbsd/linux/mips/mips32.rs 52 additions, 54 deletionssrc/unix/notbsd/linux/mips/mips32.rs
- src/unix/notbsd/linux/mips/mips64.rs 52 additions, 54 deletionssrc/unix/notbsd/linux/mips/mips64.rs
- src/unix/notbsd/linux/mips/mod.rs 5 additions, 0 deletionssrc/unix/notbsd/linux/mips/mod.rs
- src/unix/notbsd/linux/mod.rs 112 additions, 38 deletionssrc/unix/notbsd/linux/mod.rs
- src/unix/notbsd/linux/other/b32/mod.rs 52 additions, 54 deletionssrc/unix/notbsd/linux/other/b32/mod.rs
- src/unix/notbsd/linux/other/b64/aarch64.rs 28 additions, 27 deletionssrc/unix/notbsd/linux/other/b64/aarch64.rs
- src/unix/notbsd/linux/other/b64/not_x32.rs 52 additions, 54 deletionssrc/unix/notbsd/linux/other/b64/not_x32.rs
- src/unix/notbsd/linux/other/b64/powerpc64.rs 52 additions, 54 deletionssrc/unix/notbsd/linux/other/b64/powerpc64.rs
- src/unix/notbsd/linux/other/b64/sparc64.rs 25 additions, 24 deletionssrc/unix/notbsd/linux/other/b64/sparc64.rs
- src/unix/notbsd/linux/other/b64/x32.rs 25 additions, 24 deletionssrc/unix/notbsd/linux/other/b64/x32.rs
Loading
Please register or sign in to comment