Skip to content

Commit f684f5b

Browse files
authored
Auto merge of #34742 - abhijeetbhagat:master, r=steveklabnik
Update on struct expressions Update doc for struct expressions (#32769)
2 parents 47b3a98 + f396cb4 commit f684f5b

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
@@ -2633,7 +2633,7 @@ comma:
26332633

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

26532653
```
26542654
# struct Point { x: f64, y: f64 }
2655+
# struct NothingInMe { }
26552656
# struct TuplePoint(f64, f64);
26562657
# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: usize } }
26572658
# struct Cookie; fn some_fn<T>(t: T) {}
26582659
Point {x: 10.0, y: 20.0};
2660+
NothingInMe {};
26592661
TuplePoint(10.0, 20.0);
26602662
let u = game::User {name: "Joe", age: 35, score: 100_000};
26612663
some_fn::<Cookie>(Cookie);

0 commit comments

Comments
 (0)