Skip to content

Commit f396cb4

Browse files
Update on struct expressions (check #32769)
1 parent 3a0409d commit f396cb4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/doc/reference.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2553,7 +2553,7 @@ comma:
25532553

25542554
There are several forms of struct expressions. A _struct expression_
25552555
consists of the [path](#paths) of a [struct item](#structs), followed by
2556-
a brace-enclosed list of one or more comma-separated name-value pairs,
2556+
a brace-enclosed list of zero or more comma-separated name-value pairs,
25572557
providing the field values of a new instance of the struct. A field name
25582558
can be any identifier, and is separated from its value expression by a colon.
25592559
The location denoted by a struct field is mutable if and only if the
@@ -2572,10 +2572,12 @@ The following are examples of struct expressions:
25722572

25732573
```
25742574
# struct Point { x: f64, y: f64 }
2575+
# struct NothingInMe { }
25752576
# struct TuplePoint(f64, f64);
25762577
# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: usize } }
25772578
# struct Cookie; fn some_fn<T>(t: T) {}
25782579
Point {x: 10.0, y: 20.0};
2580+
NothingInMe {};
25792581
TuplePoint(10.0, 20.0);
25802582
let u = game::User {name: "Joe", age: 35, score: 100_000};
25812583
some_fn::<Cookie>(Cookie);

0 commit comments

Comments
 (0)