Skip to content

Commit

Permalink
Disable span size tests when layout is randomized
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 19, 2024
1 parent 7b357af commit 6f894e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
with:
components: rust-src
- name: Enable type layout randomization
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout\ --cfg=randomize_layout >> $GITHUB_ENV
- run: cargo check
env:
RUSTFLAGS: --cfg procmacro2_nightly_testing ${{env.RUSTFLAGS}}
Expand All @@ -78,6 +78,22 @@ jobs:
env:
RUSTFLAGS: -Z allow-features= --cfg procmacro2_backtrace ${{env.RUSTFLAGS}}

layout:
name: Layout
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- run: cargo test --test test_size
- run: cargo test --test test_size --features span-locations
- run: cargo test --test test_size --no-default-features
- run: cargo test --test test_size --no-default-features --features span-locations

msrv:
name: Rust 1.56.0
needs: pre_ci
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fn main() {
println!("cargo:rustc-check-cfg=cfg(procmacro2_backtrace)");
println!("cargo:rustc-check-cfg=cfg(procmacro2_nightly_testing)");
println!("cargo:rustc-check-cfg=cfg(procmacro2_semver_exempt)");
println!("cargo:rustc-check-cfg=cfg(randomize_layout)");
println!("cargo:rustc-check-cfg=cfg(span_locations)");
println!("cargo:rustc-check-cfg=cfg(super_unstable)");
println!("cargo:rustc-check-cfg=cfg(wrap_proc_macro)");
Expand Down
2 changes: 2 additions & 0 deletions tests/test_size.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(randomize_layout))]

extern crate proc_macro;

use std::mem;
Expand Down

0 comments on commit 6f894e7

Please sign in to comment.