Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/expressions/block-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ r[expr.block.value-trailing-expr]
When a block contains a [final operand], the block has the type and value of that final operand.

```rust
let x: u8 = { 0u8 }; // `0u8` is the final operand.
let x = { 0u8 }; // `0u8` is the final operand.
assert_eq!(x, 0);
let x: u8 = { (); 0u8 }; // As above.
let x = { (); 0u8 }; // As above.
assert_eq!(x, 0);
```

r[expr.block.value-no-trailing-expr]
When a block does not contain a [final operand] and the block does not diverge, the block has [unit type] and [unit value].

```rust
let x: () = {}; // Has no final operand.
let x = {}; // Has no final operand.
assert_eq!(x, ());
let x: () = { 0u8; }; // As above.
let x = { 0u8; }; // As above.
assert_eq!(x, ());
```

Expand Down