Skip to content

Commit

Permalink
Auto merge of #34742 - abhijeetbhagat:master, r=steveklabnik
Browse files Browse the repository at this point in the history
Update on struct expressions

Update doc for struct expressions (#32769)
  • Loading branch information
bors authored Jul 11, 2016
2 parents 47b3a98 + f396cb4 commit f684f5b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2633,7 +2633,7 @@ comma:

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

```
# struct Point { x: f64, y: f64 }
# struct NothingInMe { }
# struct TuplePoint(f64, f64);
# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: usize } }
# struct Cookie; fn some_fn<T>(t: T) {}
Point {x: 10.0, y: 20.0};
NothingInMe {};
TuplePoint(10.0, 20.0);
let u = game::User {name: "Joe", age: 35, score: 100_000};
some_fn::<Cookie>(Cookie);
Expand Down

0 comments on commit f684f5b

Please sign in to comment.