2021-01-21 23:57:33 -06:00
|
|
|
#[cfg(version(42))] //~ ERROR: expected a version literal
|
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn foo() {}
|
|
|
|
#[cfg(version(1.20))] //~ ERROR: expected a version literal
|
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn foo() -> bool { true }
|
2020-04-19 03:47:55 -05:00
|
|
|
#[cfg(version("1.44"))]
|
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn foo() -> bool { true }
|
|
|
|
#[cfg(not(version("1.44")))]
|
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn foo() -> bool { false }
|
|
|
|
|
2020-04-28 09:07:11 -05:00
|
|
|
#[cfg(version("1.43", "1.44", "1.45"))] //~ ERROR: expected single version literal
|
2020-04-19 03:47:55 -05:00
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn bar() -> bool { false }
|
2020-04-28 09:07:11 -05:00
|
|
|
#[cfg(version(false))] //~ ERROR: expected a version literal
|
2020-04-19 03:47:55 -05:00
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn bar() -> bool { false }
|
2021-01-21 23:57:33 -06:00
|
|
|
#[cfg(version("foo"))] //~ WARNING: unknown version literal format
|
2020-04-28 09:07:11 -05:00
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn bar() -> bool { false }
|
2021-01-21 23:57:33 -06:00
|
|
|
#[cfg(version("999"))] //~ WARNING: unknown version literal format
|
2020-04-19 03:47:55 -05:00
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn bar() -> bool { false }
|
2021-01-21 23:57:33 -06:00
|
|
|
#[cfg(version("-1"))] //~ WARNING: unknown version literal format
|
2020-04-28 09:07:50 -05:00
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn bar() -> bool { false }
|
2021-01-21 23:57:33 -06:00
|
|
|
#[cfg(version("65536"))] //~ WARNING: unknown version literal format
|
2020-04-19 03:47:55 -05:00
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn bar() -> bool { false }
|
2021-01-21 23:57:33 -06:00
|
|
|
#[cfg(version("0"))] //~ WARNING: unknown version literal format
|
2020-04-19 03:47:55 -05:00
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn bar() -> bool { true }
|
2021-01-21 23:57:33 -06:00
|
|
|
#[cfg(version("1.0"))]
|
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn bar() -> bool { true }
|
|
|
|
#[cfg(version("1.65536.2"))] //~ WARNING: unknown version literal format
|
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
fn bar() -> bool { false }
|
|
|
|
#[cfg(version("1.20.0-stable"))] //~ WARNING: unknown version literal format
|
2020-04-28 09:07:50 -05:00
|
|
|
//~^ ERROR `cfg(version)` is experimental and subject to change
|
2021-01-21 23:57:33 -06:00
|
|
|
fn bar() {}
|
2020-04-28 09:07:50 -05:00
|
|
|
|
2020-04-19 03:47:55 -05:00
|
|
|
fn main() {
|
|
|
|
assert!(foo());
|
|
|
|
assert!(bar());
|
|
|
|
assert!(cfg!(version("1.42"))); //~ ERROR `cfg(version)` is experimental and subject to change
|
|
|
|
}
|