Rollup merge of #83202 - pickfire:patch-6, r=JohnTitor

Show details in cfg version unstable book
This commit is contained in:
Yuki Okushi 2021-03-17 15:20:56 +09:00 committed by GitHub
commit b7863f91c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -7,19 +7,20 @@ The tracking issue for this feature is: [#64796]
------------------------
The `cfg_version` feature makes it possible to execute different code
depending on the compiler version.
depending on the compiler version. It will return true if the compiler
version is greater than or equal to the specified version.
## Examples
```rust
#![feature(cfg_version)]
#[cfg(version("1.42"))]
#[cfg(version("1.42"))] // 1.42 and above
fn a() {
// ...
}
#[cfg(not(version("1.42")))]
#[cfg(not(version("1.42")))] // 1.41 and below
fn a() {
// ...
}