Skip to content

Commit

Permalink
tests: Adjust cfgs
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Oct 25, 2023
1 parent 49dc563 commit c85a681
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
20 changes: 15 additions & 5 deletions test_suite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions test_suite/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
}

Expand Down

0 comments on commit c85a681

Please sign in to comment.