-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement simplified backend selection
As proposed in #414, this commit changes the backend selection approach, introspecting `target_pointer_width` to select `u32_backend` vs `u64_backend` (or `fiat_u32_backend`/`fiat_u64_backend` if the `fiat_backend` feature is enabled). This helps eliminate the use of non-additive features, and also the rather confusing errors that happen if multiple backends are selected (i.e. thousands of lines of rustc errors). The selection logic checks if `target_pointer_width = "64"` and uses the 64-bit backend, or falls back to the 32-bit backend otherwise. This means the crate will always have a valid backend regardless of the pointer width, although there may be odd edge cases for exotic platforms which would optimally use the 64-bit backend but have a non-"64" target pointer width for whatever reason. We can handle those cases as they come up.
- Loading branch information
Showing
9 changed files
with
132 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,21 +10,23 @@ env: | |
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
test-u32: | ||
name: Test u32 backend | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: cargo test --no-default-features --features "std u32_backend" | ||
strategy: | ||
matrix: | ||
include: | ||
# 32-bit target | ||
- target: i686-unknown-linux-gnu | ||
deps: sudo apt update && sudo apt install gcc-multilib | ||
|
||
test-u64: | ||
name: Test u64 backend | ||
runs-on: ubuntu-latest | ||
# 64-bit target | ||
- target: x86_64-unknown-linux-gnu | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: cargo test --no-default-features --features "std u64_backend" | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: rustup target add ${{ matrix.target }} | ||
- run: ${{ matrix.deps }} | ||
- run: cargo test --target ${{ matrix.target }} | ||
|
||
build-simd: | ||
name: Build simd backend (nightly) | ||
|
@@ -54,7 +56,9 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: cargo test --lib --no-default-features --features "alloc u32_backend" | ||
- run: rustup target add i686-unknown-linux-gnu | ||
- run: sudo apt update && sudo apt install gcc-multilib | ||
- run: cargo test --lib --no-default-features --features alloc --target i686-unknown-linux-gnu | ||
|
||
nightly: | ||
name: Test nightly compiler | ||
|
@@ -72,11 +76,11 @@ jobs: | |
# First run `cargo +nightly -Z minimal-verisons check` in order to get a | ||
# Cargo.lock with the oldest possible deps | ||
- uses: dtolnay/rust-toolchain@nightly | ||
- run: cargo -Z minimal-versions check --no-default-features --features "fiat_u64_backend serde" | ||
- run: cargo -Z minimal-versions check --no-default-features --features fiat_backend,serde | ||
# Now check that `cargo build` works with respect to the oldest possible | ||
# deps and the stated MSRV | ||
- uses: dtolnay/[email protected] | ||
- run: cargo build --no-default-features --features "fiat_u64_backend serde" | ||
- run: cargo build --no-default-features --features fiat_backend,serde | ||
|
||
bench: | ||
name: Check that benchmarks compile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.