From c85a6817115ae21f322595570c4a01a75ea5ad82 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 26 Oct 2023 01:45:42 +0900 Subject: [PATCH] tests: Adjust cfgs --- test_suite/build.rs | 20 +++++++++++++++----- test_suite/tests/test.rs | 8 ++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/test_suite/build.rs b/test_suite/build.rs index 5f1e225..f45e7be 100644 --- a/test_suite/build.rs +++ b/test_suite/build.rs @@ -8,11 +8,21 @@ fn main() { println!("cargo:rerun-if-changed=build.rs"); let cfg = autocfg::new(); - cfg.emit_rustc_version(1, 31); - cfg.emit_rustc_version(1, 33); - cfg.emit_rustc_version(1, 39); - cfg.emit_rustc_version(1, 46); - cfg.emit_rustc_version(1, 61); + if cfg.probe_rustc_version(1, 31) { + println!("cargo:rustc-cfg=rustc_1_31"); + } + if cfg.probe_rustc_version(1, 33) { + println!("cargo:rustc-cfg=rustc_1_33"); + } + if cfg.probe_rustc_version(1, 39) { + println!("cargo:rustc-cfg=rustc_1_39"); + } + if cfg.probe_rustc_version(1, 46) { + println!("cargo:rustc-cfg=rustc_1_46"); + } + if cfg.probe_rustc_version(1, 61) { + println!("cargo:rustc-cfg=rustc_1_61"); + } if is_nightly() { println!("cargo:rustc-cfg=const_unstable"); diff --git a/test_suite/tests/test.rs b/test_suite/tests/test.rs index 2d23165..0e62684 100644 --- a/test_suite/tests/test.rs +++ b/test_suite/tests/test.rs @@ -75,13 +75,13 @@ pub mod signature { // const async unsafe extern // functions cannot be both `const` and `async`, but rustc syntactically accepts this. - #[const_fn(cfg(FALSE))] + #[const_fn(cfg(any()))] async unsafe extern "C" fn const_async_unsafe_extern_non_const() {} - #[const_fn(cfg(FALSE))] + #[const_fn(cfg(any()))] pub async unsafe extern "C" fn const_async_unsafe_extern_non_const_pub() {} - #[const_fn(cfg(FALSE))] + #[const_fn(cfg(any()))] const async unsafe extern "C" fn const_async_unsafe_extern_const() {} - #[const_fn(cfg(FALSE))] + #[const_fn(cfg(any()))] pub const async unsafe extern "C" fn const_async_unsafe_extern_const_pub() {} }