Skip to content

Commit e36bfa1

Browse files
authored
[cargo-zerocopy] Pass --cfg __ZEROCOPY_INTERNAL_USE_ONL_TOOLCHAIN=... (#2983)
This allows testing code to detect the current named toolchain. Unlike the `rustversion` crate, it won't require us to update use sites when we update pinned toolchain versions. gherrit-pr-id: G9c6fe23f1983e0f1a3d30e1db70e020595260e23
1 parent 78088c4 commit e36bfa1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/cargo-zerocopy/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ fn get_rustflags(name: &str) -> String {
169169
let mut flags =
170170
"--cfg zerocopy_derive_union_into_bytes --cfg __ZEROCOPY_INTERNAL_USE_ONLY_DEV_MODE"
171171
.to_string();
172+
flags += &format!(" --cfg __ZEROCOPY_INTERNAL_USE_ONLY_TOOLCHAIN=\"{name}\"");
172173

173174
if name == "nightly" {
174175
flags += " --cfg __ZEROCOPY_INTERNAL_USE_ONLY_NIGHTLY_FEATURES_IN_TESTS";

0 commit comments

Comments
 (0)