You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/Rust-1.88.0.md
+14-8Lines changed: 14 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ For more information, see the original [unstable announcement](https://blog.rust
34
34
35
35
### Let chains
36
36
37
-
This feature allows `&&`-chaining `let` statements inside `if` and `while` conditions, even intermingling with boolean expressions, so there is less distinction between `if`/`if let` and `while`/`while let` anymore. The patterns inside the `let` sub-expressions can be irrefutable or refutable, and bindings are usable in later parts of the chain as well as the body.
37
+
This feature allows `&&`-chaining `let` statements inside `if` and `while` conditions, even intermingling with boolean expressions, so there is less distinction between `if`/`if let` and `while`/`while let`. The patterns inside the `let` sub-expressions can be irrefutable or refutable, and bindings are usable in later parts of the chain as well as the body.
38
38
39
39
For example, [this actual snippet](https://github.com/rust-lang/rust/blob/28f1c807911c63f08d98e7b468cfcf15a441e34b/compiler/rustc_ast_passes/src/feature_gate.rs#L327-L338) from the compiler combines multiple conditions which would have required nesting `if let` and `if` blocks before:
40
40
@@ -50,11 +50,13 @@ For example, [this actual snippet](https://github.com/rust-lang/rust/blob/28f1c8
50
50
}
51
51
```
52
52
53
-
Let chains are only available in the Rust 2024 edition, as this feature depends on the [`if let` temporary scope](https://doc.rust-lang.org/edition-guide/rust-2024/temporary-if-let-scope.html) change for more consistent drop order. Earlier efforts tried to work with all editions, but some difficult edges cases threatened the integrity of the implementation. 2024 made it feasible, so please upgrade your crate's edition if you'd like to use this feature!
53
+
Let chains are only available in the Rust 2024 edition, as this feature depends on the [`if let` temporary scope](https://doc.rust-lang.org/edition-guide/rust-2024/temporary-if-let-scope.html) change for more consistent drop order.
54
+
Earlier efforts tried to work with all editions, but some difficult edge cases threatened the integrity of the implementation. 2024 made it feasible, so please upgrade your crate's edition if you'd like to use this feature!
54
55
55
56
### Naked functions
56
57
57
-
Rust now supports writing naked functions with no compiler-generated epilogue and prologue, allowing full control over the generated assembly for a particular function. This is a more ergonomic alternative to defining functions in a `global_asm!` block. A naked function is marked with the `#[unsafe(naked)]` attribute, and its body consists of a single `naked_asm!` call, for example:
58
+
Rust now supports writing naked functions with no compiler-generated epilogue and prologue, allowing full control over the generated assembly for a particular function. This is a more ergonomic alternative to defining functions in a `global_asm!` block. A naked function is marked with the `#[unsafe(naked)]` attribute, and its body consists of a single `naked_asm!` call.
The handwritten assembly block defines the _entire_ function body: unlike non-naked functions, the compiler does not add any special handling for arguments or return values. Naked functions are used in low-level settings like Rust's [`compiler-builtins`](https://github.com/rust-lang/compiler-builtins), operating systems, and embedded applications.
71
73
72
-
Look for a more detailed post soon on [Inside Rust](https://blog.rust-lang.org/inside-rust/)!
74
+
Look for a more detailed post on this soon!
73
75
74
76
### Boolean configuration
75
77
76
78
The `cfg` predicate language now supports boolean literals, `true` and `false`, acting as a configuration that is always enabled or disabled, respectively. This works in Rust [conditional compilation](https://doc.rust-lang.org/reference/conditional-compilation.html) with `cfg` and `cfg_attr` attributes and the built-in `cfg!` macro, and also in Cargo `[target]` tables in both [configuration](https://doc.rust-lang.org/cargo/reference/config.html#target) and [manifests](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies).
77
79
78
-
If you are familiar with set theory, you might already be using empty sets like `cfg(all())` for enabled and `cfg(any())` for disabled, but this meaning is rather implicit and easy to get backwards. The boolean literals offer a more direct way to say what you mean.
80
+
If you are familiar with set theory, you might already be using empty sets like `cfg(all())` for enabled and `cfg(any())` for disabled, but this meaning is rather implicit and easy to get backwards. `cfg(true)` and `cfg(false)` offer a more direct way to say what you mean.
79
81
80
-
See [RFC 3695](https://rust-lang.github.io/rfcs/3695-cfg-boolean-literals.html) for more!
82
+
See [RFC 3695](https://rust-lang.github.io/rfcs/3695-cfg-boolean-literals.html) for more background!
81
83
82
84
### Stabilized APIs
83
85
@@ -97,8 +99,12 @@ These previously stable APIs are now stable in const contexts:
0 commit comments