Skip to content

Commit 6f894e7

Browse files
committed
Disable span size tests when layout is randomized
1 parent 7b357af commit 6f894e7

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
with:
5757
components: rust-src
5858
- name: Enable type layout randomization
59-
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
59+
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout\ --cfg=randomize_layout >> $GITHUB_ENV
6060
- run: cargo check
6161
env:
6262
RUSTFLAGS: --cfg procmacro2_nightly_testing ${{env.RUSTFLAGS}}
@@ -78,6 +78,22 @@ jobs:
7878
env:
7979
RUSTFLAGS: -Z allow-features= --cfg procmacro2_backtrace ${{env.RUSTFLAGS}}
8080

81+
layout:
82+
name: Layout
83+
needs: pre_ci
84+
if: needs.pre_ci.outputs.continue
85+
runs-on: ubuntu-latest
86+
timeout-minutes: 45
87+
steps:
88+
- uses: actions/checkout@v4
89+
- uses: dtolnay/rust-toolchain@nightly
90+
with:
91+
components: rust-src
92+
- run: cargo test --test test_size
93+
- run: cargo test --test test_size --features span-locations
94+
- run: cargo test --test test_size --no-default-features
95+
- run: cargo test --test test_size --no-default-features --features span-locations
96+
8197
msrv:
8298
name: Rust 1.56.0
8399
needs: pre_ci

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ fn main() {
5757
println!("cargo:rustc-check-cfg=cfg(procmacro2_backtrace)");
5858
println!("cargo:rustc-check-cfg=cfg(procmacro2_nightly_testing)");
5959
println!("cargo:rustc-check-cfg=cfg(procmacro2_semver_exempt)");
60+
println!("cargo:rustc-check-cfg=cfg(randomize_layout)");
6061
println!("cargo:rustc-check-cfg=cfg(span_locations)");
6162
println!("cargo:rustc-check-cfg=cfg(super_unstable)");
6263
println!("cargo:rustc-check-cfg=cfg(wrap_proc_macro)");

tests/test_size.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(not(randomize_layout))]
2+
13
extern crate proc_macro;
24

35
use std::mem;

0 commit comments

Comments
 (0)